@@ -115,22 +115,40 @@ def run_job(self, batch, assume_clean_state):
115
115
with tm .utils .ExperimentSession (self .experiment_id ) as session :
116
116
sites = session .query (tm .Site .id , tm .Site .height , tm .Site .width , tm .Site .y , tm .Site .x ).\
117
117
filter_by (well_id = well_id ).all ()
118
+
119
+ sites_id = [i [0 ] for i in sites ] #list of site ids for this well
120
+
121
+ logger .debug (
122
+ 'well_id: %s has site_id: %s'
123
+ , well_id , len (sites ))
124
+
118
125
wellY = sites [0 ][1 ]* len (set ([i [3 ] for i in sites ]))
119
126
wellX = sites [0 ][2 ]* len (set ([i [4 ]for i in sites ]))
120
-
121
-
122
127
extract_mapobject_type_id = session .query (tm .MapobjectType .id ).\
123
128
filter_by (name = batch ['extract_object' ]).one ()[0 ]
129
+
130
+ logger .debug (
131
+ 'id of %s is: %s '
132
+ , batch ['extract_object' ], extract_mapobject_type_id )
133
+
124
134
extract_seg_layer_id = session .query (tm .SegmentationLayer .id ).\
125
135
filter_by (mapobject_type_id = extract_mapobject_type_id ).one ()[0 ]
136
+
126
137
extract_centroids = session .query (tm .MapobjectSegmentation .geom_centroid ,tm .MapobjectSegmentation .mapobject_id ,tm .MapobjectSegmentation .label ,tm .MapobjectSegmentation .partition_key ).\
127
- filter_by (segmentation_layer_id = extract_seg_layer_id ).all ()
138
+ filter (tm .MapobjectSegmentation .segmentation_layer_id == extract_seg_layer_id ).\
139
+ filter (tm .MapobjectSegmentation .partition_key .in_ (sites_id ) ).all ()
140
+
141
+ logger .debug (
142
+ 'well_id: %s has %s sites and a total of %s centroids'
143
+ , well_id , len (sites ), len (extract_centroids ))
144
+
128
145
assign_mapobject_type_id = session .query (tm .MapobjectType .id ).\
129
146
filter_by (name = batch ['assign_object' ]).one ()[0 ]
130
147
assign_seg_layer_id = session .query (tm .SegmentationLayer .id ).\
131
148
filter_by (mapobject_type_id = assign_mapobject_type_id ).one ()[0 ]
132
149
assign_centroids = session .query (tm .MapobjectSegmentation .geom_centroid ,tm .MapobjectSegmentation .mapobject_id ,tm .MapobjectSegmentation .label ,tm .MapobjectSegmentation .partition_key ).\
133
- filter_by (segmentation_layer_id = assign_seg_layer_id ).all ()
150
+ filter (tm .MapobjectSegmentation .segmentation_layer_id == assign_seg_layer_id ).\
151
+ filter (tm .MapobjectSegmentation .partition_key .in_ (sites_id ) ).all ()
134
152
135
153
logger .info ('Calculating LCC for well_id %s' , well_id )
136
154
logger .info ('Instantiating LCC for extract_object' )
0 commit comments