Exemple #1
0
def image_can_be_processed(header, db_address):
    if header is None:
        logger.warning('Header being checked to process image is None')
        return False
    # Short circuit if the instrument is a guider even if they don't exist in configdb
    if not get_obstype(header) in settings.LAST_STAGE:
        logger.warning('Image has an obstype that is not supported by banzai.')
        return False
    try:
        instrument = dbs.get_instrument(header, db_address=db_address)
    except ValueError:
        return False
    passes = instrument_passes_criteria(instrument, settings.FRAME_SELECTION_CRITERIA)
    if not passes:
        logger.debug('Image does not pass reduction criteria')
    passes &= get_reduction_level(header) == '00'
    if get_reduction_level(header) != '00':
        logger.debug('Image has nonzero reduction level')
    return passes
Exemple #2
0
def image_can_be_processed(header, context):
    if header is None:
        logger.warning('Header being checked to process image is None')
        return False
    # Short circuit if the instrument is a guider even if they don't exist in configdb
    if not get_obstype(header) in context.LAST_STAGE:
        logger.warning('Image has an obstype that is not supported by banzai.')
        return False
    try:
        instrument = dbs.get_instrument(header, db_address=context.db_address)
    except ValueError:
        return False
    passes = instrument_passes_criteria(instrument,
                                        context.FRAME_SELECTION_CRITERIA)
    if not passes:
        logger.debug('Image does not pass reduction criteria')
    passes &= get_reduction_level(header) == '00'
    if get_reduction_level(header) != '00':
        logger.debug('Image has nonzero reduction level')
    return passes
Exemple #3
0
def test_image_passes_multiple_criteria_should_pass_with_exclude():
    criteria = [InstrumentCriterion('schedulable', operator.eq, True),
                InstrumentCriterion('type', operator.contains, 'NRES', exclude=True)]
    assert instrument_passes_criteria(FakeInstrument(schedulable=True, type='SciCam'), criteria)
Exemple #4
0
def test_image_passes_multiple_criteria_should_pass_with_exclude():
    criteria = [('schedulable', 'eq', True), ('type', 'not contains', 'NRES')]
    assert instrument_passes_criteria(
        FakeInstrument(schedulable=True, type='SciCam'), criteria)