Skip to content

Commit

Permalink
GSCHED-640: use NIR_INSTRUMENTS
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanmiller committed Mar 5, 2024
1 parent efbfbfb commit e0068ea
Showing 1 changed file with 13 additions and 5 deletions.
18 changes: 13 additions & 5 deletions scheduler/core/components/optimizer/greedymax.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,10 @@ def _exec_time_remaining(self,
sci_times_min.append(time_remain)

# NIR science time for to determine the number of tellurics
if any(inst in group.required_resources() for inst in NIR_INSTRUMENTS):
if any(inst in obs.required_resources() for inst in NIR_INSTRUMENTS):
exec_sci_nir += time_remain
if verbose:
print(f'Adding {time_remain} to exec_sci_nir')
elif obs.obs_class == ObservationClass.PARTNERCAL:
# Partner calibration time, no splitting of partner cals
nprt += 1
Expand Down Expand Up @@ -458,9 +460,6 @@ def nir_slots(self, science_obs, n_slots_filled, len_interval) -> Tuple[int, int
"""
Return the starting and ending timeline slots (indices) for the NIR science observations.
"""
# TODO: This should probably be moved to a more general location
nir_inst = [Resource('Flamingos2'), Resource('GNIRS'), Resource('NIRI'), Resource('NIFS'),
Resource('IGRINS')]

# science, split at atom
slot_start_nir = None
Expand All @@ -483,7 +482,7 @@ def nir_slots(self, science_obs, n_slots_filled, len_interval) -> Tuple[int, int

slot_end = slot_start + visit_length - 1
# NIR science time for to determine the number of tellurics
if any(inst in obs.required_resources() for inst in nir_inst):
if any(inst in obs.required_resources() for inst in NIR_INSTRUMENTS):
if slot_start_nir is None:
slot_start_nir = slot_start + n_slots_acq # start of the science sequence, after acq
slot_end_nir = slot_end
Expand Down Expand Up @@ -914,6 +913,15 @@ def add(self, night_idx: NightIndex, max_group_info: GroupData | MaxGroup) -> bo
prog_obs = max_group_info.group_data.group.program_observations()
part_obs = max_group_info.group_data.group.partner_observations()

# print(f'Adding {max_group_info.group_data.group.unique_id.id} MaxScore:{max_group_info.max_score:7.2f} '
# f'n_std:{max_group_info.n_std} obs_mode:{max_group_info.group_data.group.obs_mode()} '
# f'nir_sci:{max_group_info.exec_sci_nir}')
# print(f'{max_group_info.group_data.group.required_resources()}')
# [print(wav) for wav in max_group_info.group_data.group.wavelengths()]
# print('Program observations')
# [print(f'\t {obs.unique_id.id}') for obs in prog_obs]
# print('Partner observations')
# [print(f'\t {obs.unique_id.id}') for obs in part_obs]
if max_group_info.n_std > 0:
if max_group_info.exec_sci_nir > ZeroTime:
standards, place_before = self.place_standards(night_idx, best_interval, prog_obs, part_obs,
Expand Down

0 comments on commit e0068ea

Please sign in to comment.