44"""
55
66from datetime import datetime
7- from typing import TYPE_CHECKING , List , Optional
7+ from typing import List , Optional
88
99import sqlalchemy
1010from sqlmodel import Field , Relationship , SQLModel , create_engine
1111
12- if TYPE_CHECKING :
13- from murfey .util .processing_db import (
14- CTF ,
15- MotionCorrection ,
16- ParticleClassificationGroup ,
17- ParticlePicker ,
18- RelativeIceThickness ,
19- TiltImageAlignment ,
20- Tomogram ,
21- )
22-
2312"""
2413GENERAL
2514"""
@@ -440,14 +429,6 @@ class DataCollectionGroup(SQLModel, table=True): # type: ignore
440429 sa_relationship_kwargs = {"cascade" : "delete" },
441430 )
442431 )
443- grid_squares : List ["GridSquare" ] = Relationship (
444- back_populates = "data_collection_group" ,
445- sa_relationship_kwargs = {"cascade" : "delete" },
446- )
447- search_maps : List ["SearchMap" ] = Relationship (
448- back_populates = "data_collection_group" ,
449- sa_relationship_kwargs = {"cascade" : "delete" },
450- )
451432
452433
453434class NotificationParameter (SQLModel , table = True ): # type: ignore
@@ -487,13 +468,6 @@ class DataCollection(SQLModel, table=True): # type: ignore
487468 processing_jobs : List ["ProcessingJob" ] = Relationship (
488469 back_populates = "data_collection" , sa_relationship_kwargs = {"cascade" : "delete" }
489470 )
490- movies : List ["Movie" ] = Relationship (
491- back_populates = "data_collection" , sa_relationship_kwargs = {"cascade" : "delete" }
492- )
493- MotionCorrection : List ["MotionCorrection" ] = Relationship (
494- back_populates = "DataCollection"
495- )
496- Tomogram : List ["Tomogram" ] = Relationship (back_populates = "DataCollection" )
497471
498472
499473class ProcessingJob (SQLModel , table = True ): # type: ignore
@@ -595,20 +569,6 @@ class AutoProcProgram(SQLModel, table=True): # type: ignore
595569 murfey_ids : List ["MurfeyLedger" ] = Relationship (
596570 back_populates = "auto_proc_program" , sa_relationship_kwargs = {"cascade" : "delete" }
597571 )
598- MotionCorrection : List ["MotionCorrection" ] = Relationship (
599- back_populates = "DataCollection"
600- )
601- Tomogram : List ["Tomogram" ] = Relationship (back_populates = "AutoProcProgram" )
602- CTF : List ["CTF" ] = Relationship (back_populates = "AutoProcProgram" )
603- ParticlePicker : List ["ParticlePicker" ] = Relationship (
604- back_populates = "AutoProcProgram"
605- )
606- RelativeIceThickness : List ["RelativeIceThickness" ] = Relationship (
607- back_populates = "AutoProcProgram"
608- )
609- ParticleClassificationGroup : List ["ParticleClassificationGroup" ] = Relationship (
610- back_populates = "AutoProcProgram"
611- )
612572
613573
614574class MurfeyLedger (SQLModel , table = True ): # type: ignore
@@ -660,13 +620,6 @@ class GridSquare(SQLModel, table=True): # type: ignore
660620 thumbnail_size_x : Optional [int ]
661621 thumbnail_size_y : Optional [int ]
662622 pixel_size : Optional [float ] = None
663- scaled_pixel_size : Optional [float ] = None
664- pixel_location_x : Optional [int ] = None
665- pixel_location_y : Optional [int ] = None
666- height : Optional [int ] = None
667- width : Optional [int ] = None
668- angle : Optional [float ] = None
669- quality_indicator : Optional [float ] = None
670623 image : str = ""
671624 session : Optional [Session ] = Relationship (back_populates = "grid_squares" )
672625 clem_image_series : List ["CLEMImageSeries" ] = Relationship (
@@ -675,9 +628,6 @@ class GridSquare(SQLModel, table=True): # type: ignore
675628 foil_holes : List ["FoilHole" ] = Relationship (
676629 back_populates = "grid_square" , sa_relationship_kwargs = {"cascade" : "delete" }
677630 )
678- data_collection_group : Optional ["DataCollectionGroup" ] = Relationship (
679- back_populates = "grid_squares"
680- )
681631
682632
683633class FoilHole (SQLModel , table = True ): # type: ignore
@@ -694,11 +644,6 @@ class FoilHole(SQLModel, table=True): # type: ignore
694644 thumbnail_size_x : Optional [int ]
695645 thumbnail_size_y : Optional [int ]
696646 pixel_size : Optional [float ] = None
697- scaled_pixel_size : Optional [float ] = None
698- pixel_location_x : Optional [int ] = None
699- pixel_location_y : Optional [int ] = None
700- diameter : Optional [int ] = None
701- quality_indicator : Optional [float ] = None
702647 image : str = ""
703648 grid_square : Optional [GridSquare ] = Relationship (back_populates = "foil_holes" )
704649 session : Optional [Session ] = Relationship (back_populates = "foil_holes" )
@@ -713,21 +658,13 @@ class FoilHole(SQLModel, table=True): # type: ignore
713658class SearchMap (SQLModel , table = True ): # type: ignore
714659 id : Optional [int ] = Field (primary_key = True , default = None )
715660 session_id : int = Field (foreign_key = "session.id" )
716- atlas_id : Optional [int ] = Field (foreign_key = "datacollectiongroup.id" )
717661 name : str
718662 tag : str
719663 x_location : Optional [float ] = None
720664 y_location : Optional [float ] = None
721665 x_stage_position : Optional [float ] = None
722666 y_stage_position : Optional [float ] = None
723667 pixel_size : Optional [float ] = None
724- scaled_pixel_size : Optional [float ] = None
725- pixel_location_x : Optional [int ] = None
726- pixel_location_y : Optional [int ] = None
727- scaled_height : Optional [int ] = None
728- scaled_width : Optional [int ] = None
729- angle : Optional [float ] = None
730- quality_indicator : Optional [float ] = None
731668 image : str = ""
732669 binning : Optional [float ] = None
733670 reference_matrix_m11 : Optional [float ] = None
@@ -748,27 +685,17 @@ class SearchMap(SQLModel, table=True): # type: ignore
748685 tilt_series : List ["TiltSeries" ] = Relationship (
749686 back_populates = "search_map" , sa_relationship_kwargs = {"cascade" : "delete" }
750687 )
751- data_collection_group : Optional ["DataCollectionGroup" ] = Relationship (
752- back_populates = "search_maps"
753- )
754- Tomogram : List ["Tomogram" ] = Relationship (back_populates = "SearchMap" )
755688
756689
757690class Movie (SQLModel , table = True ): # type: ignore
758691 murfey_id : int = Field (primary_key = True , foreign_key = "murfeyledger.id" )
759692 foil_hole_id : int = Field (foreign_key = "foilhole.id" , nullable = True , default = None )
760- data_collection_id : Optional [int ] = Field (foreign_key = "datacollection.id" )
761693 path : str
762694 image_number : int
763695 tag : str
764696 preprocessed : bool = False
765697 murfey_ledger : Optional [MurfeyLedger ] = Relationship (back_populates = "movies" )
766698 foil_hole : Optional [FoilHole ] = Relationship (back_populates = "movies" )
767- data_collection : Optional ["DataCollection" ] = Relationship (back_populates = "movies" )
768- MotionCorrection : List ["MotionCorrection" ] = Relationship (back_populates = "Movie" )
769- TiltImageAlignment : List ["TiltImageAlignment" ] = Relationship (
770- back_populates = "Movie"
771- )
772699
773700
774701class CtfParameters (SQLModel , table = True ): # type: ignore
0 commit comments