def test_augment_polarization(test_file): test_fitsparser = FitsParser(test_file, ObsBlueprint(polarization_axis=1)) artifact = Artifact('ad:{}/{}'.format('TEST', test_file), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) polarization = artifact.parts['0'].chunks[0].polarization check_xml(ObservationWriter()._add_polarization_wcs_element, polarization, EXPECTED_POLARIZATION_XML)
def test_augment_energy(test_file): test_fitsparser = FitsParser(test_file) artifact = Artifact('ad:{}/{}'.format('TEST', test_file), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) energy = artifact.parts['0'].chunks[0].energy energy.bandpassName = '21 cm' # user set attribute check_xml(ObservationWriter()._add_spectral_wcs_element, energy, EXPECTED_ENERGY_XML)
def test_augment_energy(): bp = ObsBlueprint(energy_axis=1) test_fitsparser = FitsParser(sample_file_4axes, bp) artifact = Artifact('ad:{}/{}'.format('TEST', sample_file_4axes), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) energy = artifact.parts['0'].chunks[0].energy ex = _get_from_str_xml(EXPECTED_ENERGY_XML, ObservationReader()._get_spectral_wcs, 'energy') result = get_differences(ex, energy) assert result is None, repr(energy)
def test_augment_polarization(): test_fitsparser = FitsParser(sample_file_4axes, ObsBlueprint(polarization_axis=1)) artifact = Artifact('ad:{}/{}'.format('TEST', sample_file_4axes), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) polarization = artifact.parts['0'].chunks[0].polarization ex = _get_from_str_xml(EXPECTED_POLARIZATION_XML, ObservationReader()._get_polarization_wcs, 'polarization') result = get_differences(ex, polarization) assert result is None, result
def test_augment_artifact_time(test_file, expected): test_fitsparser = FitsParser(test_file, ObsBlueprint(time_axis=1)) artifact = Artifact('ad:{}/{}'.format('TEST', test_file), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) assert artifact.parts is not None assert len(artifact.parts) == 6 test_part = artifact.parts['1'] test_chunk = test_part.chunks.pop() assert test_chunk is not None assert test_chunk.time is not None check_xml(ObservationWriter()._add_temporal_wcs_element, test_chunk.time, expected)
def test_augment_artifact(test_file): test_fitsparser = FitsParser(test_file, ObsBlueprint(position_axis=(1, 2))) artifact = Artifact('ad:{}/{}'.format('TEST', test_file), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) assert artifact.parts is not None assert len(artifact.parts) == 1 test_part = artifact.parts['0'] test_chunk = test_part.chunks.pop() assert test_chunk is not None assert test_chunk.position is not None check_xml(ObservationWriter()._add_spatial_wcs_element, test_chunk.position, EXPECTED_POSITION_XML)
def test_augment_artifact_time(): test_fitsparser = FitsParser(sample_file_time_axes, ObsBlueprint(time_axis=1)) artifact = Artifact('ad:{}/{}'.format('TEST', sample_file_time_axes), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) assert artifact.parts is not None assert len(artifact.parts) == 6 test_part = artifact.parts['1'] test_chunk = test_part.chunks.pop() assert test_chunk is not None assert test_chunk.time is not None ex = _get_from_str_xml(EXPECTED_CFHT_WIRCAM_RAW_GUIDE_CUBE_TIME, ObservationReader()._get_temporal_wcs, 'time') result = get_differences(ex, test_chunk.time) assert result is None
def test_augment_artifact(): test_blueprint = ObsBlueprint(position_axes=(1, 2)) test_fitsparser = FitsParser(sample_file_4axes, test_blueprint) artifact = Artifact('ad:{}/{}'.format('TEST', sample_file_4axes), ProductType.SCIENCE, ReleaseType.DATA) test_fitsparser.augment_artifact(artifact) assert artifact.parts is not None assert len(artifact.parts) == 1 test_part = artifact.parts['0'] test_chunk = test_part.chunks.pop() assert test_chunk is not None assert test_chunk.position is not None ex = _get_from_str_xml(EXPECTED_POSITION_XML, ObservationReader()._get_spatial_wcs, 'position') result = get_differences(ex, test_chunk.position) assert result is None