Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CADC-13953 - Gemini MAROON-X use case has no positional axes. #185

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions caom2utils/caom2utils/blueprints.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2024. (c) 2024.
# (c) 2025. (c) 2025.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -727,18 +727,6 @@ def _guess_axis_info_from_plan(self):
'Only one positional axis found '
'(ra/dec): {}/{}'.format(self._axis_info['ra'][0], self._axis_info['dec'][0])
)
else:
# assume that positional axis are 1 and 2 by default
if (
self._axis_info['time'][0] in [1, 2]
or self._axis_info['energy'][0] in [1, 2]
or self._axis_info['polarization'][0] in [1, 2]
or self._axis_info['obs'][0] in [1, 2]
or self._axis_info['custom'][0] in [1, 2]
):
raise ValueError('Cannot determine the positional axis')
else:
self.configure_position_axes((1, 2), False)

if self._axis_info['time'][1]:
self.configure_time_axis(self._axis_info['time'][0], False)
Expand Down
30 changes: 11 additions & 19 deletions caom2utils/caom2utils/parsers.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# ****************** CANADIAN ASTRONOMY DATA CENTRE *******************
# ************* CENTRE CANADIEN DE DONNÉES ASTRONOMIQUES **************
#
# (c) 2024. (c) 2024.
# (c) 2025. (c) 2025.
# Government of Canada Gouvernement du Canada
# National Research Council Conseil national de recherches
# Ottawa, Canada, K1A 0R6 Ottawa, Canada, K1A 0R6
Expand Down Expand Up @@ -858,23 +858,15 @@ def _get_axis_wcs(self, label, wcs, index):

aug_axis = None
aug_error = None
if wcs is not None and wcs.axis is not None and wcs.axis.axis is not None:
aug_axis = wcs.axis.axis
aug_error = wcs.axis.error
else:
aug_axis_ctype = self._get_from_list(f'Chunk.{label}.axis.axis.ctype', index)
aug_axis_cunit = self._get_from_list(f'Chunk.{label}.axis.axis.cunit', index)
if aug_axis_ctype is not None:
aug_axis = caom2.Axis(aug_axis_ctype, aug_axis_cunit)
self.logger.debug(f'Creating {label} Axis for {self.uri} from blueprint')

aug_error = self._two_param_constructor(
f'Chunk.{label}.axis.error.syser',
f'Chunk.{label}.axis.error.rnder',
index,
_to_float,
caom2.CoordError,
)
aug_axis_ctype = self._get_from_list(f'Chunk.{label}.axis.axis.ctype', index)
aug_axis_cunit = self._get_from_list(f'Chunk.{label}.axis.axis.cunit', index)
if aug_axis_ctype is not None:
aug_axis = caom2.Axis(aug_axis_ctype, aug_axis_cunit)
self.logger.debug(f'Creating {label} Axis for {self.uri} from blueprint')

aug_error = self._two_param_constructor(
f'Chunk.{label}.axis.error.syser', f'Chunk.{label}.axis.error.rnder', index, _to_float, caom2.CoordError,
)

