def test_do_correction_nis_soss_tso(): """If observation is tso, skip correction""" datmod = MultiSlitModel() pathlossmod = PathlossModel() datmod.meta.exposure.type = 'NIS_SOSS' datmod.meta.visit.tsovisit = True result, _ = do_correction(datmod, pathlossmod) assert(result.meta.cal_step.pathloss == 'SKIPPED')
def test_do_correction_msa_slit_size_eq_0(): """If slits have size 0, quit calibration.""" datmod = MultiSlitModel() datmod.slits.append({'data':np.array([])}) pathlossmod = PathlossModel() datmod.meta.exposure.type = 'NRS_MSASPEC' result, _ = do_correction(datmod, pathlossmod) assert(result.meta.cal_step.pathloss == 'COMPLETE')
def test_do_correction_nis_soss_pupil_position_is_none(): """If pupil_position is None, skip correction""" datmod = MultiSlitModel() pathlossmod = PathlossModel() datmod.meta.exposure.type = 'NIS_SOSS' datmod.meta.visit.tsovisit = False datmod.meta.instrument.pupil_position = None result, _ = do_correction(datmod, pathlossmod) assert(result.meta.cal_step.pathloss == 'SKIPPED')
def test_do_correction_fixed_slit_exception(): """If no matching aperture name found, exit.""" datmod = MultiSlitModel() # Give input_model aperture name datmod.slits.append({'data':np.array([]), 'name':'S200A1'}) # Do assign pathloss model aperture with similar name. pathlossmod = PathlossModel() datmod.meta.exposure.type = 'NRS_FIXEDSLIT' result, _ = do_correction(datmod, pathlossmod) assert(result.meta.cal_step.pathloss == 'COMPLETE')
def test_do_correction_nis_soss_aperture_is_none(): """If no matching aperture is found, skip correction.""" datmod = MultiSlitModel() # Is FULL an option for NIRISS? # The test doesn't care but something to remember. datmod.slits.append({'data':np.array([]), 'name':'FULL'}) # Don't assign pathloss model aperture with similar name pathlossmod = PathlossModel() datmod.meta.exposure.type = 'NIS_SOSS' datmod.meta.visit.tsovisit = False datmod.meta.instrument.pupil_position = 1 result, _ = do_correction(datmod, pathlossmod) assert(result.meta.cal_step.pathloss == 'SKIPPED')