Skip to content

Commit

Permalink
Merge pull request #419 from bryanmiller/GSCHED-637
Browse files Browse the repository at this point in the history
Fix parsing GRACES sequences and calendar availability
  • Loading branch information
bryanmiller committed Mar 8, 2024
2 parents 87b7f04 + e0068ea commit 62a82a6
Show file tree
Hide file tree
Showing 3 changed files with 176 additions and 150 deletions.
20 changes: 14 additions & 6 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 Expand Up @@ -998,4 +1006,4 @@ def output_plans(self, plans: Plans) -> None:
obs_in_plan.visit_score,
obs_in_plan.peak_score)
plans[timeline.site].update_time_slots(timeline.slots_unscheduled())
print('')
# print('')
Loading

0 comments on commit 62a82a6

Please sign in to comment.