aug_naxis = None
aug_range = self._try_range(index, label)
Expand Down Expand Up @@ -1098,7 +1090,7 @@ def _try_energy_with_blueprint(self, chunk, index):
:param chunk: The chunk to modify with the addition of energy information.
:param index: The index in the blueprint for looking up plan information.
"""
self.logger.debug('Begin augmentation with blueprint for energy.')
self.logger.debug(f'Begin augmentation with blueprint for energy with index {index}.')
aug_axis, aug_naxis_index = self._get_axis_wcs('energy', chunk.energy, index)
specsys = _to_str(self._get_from_list('Chunk.energy.specsys', index))
if aug_axis is None:
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
Observation.observationID = ['OBSID'], default = None
Observation.type = FLAT
Observation.intent = calibration
Observation.metaRelease = 2025-01-01T17:19:57
Observation.metaProducer = GEMINI2caom2/0.0.0
Observation.algorithm.name = exposure
Observation.instrument.name = MAROON-X
Observation.instrument.keywords = ['INSTMODE'], default = None
Observation.proposal.id = get_proposal_id()
Observation.target.name = ['OBJECT'], default = None
Observation.target.type = object
Observation.telescope.name = ['TELESCOP'], default = None
Observation.telescope.geoLocationX = -5464284.386715498
Observation.telescope.geoLocationY = -2493782.309107667
Observation.telescope.geoLocationZ = 2150786.380689657
Observation.environment.ambientTemp = ['TEMPERAT'], default = None
Plane.productID = N20250101M0624
Plane.metaRelease = 2025-01-01T17:19:5
Plane.dataRelease = 2025-01-01T17:19:5
Plane.dataProductType = spectrum
Plane.calibrationLevel = 1
Plane.metaProducer = GEMINI2caom2/0.0.0
Plane.provenance.name = Gemini Observatory Data
Plane.provenance.project = Gemini Archive
Plane.provenance.producer = ['IMAGESWV', 'ORIGIN'], default = Gemini Observatory
Plane.provenance.reference = http://archive.gemini.edu/searchform/GN-CAL20250101-0-0
Plane.provenance.lastExecuted = ['DATE-FTS'], default = None
Artifact.productType = calibration
Artifact.releaseType = data
Artifact.uri = gemini:GEMINI/N20250101M0624.fits
Artifact.metaProducer = GEMINI2caom2/0.0.0
Chunk = include
Chunk.metaProducer = GEMINI2caom2/0.0.0
Chunk.energy.specsys = TOPOCENT
Chunk.energy.ssysobs = ['SSYSOBS'], default = None
Chunk.energy.restfrq = ['RESTFRQ'], default = None
Chunk.energy.restwav = ['RESTWAV'], default = None
Chunk.energy.velosys = ['VELOSYS'], default = None
Chunk.energy.zsource = ['ZSOURCE'], default = None
Chunk.energy.ssyssrc = ['SSYSSRC'], default = None
Chunk.energy.velang = ['VELANG'], default = None
Chunk.energy.bandpassName = [], default = None
Chunk.energy.resolvingPower = 85000.0
Chunk.energy.axis.axis.ctype = ['CTYPE1'], default = None
Chunk.energy.axis.axis.cunit = ['CUNIT1'], default = None
Chunk.energy.axis.error.syser = ['CSYER1'], default = None
Chunk.energy.axis.error.rnder = ['CRDER1'], default = None
Chunk.energy.axis.function.naxis = ['NAXIS1'], default = None
Chunk.energy.axis.function.delta = ['CDELT1'], default = None
Chunk.energy.axis.function.refCoord.pix = ['CRPIX1'], default = None
Chunk.energy.axis.function.refCoord.val = ['CRVAL1'], default = None
Chunk.time.exposure = get_exposure()
Chunk.time.resolution = get_exposure()
Chunk.time.timesys = ['TIMESYS'], default = UTC
Chunk.time.trefpos = ['TREFPOS'], default = None
Chunk.time.mjdref = ['MJDREF'], default = None
Chunk.time.axis.axis.ctype = TIME
Chunk.time.axis.axis.cunit = d
Chunk.time.axis.error.syser = 1e-07
Chunk.time.axis.error.rnder = 1e-07
Chunk.time.axis.function.naxis = 1
Chunk.time.axis.function.delta = get_time_delta()
Chunk.time.axis.function.refCoord.pix = 0.5
Chunk.time.axis.function.refCoord.val = get_time_function_val()
extension 1:
Chunk.energy.specsys = TOPOCENT
Chunk.energy.axis.axis.ctype = WAVE
Chunk.energy.axis.axis.cunit = nm
Chunk.energy.axis.range.start.pix = 0.5
Chunk.energy.axis.range.start.val = get_energy_chunk_range_start_val()
Chunk.energy.axis.range.end.pix = 1.5
Chunk.energy.axis.range.end.val = get_energy_chunk_range_end_val()
extension 2:
Chunk.energy.specsys = TOPOCENT
Chunk.energy.axis.axis.ctype = WAVE
Chunk.energy.axis.axis.cunit = nm
Chunk.energy.axis.range.start.pix = 0.5
Chunk.energy.axis.range.start.val = get_energy_chunk_range_start_val()
Chunk.energy.axis.range.end.pix = 1.5
Chunk.energy.axis.range.end.val = get_energy_chunk_range_end_val()
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
<?xml version='1.0' encoding='UTF-8'?>
<caom2:Observation xmlns:caom2="http://www.opencadc.org/caom2/xml/v2.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="caom2:SimpleObservation" caom2:id="5c030b5a-dfa4-477b-94a8-5a4a3bcb9530" caom2:metaProducer="GEMINI2caom2/0.0.0">
<caom2:collection>GEMINI</caom2:collection>
<caom2:observationID>GN-CAL20250101-0-0624</caom2:observationID>
<caom2:metaRelease>2025-01-01T17:19:57.000</caom2:metaRelease>
<caom2:algorithm>
<caom2:name>exposure</caom2:name>
</caom2:algorithm>
<caom2:type>FLAT</caom2:type>
<caom2:intent>calibration</caom2:intent>
<caom2:proposal>
<caom2:id>PROPOSAL ID</caom2:id>
</caom2:proposal>
<caom2:target>
<caom2:name>Flat lamp</caom2:name>
<caom2:type>object</caom2:type>
</caom2:target>
<caom2:telescope>
<caom2:name>Gemini-North</caom2:name>
<caom2:geoLocationX>-5464284.386715498</caom2:geoLocationX>
<caom2:geoLocationY>-2493782.309107667</caom2:geoLocationY>
<caom2:geoLocationZ>2150786.380689657</caom2:geoLocationZ>
</caom2:telescope>
<caom2:instrument>
<caom2:name>MAROON-X</caom2:name>
</caom2:instrument>
<caom2:planes>
<caom2:plane caom2:id="5e3b4c40-e5e9-4d7d-b829-54bc5e34bdc7" caom2:metaProducer="GEMINI2caom2/0.0.0">
<caom2:productID>N20250101M0624</caom2:productID>
<caom2:metaRelease>2025-01-01T17:19:05.000</caom2:metaRelease>
<caom2:dataRelease>2025-01-01T17:19:05.000</caom2:dataRelease>
<caom2:dataProductType>spectrum</caom2:dataProductType>
<caom2:calibrationLevel>1</caom2:calibrationLevel>
<caom2:provenance>
<caom2:name>Gemini Observatory Data</caom2:name>
<caom2:project>Gemini Archive</caom2:project>
<caom2:producer>Gemini Observatory</caom2:producer>
<caom2:reference>http://archive.gemini.edu/searchform/GN-CAL20250101-0-0</caom2:reference>
</caom2:provenance>
<caom2:artifacts>
<caom2:artifact caom2:id="b5f27870-1a78-4a6c-979e-6bcc868b3ffd" caom2:metaProducer="GEMINI2caom2/0.0.0">
<caom2:uri>cadc:GEMINI/N20250101M0624.fits</caom2:uri>
<caom2:productType>calibration</caom2:productType>
<caom2:releaseType>data</caom2:releaseType>
<caom2:contentType>application/fits</caom2:contentType>
<caom2:contentLength>77497920</caom2:contentLength>
<caom2:contentChecksum>md5:6b7fd635d107c1c39d313c9e3131ccfd</caom2:contentChecksum>
<caom2:parts>
<caom2:part caom2:id="7aa6bb5b-7dc9-44ef-b42a-0ea138550a33">
<caom2:name>0</caom2:name>
<caom2:chunks/>
</caom2:part>
<caom2:part caom2:id="21b4f6f7-08dd-417e-ae84-a594d46164b5">
<caom2:name>1</caom2:name>
<caom2:chunks>
<caom2:chunk caom2:id="d388f880-c052-42f0-be15-022ff51a920c" caom2:metaProducer="GEMINI2caom2/0.0.0">
<caom2:naxis>2</caom2:naxis>
<caom2:timeAxis>4</caom2:timeAxis>
<caom2:energy>
<caom2:axis>
<caom2:axis>
<caom2:ctype>WAVE</caom2:ctype>
<caom2:cunit>nm</caom2:cunit>
</caom2:axis>
<caom2:range>
<caom2:start>
<caom2:pix>0.5</caom2:pix>
<caom2:val>499.0</caom2:val>
</caom2:start>
<caom2:end>
<caom2:pix>1.5</caom2:pix>
<caom2:val>663.0</caom2:val>
</caom2:end>
</caom2:range>
</caom2:axis>
<caom2:specsys>TOPOCENT</caom2:specsys>
<caom2:resolvingPower>85000.0</caom2:resolvingPower>
</caom2:energy>
<caom2:time>
<caom2:axis>
<caom2:axis>
<caom2:ctype>TIME</caom2:ctype>
<caom2:cunit>d</caom2:cunit>
</caom2:axis>
<caom2:error>
<caom2:syser>1e-07</caom2:syser>
<caom2:rnder>1e-07</caom2:rnder>
</caom2:error>
<caom2:function>
<caom2:naxis>1</caom2:naxis>
<caom2:delta>12.0</caom2:delta>
<caom2:refCoord>
<caom2:pix>0.5</caom2:pix>
<caom2:val>0.0</caom2:val>
</caom2:refCoord>
</caom2:function>
</caom2:axis>
<caom2:timesys>UTC</caom2:timesys>
<caom2:exposure>4.0</caom2:exposure>
<caom2:resolution>4.0</caom2:resolution>
</caom2:time>
</caom2:chunk>
</caom2:chunks>
</caom2:part>
<caom2:part caom2:id="cb0bc9d7-d432-4ef7-b8da-1274e77cc52c">
<caom2:name>2</caom2:name>
<caom2:chunks>
<caom2:chunk caom2:id="7359fa0a-cec6-4957-a095-a00b5d8a26ba" caom2:metaProducer="GEMINI2caom2/0.0.0">
<caom2:naxis>2</caom2:naxis>
<caom2:timeAxis>4</caom2:timeAxis>
<caom2:energy>
<caom2:axis>
<caom2:axis>
<caom2:ctype>WAVE</caom2:ctype>
<caom2:cunit>nm</caom2:cunit>
</caom2:axis>
<caom2:range>
<caom2:start>
<caom2:pix>0.5</caom2:pix>
<caom2:val>649.0</caom2:val>
</caom2:start>
<caom2:end>
<caom2:pix>1.5</caom2:pix>
<caom2:val>920.0</caom2:val>
</caom2:end>
</caom2:range>
</caom2:axis>
<caom2:specsys>TOPOCENT</caom2:specsys>
<caom2:resolvingPower>85000.0</caom2:resolvingPower>
</caom2:energy>
<caom2:time>
<caom2:axis>
<caom2:axis>
<caom2:ctype>TIME</caom2:ctype>
<caom2:cunit>d</caom2:cunit>
</caom2:axis>
<caom2:error>
<caom2:syser>1e-07</caom2:syser>
<caom2:rnder>1e-07</caom2:rnder>
</caom2:error>
<caom2:function>
<caom2:naxis>1</caom2:naxis>
<caom2:delta>12.0</caom2:delta>
<caom2:refCoord>
<caom2:pix>0.5</caom2:pix>
<caom2:val>0.0</caom2:val>
</caom2:refCoord>
</caom2:function>
</caom2:axis>
<caom2:timesys>UTC</caom2:timesys>
<caom2:exposure>4.0</caom2:exposure>
<caom2:resolution>4.0</caom2:resolution>
</caom2:time>
</caom2:chunk>
</caom2:chunks>
</caom2:part>
</caom2:parts>
</caom2:artifact>
</caom2:artifacts>
</caom2:plane>
</caom2:planes>
</caom2:Observation>
Loading