Skip to content

Commit ecbb16f

Browse files
committed
Make sure offset_valid=True except when not valid
1 parent 291cad2 commit ecbb16f

File tree

2 files changed

+12
-2
lines changed

2 files changed

+12
-2
lines changed

src/jaeger/fvc.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -478,15 +478,19 @@ def process_fvc_image(
478478
assigned = fdata.filter(
479479
(
480480
polars.col.assigned.any()
481+
& polars.col.disabled.not_().all()
481482
& polars.col.offline.not_().all()
482483
& polars.col.dubious.not_().all()
484+
& polars.col.valid.all()
483485
).over("positioner_id")
484486
)
485487
else:
486488
self.log("No assigned fibres found. Using all matched fibres.")
487489
assigned = fdata.filter(
488490
polars.col.offline.not_().all(),
491+
polars.col.disabled.not_().all(),
489492
polars.col.dubious.not_().all(),
493+
polars.col.valid.all(),
490494
)
491495

492496
# Now get the metrology fibre from those groups.

src/jaeger/target/assignment.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -165,6 +165,8 @@ def create_fibre_data(self):
165165
"delta_ra": None,
166166
"delta_dec": None,
167167
"assigned": False,
168+
"offset_valid": True,
169+
"valid": True,
168170
"too": False,
169171
}
170172

@@ -194,6 +196,7 @@ def create_fibre_data(self):
194196
"delta_dec": tdata_row_dict["delta_dec"],
195197
"assigned": True,
196198
"offset_valid": offset_valid,
199+
"valid": offset_valid,
197200
"too": tdata_row_dict["is_too"],
198201
}
199202
)
@@ -381,8 +384,10 @@ def compute_coordinates(self, epoch: Optional[float] = None):
381384

382385
# Select only the rows with valid ICRS coordinates.
383386
fibre_data_icrs = self.fibre_data.filter(
384-
polars.col("ra_icrs").is_not_null(),
385-
polars.col("dec_icrs").is_not_null(),
387+
polars.col.ra_icrs.is_not_null(),
388+
polars.col.dec_icrs.is_not_null(),
389+
polars.col.offset_valid,
390+
polars.col.valid,
386391
)
387392

388393
# Get the positioner data for the targets with ICRS. The returned
@@ -433,6 +438,7 @@ def compute_coordinates(self, epoch: Optional[float] = None):
433438
polars.col.alpha.is_null(),
434439
polars.col.beta.is_null(),
435440
polars.col.offset_valid.not_(),
441+
polars.col.valid.not_(),
436442
)
437443
unassigned = unassigned.with_columns(
438444
alpha=when.then(alpha0).otherwise(polars.col.alpha),

0 commit comments

Comments
 (0)