Skip to content

Conversation

cquiroz
Copy link
Contributor

@cquiroz cquiroz commented Oct 16, 2025

Turns out that the calibration system is more complicated than originally designed. There are several families of calibrations. The one we have implemented now is called per program per configuration and includes twilights and spectrophotometric.

The next one is for tellurics and we will call it per science observation. In this PR we do a large refactoring splitting CalibrationService services into two while the original one remains as a coordinator.

We also implement the first step where all flamingos 2 longslit observations will be in its own system group. The creation and dissolution of these groups is automatically handled by the system.

Now system groups can have a list of calibration roles as well.

@cquiroz cquiroz changed the title Refs/heads/sc 6979 create telluric system groups Create telluric system groups Oct 16, 2025
@mergify mergify bot added the schema label Oct 16, 2025
fpu: Flamingos2Fpu
) extends CalibrationConfigSubset derives Eq:

def modeTypeTag: String = "flamingos_2_long_slit"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These seem to be 1:1 with the lucuma.core.enums.ObservingModeType. Perhaps we could use that here?

obs_rec.c_observing_mode_type::text || '/' || 'telluric' || '/' || obs_rec.c_observation_id,
NULL,
NULL,
false,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The order will matter for tellurics won't it? Maybe the properties are edited when you add the calibrations though?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good catch

-- Only system groups can have calibration roles
ALTER TABLE t_group
ADD CONSTRAINT group_calibration_roles_system_only_check
CHECK (c_system = true OR c_calibration_roles = '{}');
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the idea that the UI will hide the groups with calibration roles associated with single observations? Do we care which calibrations go in there or just whether they are per-observation vs. per-unique config?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I put this just for completness seemed odd to have the current calibrations group without roles

Copy link
Contributor

@swalker2m swalker2m left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not very familiar with calibrations (or groups for that matter) but the code looks good. I didn't realize we already had system groups. It makes sense to me to keep using those. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants