-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
CADC-11894 - introduce CFHT handling for metadata from HDF5 files. (#160
- Loading branch information
1 parent
1ab4153
commit 0ce0bf6
Showing
17 changed files
with
366 additions
and
42 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
51 changes: 51 additions & 0 deletions
51
caom2utils/caom2utils/tests/data/taos_h5file/def/attrs.blueprint
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
Observation.algorithm.name = ['PROGRAM'] | ||
Observation.metaRelease = 2018-05-21T02:07:22.0 | ||
Observation.type = OBJECT | ||
Observation.target.name = ['object_name'] | ||
Plane.calibrationLevel = 2 | ||
Plane.dataProductType = timeseries | ||
|
||
Chunk.position.axis.function.dimension.naxis1 = ['NAXIS1'] | ||
Chunk.position.axis.function.dimension.naxis2 = ['NAXIS2'] | ||
Chunk.position.axis.function.refCoord.coord1.pix = ['CRPIX1'] | ||
Chunk.position.axis.function.refCoord.coord1.val = ['CRVAL1'] | ||
Chunk.position.axis.function.refCoord.coord2.pix = ['CRPIX2'] | ||
Chunk.position.axis.function.refCoord.coord2.val = ['CRVAL2'] | ||
Chunk.position.axis.axis1.ctype = ['CTYPE1'] | ||
Chunk.position.axis.axis1.cunit = ['CUNIT1'] | ||
Chunk.position.axis.axis2.ctype = ['CTYPE2'] | ||
Chunk.position.axis.axis2.cunit = ['CUNIT2'] | ||
Chunk.position.axis.function.cd11 = ['PC1_1'] | ||
Chunk.position.axis.function.cd12 = ['PC1_2'] | ||
Chunk.position.axis.function.cd21 = ['PC2_1'] | ||
Chunk.position.axis.function.cd22 = ['PC2_2'] | ||
Chunk.position.equinox = ['EQUINOX'] | ||
Chunk.position.axis.error1.syser = None | ||
Chunk.position.axis.error1.rnder= None | ||
Chunk.position.axis.error2.syser = None | ||
Chunk.position.axis.error2.rnder = None | ||
Chunk.position.coordsys = None | ||
|
||
Chunk.energyAxis = 4 | ||
Chunk.energy.bandpassName = ['filter_name'] | ||
Chunk.energy.resolvingPower = _get_energy_resolving_power() | ||
Chunk.energy.specsys = TOPOCENT | ||
Chunk.energy.axis.function.naxis = 1 | ||
Chunk.energy.axis.axis.ctype = WAVE | ||
Chunk.energy.axis.axis.cunit = nm | ||
Chunk.energy.axis.function.delta = ['exposure_time'] | ||
Chunk.energy.axis.function.refCoord.pix = 0.5 | ||
Chunk.energy.axis.function.refCoord.val = _get_fwhm() | ||
|
||
Chunk.timeAxis = 3 | ||
Chunk.time.axis.axis.ctype = TIME | ||
Chunk.time.axis.axis.cunit = s | ||
Chunk.time.axis.function.naxis = 1 | ||
Chunk.time.axis.function.delta = ['exposure_time'] | ||
Chunk.time.axis.function.refCoord.pix = 0.5 | ||
Chunk.time.axis.function.refCoord.val = _get_datetime() | ||
Chunk.time.axis.error.rnder = None | ||
Chunk.time.axis.error.syser = None | ||
Chunk.time.exposure = _get_exposure() | ||
Chunk.time.timesys = MJD | ||
Chunk.time.mjdref = None |
Binary file not shown.
62 changes: 62 additions & 0 deletions
62
caom2utils/caom2utils/tests/data/taos_h5file/def/def.module
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
from astropy.time import Time | ||
from datetime import datetime | ||
|
||
|
||
def _get_datetime(base): | ||
b = base.get('base').attrs | ||
result = None | ||
d = b.get('OBS_DATE') | ||
t = b.get('OBS_TIME') | ||
if d is not None and t is not None: | ||
dt = f'{d} {t}' | ||
result = Time(datetime.strptime(dt, '%Y-%m-%d %H:%M:%S.%f')) | ||
result.format = 'mjd' | ||
result = result.value | ||
return result | ||
|
||
|
||
def _get_energy_resolving_power(base): | ||
b = base.get('base').attrs | ||
result = None | ||
# Laurie Rousseau-Nepton - 11-08-22 | ||
# Resolving Power could be given at the central wavelength of the filter. | ||
# The formula is R = 1/lambda[nm]* (2*(STEP[nm]*(NAXIS3-zpd_index))/1.2067 | ||
step = b.get('STEP') | ||
zpd_index = b.get('zpd_index') | ||
naxis_3 = b.get('step_nb') | ||
filter_max = b.get('filter_nm_max') | ||
filter_min = b.get('filter_nm_min') | ||
wl = None | ||
if filter_max is not None and filter_min is not None: | ||
wl = (filter_min + filter_max) / 2 | ||
if ( | ||
step is not None | ||
and zpd_index is not None | ||
and naxis_3 is not None | ||
and wl is not None | ||
): | ||
result = 1 / wl * 2 * (step * (naxis_3 - zpd_index)) / 1.2067 | ||
return result | ||
|
||
|
||
def _get_exposure(base): | ||
b = base.get('base').attrs | ||
# Laurie Rousseau-Nepton - 11-08-22 | ||
# Int. Time could be the total (multiplied by the cube spectral dimension | ||
# f.attrs.get(‘NAXIS3’) | ||
result = None | ||
exposure = b.get('exposure_time') | ||
naxis_3 = b.get('step_nb') | ||
if exposure is not None and naxis_3 is not None: | ||
result = exposure * naxis_3 | ||
return result | ||
|
||
|
||
def _get_fwhm(base): | ||
b = base.get('base').attrs | ||
minimum = b.get('filter_nm_min') | ||
maximum = b.get('filter_nm_max') | ||
result = None | ||
if minimum is not None and maximum is not None: | ||
result = (maximum - minimum) / 2 | ||
return result |
Oops, something went wrong.