Skip to content

Conversation

@SogoMineo
Copy link
Contributor

There is a need for a user-provided fluxCal to be used as an
argument of FitFluxCalTask. We isolate ApplyFluxCalTask from
FitFluxCalTask for such a need.

Copy link
Member

@PaulPrice PaulPrice left a comment

Choose a reason for hiding this comment

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

I like that we're splitting up the fitFluxCal.py file: it was getting very large.

Good work!

pfsCalibrated = OutputConnection(
name="pfsCalibrated",
doc="Flux-calibrated object spectrum",
storageClass="PfsCalibratedSpectra", # deprecated in favor of PfsCalibrated
Copy link
Member

Choose a reason for hiding this comment

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

Can we update this?

ingestPredefinedFluxCal(args.repo, args.instrument, args.run, args.path, args.transfer)


def ingestPredefinedFluxCal(
Copy link
Member

Choose a reason for hiding this comment

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

Could you please put this function in python/pfs/drp/stella/gen3.py?



def main() -> None:
"""Ingest a predefined fluxCal file into a gen3 datastore."""
Copy link
Member

Choose a reason for hiding this comment

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

How are the predefined fluxCal files generated? The user writes a PfsFluxCalib however they want?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

There is not a concrete plan yet. For tests, I just re-ingested a usual fluxCal as fluxCal_predefined. But in reality, we need to take average of many fluxCals in some way.

@@ -0,0 +1,6 @@
description: Calibrate exposure with predefined fluxCal
Copy link
Member

Choose a reason for hiding this comment

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

Maybe add a comment that an empty quantum graph may be due to not being able to find the fluxCal.

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 will change the description to:

  Calibrate exposure with a single predefined fluxCal
  applied to every exposure.
  This pipeline requires a "predefined fluxCal",
  which is of the same file type as,
  but is distinguished from, a usual fluxCal.
  It is a prerequisite ingested with ingestPredefinedFluxCal.py.

parser.add_argument(
"fluxCal",
help="""
Path to a predefined fluxCal
Copy link
Member

Choose a reason for hiding this comment

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

Where does this file come from? If it's coming from the results for a different visit, I think it would be better to specify a collection and visit, and have the code retrieve the file from the butler.

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 was told that the fluxCal file will be made by taking average, in some way, of an arbitorarily chosen set of fluxCal files. I thought the program to do it would be a quick-and-dirty jupyter notebook, and therefore I had fluxCal specified by a path. If we write a pipeline to take the average, we will have to define a new dataset type fluxCal_predefined (or fluxCal_average?) which does not depend on visit dimension.

args = parser.parse_args()

input_collections = [x.strip() for x in args.input.split(",")]
input_collections = [x for x in input_collections if x]
Copy link
Member

Choose a reason for hiding this comment

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

Is it necessary to process the args.input? I think the butler does all this for you, doesn't it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

According to my experiment, comma-separated collection names in a single string was not recognized by Butler.

>>> butler=Butler.from_config(config=".", collections="test,test2,test3")
>>> butler.query_datasets("fluxCal", find_first=False)
lsst.daf.butler._exceptions.MissingCollectionError: No collection with name 'test,test2,test3' found.

if not os.path.isfile(args.fluxCal):
raise RuntimeError(f"'{args.fluxCal}' is not found or is not a file.")

butler = Butler.from_config(
Copy link
Member

Choose a reason for hiding this comment

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

Please put the below code in pfs.drp.stella.gen3. While the code is short and simple, bug fixes may become necessary at some point, and those are easier when the functional code lives under python/ instead of bin.src/.

There is a need for a user-provided `fluxCal` to be used as an
argument of FitFluxCalTask. We isolate ApplyFluxCalTask from
FitFluxCalTask for such a need.
PfsCalibratedSpectra (in drp_stella) has been deprecated in favor
of PfsCalibrated (in datamodel).
This program registers a single fluxCal many times with various
visit numbers so that the pipeline will use it to calibrate all
these visits.
Don't give up radial velocity estimation for all fibers
even if the estimation fails for a few fibers.
Catch the exception and continue.
@SogoMineo SogoMineo merged commit 5c7e08f into master Dec 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants