Exemplo n.º 1
0
def bias_frame_jh_task(det_name):
    """JH version of the bias_frame_task."""
    import os
    import siteUtils
    import json
    from bot_eo_analyses import glob_pattern, bias_frame_task, \
        bias_stability_task

    run = siteUtils.getRunNumber()
    acq_jobname = siteUtils.getProcessName('BOT_acq')
    bias_files \
        = siteUtils.dependency_glob(glob_pattern('bias_frame', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Bias frames:')
    if not bias_files:
        print("bias_frame_task: Needed data files are missing for detector",
              det_name)
        return None

    bias_stability_files \
        = siteUtils.dependency_glob(glob_pattern('bias_stability', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Bias stability frames:')
    if not bias_stability_files:
        print("bias_stability_task: Needed data files are missing for detector",
              det_name)
        return None

    bias_stability_files = sorted(bias_stability_files)
    bias_stability_task(run, det_name, bias_stability_files)

    return bias_frame_task(run, det_name, bias_files[1:])
def run_ptc_task(sensor_id):
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    flat_files = siteUtils.dependency_glob(
        'S*/%s_flat*flat?_*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('flat_pair_raft_acq'),
        description='Flat files:')
    bias_frame = siteUtils.dependency_glob('%s_sflat*median_bias.fits' %
                                           sensor_id,
                                           description='Super bias frame:')[0]
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    task = sensorTest.PtcTask()
    task.run(sensor_id, flat_files, mask_files, gains, bias_frame=bias_frame)

    results_file = '%s_eotest_results.fits' % sensor_id
    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)
    siteUtils.make_png_file(plots.ptcs,
                            '%s_ptcs.png' % file_prefix,
                            ptc_file='%s_ptc.fits' % sensor_id)
Exemplo n.º 3
0
def run_bf_task(sensor_id):
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    flat_files = siteUtils.dependency_glob(
        'S*/%s_flat*flat1*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('flat_pair_raft_acq'),
        description='Flat files:')
    bias_frame = siteUtils.dependency_glob('%s_sflat*median_bias.fits' %
                                           sensor_id,
                                           description='Superbias files:')[0]
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)

    task = sensorTest.BFTask()
    task.run(sensor_id,
             flat_files,
             mask_files=mask_files,
             bias_frame=bias_frame)

    results_file = '%s_eotest_results.fits' % sensor_id
    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)
    siteUtils.make_png_file(plots.bf_curves,
                            '%s_brighter-fatter.png' % file_prefix,
                            bf_file='%s_bf.fits' % sensor_id)
def persistence_jh_task(det_name):
    """JH version of the persistence_task."""
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern, \
        bias_frame_task, get_mask_files, get_bot_eo_config, persistence_task

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)

    acq_jobname = siteUtils.getProcessName('BOT_acq')
    bias_files \
        = siteUtils.dependency_glob(glob_pattern('persistence_bias', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Persistence bias frames:')
    dark_files \
        = siteUtils.dependency_glob(glob_pattern('persistence_dark', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Persistence dark frames:')
    if not bias_files or not dark_files:
        print("persistence_task: Needed data files are missing for detector",
              det_name)
        return None

    # Sort by test sequence number, i.e., by filenames.
    bias_files = sorted(bias_files)
    dark_files = sorted(dark_files)

    # Make a superbias frame using the pre-exposure persistence bias
    # files, skipping the first exposure.
    superbias_frame = f'{file_prefix}_persistence_superbias.fits'
    bias_frame_task(run, det_name, bias_files, bias_frame=superbias_frame)

    return persistence_task(run, det_name, dark_files, superbias_frame,
                            get_mask_files(det_name))
def run_dark_pixels_task(sensor_id):
    "Single sensor execution of the dark pixels task."
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    acq_jobname = siteUtils.getProcessName('sflat_raft_acq')
    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    sflat_files = siteUtils.dependency_glob('S*/%s_sflat_500_flat_H*.fits' % sensor_id,
                                            jobname=acq_jobname,
                                            description='Superflat files:')

    bias_files = siteUtils.dependency_glob('S*/%s_sflat_bias*.fits' % sensor_id,
                                           jobname=acq_jobname,
                                           description='Bias files:')
    bias_frame = eotestUtils.make_median_bias_frame(bias_files, sensor_id,
                                                    'sflat_raft_acq')
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)

    task = sensorTest.DarkPixelsTask()
    task.run(sensor_id, sflat_files, mask_files, bias_frame=bias_frame)

    siteUtils.make_png_file(sensorTest.plot_flat,
                            '%s_superflat_dark_defects.png' % file_prefix,
                            '%s_median_sflat.fits' % sensor_id,
                            title='%s, superflat for dark defects analysis' % sensor_id,
                            annotation='ADU/pixel', flatten=True, binsize=4)
Exemplo n.º 6
0
def _get_amplifier_gains(file_pattern=None):
    """Extract the gains for each amp in an eotest_results file."""
    if (os.environ.get('LCATR_USE_UNIT_GAINS', 'False') == 'True'
        or file_pattern is None):
        print("_get_amplifier_gains: using unit gains")
        return {amp: 1 for amp in range(1, 17)}

    # Attempt to retrieve gains from fe55_analysis_BOT then ptc_BOT.
    # If neither are available, then use unit gains.
    print("_get_amplifier_gains: trying fe55_analysis_BOT")
    results_files = siteUtils.dependency_glob(file_pattern,
                                              jobname='fe55_analysis_BOT')
    if not results_files:
        print("_get_amplifier_gains: trying ptc_BOT")
        results_files = siteUtils.dependency_glob(file_pattern,
                                                  jobname='ptc_BOT')
    if not results_files:
        print("_get_amplifier_gains: both fe55 and ptc retrievals failed. "
              "using unit gains.")
        return {amp: 1 for amp in range(1, 17)}

    eotest_results_file = results_files[0]
    data = sensorTest.EOTestResults(eotest_results_file)
    amps = data['AMP']
    gains = data['GAIN']
    return dict(zip(amps, gains))
def run_trap_task(sensor_id):
    """Run the traps analysis for a single sensor."""
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    trap_file = siteUtils.dependency_glob(
        'S*/%s_trap_ppump_*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('ppump_raft_acq'),
        description='Trap file:')[0]
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    # Omit rolloff defects mask since a trap in the rolloff edge region can
    # affect the entire column.
    bias_frame = siteUtils.dependency_glob('%s_sflat*median_bias.fits' %
                                           sensor_id,
                                           description='Super bias frame:')[0]
    mask_files = [
        item for item in mask_files if item.find('rolloff_defects') == -1
    ]
    print("Using mask files:")
    for mask_file in mask_files:
        print("  " + mask_file)

    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    task = sensorTest.TrapTask()
    task.run(sensor_id, trap_file, mask_files, gains, bias_frame=bias_frame)
def run_dark_current_task(sensor_id):
    "Single sensor execution of dark current analysis."
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    dark_files = siteUtils.dependency_glob(
        'S*/%s_dark_dark_*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('dark_raft_acq'),
        description='Dark files:')
    bias_frame = siteUtils.dependency_glob('%s_sflat*median_bias.fits' %
                                           sensor_id,
                                           description='Super bias frame:')[0]
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    task = sensorTest.DarkCurrentTask()
    task.config.temp_set_point = -100.
    dark_curr_pixels, dark95s \
        = task.run(sensor_id, dark_files, mask_files, gains,
                   bias_frame=bias_frame)

    results_file \
        = siteUtils.dependency_glob('%s_eotest_results.fits' % sensor_id,
                                    jobname='read_noise_raft')[0]

    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)
    siteUtils.make_png_file(plots.total_noise,
                            '%s_noise.png' % file_prefix,
                            dark95s=dark95s)
Exemplo n.º 9
0
def dark_current_jh_task(det_name):
    """JH version of single sensor execution of the dark current task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, bias_filename, dark_current_task,\
        plot_ccd_total_noise, get_mask_files

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    dark_files \
        = siteUtils.dependency_glob(glob_pattern('dark_current', det_name),
                                    acq_jobname=acq_jobname,
                                    description="Dark current frames:")
    if not dark_files:
        print("dark_current_task: No dark files found for detector", det_name)
        return None

    mask_files = get_mask_files(det_name)
    eotest_results_file \
        = siteUtils.dependency_glob('{}_eotest_results.fits'.format(file_prefix),
                                    jobname='read_noise_BOT')[0]
    gains = get_amplifier_gains('{}_eotest_results.fits'.format(file_prefix))
    bias_frame = bias_filename(run, det_name)

    dark_curr_pixels, dark95s \
        = dark_current_task(run, det_name, dark_files, gains,
                            mask_files=mask_files, bias_frame=bias_frame)
    plot_ccd_total_noise(run, det_name, dark_curr_pixels, dark95s,
                         eotest_results_file)
    return dark_curr_pixels, dark95s
def run_qe_task(sensor_id):

    try:
        if hw_objects[sensor_id] :
            return
    except:
        hw_objects[sensor_id] = True
        print("hw_objects = ",hw_objects)


    "Single sensor execution of the QE task."
    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    lambda_files = siteUtils.dependency_glob('S*/%s_lambda_flat_*.fits' % sensor_id,
                                             jobname=siteUtils.getProcessName('qe_raft_acq'),
                                             description='Lambda files:')

    pd_ratio_file = eotestUtils.getPhotodiodeRatioFile()
    if pd_ratio_file is None:
        message = ("The test-stand specific photodiode ratio file is " +
                   "not given in config/%s/eotest_calibrations.cfg."
                   % siteUtils.getSiteName())
        raise RuntimeError(message)

    correction_image = eotestUtils.getIlluminationNonUniformityImage()
    if correction_image is None:
        print()
        print("WARNING: The correction image file is not given in")
        print("config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName())
        print("No correction for non-uniform illumination will be applied.")
        print()
        sys.stdout.flush()

    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    task = sensorTest.QeTask()
    task.config.temp_set_point = -100.
    task.run(sensor_id, lambda_files, pd_ratio_file, mask_files, gains,
             correction_image=correction_image)

    results_file \
        = siteUtils.dependency_glob('%s_eotest_results.fits' % sensor_id,
                                    jobname='fe55_raft_analysis',
                                    description='Fe55 results file')[0]
    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)

    siteUtils.make_png_file(plots.qe,
                            '%s_qe.png' % file_prefix,
                            qe_file='%s_QE.fits' % sensor_id)

    try:
        plots.flat_fields(os.path.dirname(lambda_files[0]),
                          annotation='e-/pixel, gain-corrected, bias-subtracted')
    except Exception as eobj:
        print("Exception raised while creating flat fields:")
        print(str(eobj))
Exemplo n.º 11
0
def get_mask_files(det_name):
    """
    Get the mask files from previous jobs for the specified sensor.

    Parameters
    ----------
    det_name: str
        The detector name in the focal plane, e.g., 'R22_S11'.

    Returns
    -------
    list of mask file paths.
    """
    badpixel_run = siteUtils.get_analysis_run('badpixel')
    bias_run = siteUtils.get_analysis_run('bias')

    if badpixel_run is not None or bias_run is not None:
        with open('hj_fp_server.pkl', 'rb') as fd:
            hj_fp_server = pickle.load(fd)

    if badpixel_run is not None:
        mask_files = hj_fp_server.get_files('pixel_defects_BOT',
                                            f'{det_name}*mask*.fits',
                                            run=badpixel_run)
        mask_files = siteUtils.get_scratch_files(mask_files)
        print(f"Mask files from run {badpixel_run} and {det_name}:")
        for item in mask_files:
            print(item)
        print()
    else:
        mask_files = siteUtils.dependency_glob(f'*{det_name}*mask*.fits',
                                               jobname='pixel_defects_BOT',
                                               description='pixel defects masks')
    if bias_run is not None:
        rolloff_mask_files = hj_fp_server.get_files('bias_frame_BOT',
                                                    f'{det_name}_*mask*.fits',
                                                    run=bias_run)
        rolloff_mask_files = siteUtils.get_scratch_files(rolloff_mask_files)
        print(f"Edge rolloff mask file from run {bias_run} and {det_name}:")
        for item in rolloff_mask_files:
            print(item)
        print()
    else:
        rolloff_mask_files = siteUtils.dependency_glob(f'*{det_name}*mask*.fits',
                                                       description='rolloff masks',
                                                       jobname='bias_frame_BOT')
    mask_files.extend(rolloff_mask_files)

    return mask_files
def bias_frame_jh_task(det_name):
    """JH version of the bias_frame_task."""
    import os
    import siteUtils
    import json
    from bot_eo_analyses import glob_pattern, bias_frame_task, \
        bias_stability_task, pca_corrected_superbias

    run = siteUtils.getRunNumber()
    acq_jobname = siteUtils.getProcessName('BOT_acq')
    bias_files \
        = siteUtils.dependency_glob(glob_pattern('bias_frame', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Bias frames:')
    # Skip the first 5 bias files to avoid transient features in the
    # imaging array from after just starting the run.
    bias_files = sorted(bias_files, key=os.path.basename)[5:]
    if not bias_files:
        print("bias_frame_task: Needed data files are missing for detector",
              det_name)
        return None

    bias_stability_files \
        = siteUtils.dependency_glob(glob_pattern('bias_stability', det_name),
                                    acq_jobname=acq_jobname,
                                    description='Bias stability frames:')
    if not bias_stability_files:
        print("bias_stability_task: Needed data files are missing for detector",
              det_name)
        return None

    superbias_file, bias_model_components \
        = bias_frame_task(run, det_name, bias_files)
    bias_stability_files = sorted(bias_stability_files)

    if not os.environ.get('LCATR_USE_PCA_BIAS_FIT', "True") == 'True':
        bias_model_components = None
    if siteUtils.get_analysis_run('bias') == 'rowcol':
        bias_model_components = 'rowcol', superbias_file
    print("bias_model_components:", bias_model_components)
    bias_stability_task(run, det_name, bias_stability_files,
                        bias_model_components=bias_model_components)

    if (bias_model_components is not None and
        bias_model_components[0] != 'rowcol'):
        pca_corrected_superbias(run, det_name, bias_files,
                                bias_model_components)

    return superbias_file
Exemplo n.º 13
0
def qe_jh_task(det_name):
    """JH version of single sensor execution of the QE task."""
    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    lambda_files = siteUtils.dependency_glob(glob_pattern('qe', det_name),
                                             acq_jobname=acq_jobname)
    if not lambda_files:
        print("qe_task: QE scan files not found for detector", det_name)
        return None

    pd_ratio_file = eotestUtils.getPhotodiodeRatioFile()
    if pd_ratio_file is None:
        message = ("The BOT photodiode ratio file is " +
                   "not given in config/%s/eotest_calibrations.cfg."
                   % siteUtils.getSiteName())
        raise RuntimeError(message)

#    correction_image = eotestUtils.getIlluminationNonUniformityImage()
#    if correction_image is None:
#        print()
#        print("WARNING: The correction image file is not given in")
#        print("config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName())
#        print("No correction for non-uniform illumination will be applied.")
#        print()
#        sys.stdout.flush()
    mask_files = get_mask_files(det_name)
    eotest_results_file = '{}_eotest_results.fits'.format(file_prefix)
    gains = get_amplifier_gains(eotest_results_file)
    bias_frame = bias_filename(run, det_name)

    return qe_task(run, det_name, lambda_files, pd_ratio_file, gains,
                   mask_files=mask_files, bias_frame=bias_frame,
                   mondiode_func=mondiode_value)
Exemplo n.º 14
0
def read_noise_jh_task(det_name):
    """JH version of the single sensor read noise task."""
    import os
    import glob
    import logging
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, read_noise_task, get_mask_files

    logger = logging.getLogger('read_noise_jh_task')
    logger.setLevel(logging.INFO)

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')
    nbias = os.environ.get('LCATR_NUM_BIAS_FRAMES', 10)

    bias_files \
        = siteUtils.dependency_glob(glob_pattern('read_noise', det_name),
                                    acq_jobname=acq_jobname)[:nbias]
    if not bias_files:
        logger.info(
            "read_noise_task: Needed data files are missing "
            "for detector %s", det_name)
        return None
    eotest_results_file = '{}_eotest_results.fits'.format(file_prefix)
    gains = get_amplifier_gains(eotest_results_file)

    mask_files = get_mask_files(det_name)

    return read_noise_task(run,
                           det_name,
                           bias_files,
                           gains,
                           mask_files=mask_files)
Exemplo n.º 15
0
def flat_gain_stability_jh_task(det_name):
    """JH version of single sensor execution of the flat pairs task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        bias_filename, flat_gain_stability_task,\
        get_mask_files, medianed_dark_frame

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    flat_files = siteUtils.dependency_glob(glob_pattern('tearing', det_name),
                                           acq_jobname=acq_jobname)
    if not flat_files:
        print("flat_gain_stability_task: Flat pairs files not found for",
              det_name)
        return None

    mask_files = get_mask_files(det_name)
    bias_frame = bias_filename(run, det_name)
    dark_frame = medianed_dark_frame(det_name)

    return flat_gain_stability_task(run,
                                    det_name,
                                    flat_files,
                                    mask_files=mask_files,
                                    bias_frame=bias_frame,
                                    dark_frame=dark_frame)
Exemplo n.º 16
0
def bf_jh_task(det_name):
    """JH version of single sensor execution of the brighter-fatter task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        bias_filename, bf_task, find_flat2_bot, get_mask_files,\
        get_amplifier_gains

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    flat_files \
        = siteUtils.dependency_glob(glob_pattern('brighter_fatter', det_name),
                                    acq_jobname=acq_jobname)

    if not flat_files:
        print("bf_jh_task: Flat pairs files not found for detector", det_name)
        return None

    flat_files = [_ for _ in flat_files if 'flat1' in _]

    mask_files = get_mask_files(det_name)
    eotest_results_file = '{}_eotest_results.fits'.format(file_prefix)
    gains = get_amplifier_gains(eotest_results_file)
    bias_frame = bias_filename(run, det_name)

    return bf_task(run,
                   det_name,
                   flat_files,
                   gains,
                   mask_files=mask_files,
                   flat2_finder=find_flat2_bot,
                   bias_frame=bias_frame)
Exemplo n.º 17
0
def ptc_jh_task(det_name):
    """JH version of single sensor execution of the PTC task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, bias_filename, ptc_task, get_mask_files

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    flat_files = siteUtils.dependency_glob(glob_pattern('ptc', det_name),
                                           acq_jobname=acq_jobname)
    if not flat_files:
        print("ptc_task: Flat pairs files not found for detector", det_name)
        return None

    mask_files = get_mask_files(det_name)
    eotest_results_file = '{}_eotest_results.fits'.format(file_prefix)
    gains = get_amplifier_gains(eotest_results_file)
    bias_frame = bias_filename(run, det_name)

    return ptc_task(run,
                    det_name,
                    flat_files,
                    gains,
                    mask_files=mask_files,
                    bias_frame=bias_frame)
Exemplo n.º 18
0
def bright_defects_jh_task(det_name):
    """JH version of single sensor bright pixels task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, bias_filename, bright_defects_task, get_mask_files

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    dark_files \
        = siteUtils.dependency_glob(glob_pattern('bright_defects', det_name),
                                    acq_jobname=acq_jobname)
    if not dark_files:
        print("bright_defects_task: Needed data files missing for detector",
              det_name)
        return None

    eotest_results_file = '{}_eotest_results.fits'.format(file_prefix)
    gains = get_amplifier_gains(eotest_results_file)
    mask_files = sorted(glob.glob(f'{file_prefix}*mask*.fits'))
    bias_frame = bias_filename(run, det_name)

    return bright_defects_task(run,
                               det_name,
                               dark_files,
                               gains,
                               mask_files=mask_files,
                               bias_frame=bias_frame)
Exemplo n.º 19
0
def get_nlc_func(det_name, bot_eo_config_file=None):
    """
    Return the nonlinearity correction function for the specified
    detector.
    """
    file_prefix = make_file_prefix('*', det_name)
    try:
        nlc_file = siteUtils.dependency_glob(f'{file_prefix}_nlc.fits',
                                             jobname='nonlinearity_BOT')[0]
    except (IndexError, TypeError) as eobj:
        print(f'{file_prefix}_nlc.fits not found:', eobj)
        return None

    cp = get_bot_eo_config(bot_eo_config_file)
    if 'NLC_PARAMS' in cp:
        nlc_params = {k: siteUtils.cast(v) for k, v in cp['NLC_PARAMS'].items()}
    else:
        nlc_params = dict()

    try:
        nlc = sensorTest.NonlinearityCorrection.create_from_fits_file(
            nlc_file, **nlc_params)

    except ValueError as eobj:
        print(f'Error creating nlc from {nlc_file}:', eobj)
        nlc = None

    return nlc
def run_dark_pixels_task(sensor_id):
    print("run_dark_pixels_task: sensor_id = ", sensor_id)
    #    raft_id = os.environ['LCATR_UNIT_ID']

    #    raft = camera_components.Raft.create_from_etrav(raft_id)

    #    wgSlotName = siteUtils.getWGSlotNames(raft)[sensor_id];

    "Single sensor execution of the dark pixels task."
    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    sflat_files = siteUtils.dependency_glob(
        'S*/%s_sflat_500_flat_*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('sflat_raft_acq'),
        description='Superflat files:')
    print("sflat query: ", 'S*/%s_sflat_500_flat_H*.fits' % sensor_id)
    print("sflat_files = ", sflat_files)

    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)

    task = sensorTest.DarkPixelsTask()
    task.run(sensor_id, sflat_files, mask_files)

    siteUtils.make_png_file(sensorTest.plot_flat,
                            '%s_superflat_dark_defects.png' % file_prefix,
                            '%s_median_sflat.fits' % sensor_id,
                            title='%s, superflat for dark defects analysis' %
                            sensor_id,
                            annotation='ADU/pixel')
def dark_defects_jh_task(det_name):
    """JH version of single sensor execution of the dark defects task."""
    import glob
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, bias_filename, dark_defects_task, get_mask_files

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    sflat_files \
        = siteUtils.dependency_glob(glob_pattern('dark_defects', det_name),
                                    acq_jobname=acq_jobname)
    if not sflat_files:
        print("dark_defects_task: No high flux superflat files found for",
              det_name)
        return None

    mask_files = sorted(glob.glob(f'{file_prefix}*mask*.fits'))
    bias_frame = bias_filename(run, det_name)

    return dark_defects_task(run,
                             det_name,
                             sflat_files,
                             mask_files=mask_files,
                             bias_frame=bias_frame)
Exemplo n.º 22
0
def run_read_noise_task(sensor_id):
    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    bias_files = siteUtils.dependency_glob(
        'S*/%s_fe55_fe55_*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('fe55_raft_acq'),
        description='Fe55 files for read noise:')
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    system_noise = None

    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)

    task = sensorTest.ReadNoiseTask()
    task.config.temp_set_point = -100.
    task.run(sensor_id,
             bias_files,
             gains,
             system_noise=system_noise,
             mask_files=mask_files,
             use_overscan=True)

    # Compute amp-amp correlated noise.
    _, corr_fig, _ = correlated_noise(bias_files,
                                      target=0,
                                      make_plots=True,
                                      title=sensor_id)
    plt.figure(corr_fig.number)
    plt.savefig('%s_correlated_noise.png' % file_prefix)
def run_flat_pair_task(sensor_id):
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    flat_files = siteUtils.dependency_glob('S*/%s_flat*flat?_*.fits' % sensor_id,
                                           jobname=siteUtils.getProcessName('flat_pair_raft_acq'),
                                           description='Flat files:')
    bias_frame = siteUtils.dependency_glob('%s_sflat*median_bias.fits'
                                           % sensor_id,
                                           description='Super bias frame:')[0]
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    use_exptime = True
    if siteUtils.getSiteName() == 'SLAC':
        # Since slit-width can be set individually for each exposure
        # on TS-8 at IR-2 (LSSTTD-1231), we need to use the MONDIODE
        # keyword for computing the integrated incident flux.
        use_exptime = False

    task = sensorTest.FlatPairTask()
    task.run(sensor_id, flat_files, mask_files, gains,
             linearity_spec_range=(1e4, 9e4), use_exptime=use_exptime,
             bias_frame=bias_frame)

    results_file = '%s_eotest_results.fits' % sensor_id
    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)

    Ne_bounds = (1e4, 9e4)

    detresp_file = '%s_det_response.fits' % sensor_id
    siteUtils.make_png_file(plots.linearity,
                            '%s_linearity.png' % file_prefix,
                            detresp_file=detresp_file, max_dev=0.03,
                            use_exptime=use_exptime, Ne_bounds=Ne_bounds)
    siteUtils.make_png_file(plots.linearity_resids,
                            '%s_linearity_resids.png' % file_prefix,
                            detresp_file=detresp_file, max_dev=0.03,
                            Ne_bounds=Ne_bounds, use_exptime=use_exptime)
def dark_current_jh_task(det_name):
    """JH version of single sensor execution of the dark current task."""
    from collections import defaultdict
    from astropy.io import fits
    import siteUtils
    from bot_eo_analyses import make_file_prefix, glob_pattern,\
        get_amplifier_gains, bias_filename, dark_current_task,\
        plot_ccd_total_noise, get_mask_files
    from bot_data_handling import most_common_dark_files

    run = siteUtils.getRunNumber()
    file_prefix = make_file_prefix(run, det_name)
    acq_jobname = siteUtils.getProcessName('BOT_acq')

    dark_files \
        = siteUtils.dependency_glob(glob_pattern('dark_current', det_name),
                                    acq_jobname=acq_jobname,
                                    description="Dark current frames:")
    if not dark_files:
        print("dark_current_task: No dark files found for detector", det_name)
        return None

    dark_files_linear_fit = list(dark_files)
    dark_files = most_common_dark_files(dark_files)
    if len(dark_files_linear_fit) == len(dark_files):
        # These data only have one integration time, so skip linear
        # fit of dark current signal vs integration time.
        dark_files_linear_fit = None

    mask_files = get_mask_files(det_name)
    eotest_results_file \
        = siteUtils.dependency_glob('{}_eotest_results.fits'.format(file_prefix),
                                    jobname='read_noise_BOT')[0]
    gains = get_amplifier_gains('{}_eotest_results.fits'.format(file_prefix))
    bias_frame = bias_filename(run, det_name)

    dark_curr_pixels, dark95s \
        = dark_current_task(run, det_name, dark_files, gains,
                            mask_files=mask_files, bias_frame=bias_frame,
                            dark_files_linear_fit=dark_files_linear_fit)
    plot_ccd_total_noise(run, det_name, dark_curr_pixels, dark95s,
                         eotest_results_file)
    return dark_curr_pixels, dark95s
def run_tearing_detection(sensor_id):
    """
    Loop over the acquisition jobs and perform tearing analysis on each.
    """
    import pickle
    import lsst.eotest.image_utils as imutils
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    from tearing_detection import tearing_detection

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    tearing_stats = []
    # Create a super bias frame.
    bias_files = siteUtils.dependency_glob(
        'S*/%s_flat_bias*.fits' % sensor_id,
        jobname=siteUtils.getProcessName('flat_pair_raft_acq'),
        description='Bias files:')
    if bias_files:
        bias_frame = '%s_superbias.fits' % sensor_id
        amp_geom = sensorTest.makeAmplifierGeometry(bias_files[0])
        imutils.superbias_file(bias_files[:10], amp_geom.serial_overscan,
                               bias_frame)
    else:
        bias_frame = None

    acq_jobs = {
        ('flat_pair_raft_acq', 'N/A'): 'S*/%s_flat*flat?_*.fits',
        ('qe_raft_acq', 'N/A'): 'S*/%s_lambda_flat_*.fits',
        ('sflat_raft_acq', 'low_flux'): 'S*/%s_sflat_500_flat_L*.fits',
        ('sflat_raft_acq', 'high_flux'): 'S*/%s_sflat_500_flat_H*.fits'
    }
    for job_key, pattern in acq_jobs.items():
        job_name, subset = job_key
        flats = siteUtils.dependency_glob(
            pattern % sensor_id,
            jobname=siteUtils.getProcessName(job_name),
            description='Flat files:')
        tearing_found, _ = tearing_detection(flats, bias_frame=bias_frame)
        tearing_stats.append((job_name, subset, sensor_id, len(tearing_found)))

    with open('%s_tearing_stats.pkl' % file_prefix, 'wb') as output:
        pickle.dump(tearing_stats, output)
Exemplo n.º 26
0
def repackage_summary_files():
    """
    Repackage summary.lims files from prior jobs as eotest results
    files.
    """
    run = siteUtils.getRunNumber()
    summary_files = siteUtils.dependency_glob('summary.lims')
    for det_name in camera_info.get_det_names():
        file_prefix = make_file_prefix(run, det_name)
        raft, slot = det_name.split('_')
        repackager = eotestUtils.JsonRepackager()
        repackager.process_files(summary_files, slot=slot, raft=raft)
        repackager.write('{}_eotest_results.fits'.format(file_prefix))
Exemplo n.º 27
0
def get_scan_mode_files(raft_name):
    """Get the scan mode filenames for a given raft, organized by
    scan mode folder and slot.
    """
    acq_jobname = siteUtils.getProcessName('BOT_acq')
    pattern = glob_pattern('scan_mode', '{}_*'.format(raft_name))
    files = siteUtils.dependency_glob(pattern, acq_jobname=acq_jobname)
    scan_mode_files = defaultdict(dict)
    for item in files:
        scan_dir = os.path.basename(os.path.dirname(item))
        slot = os.path.basename(item).split('.')[0].split('_')[-1]
        scan_mode_files[scan_dir][slot] = item
    return scan_mode_files
Exemplo n.º 28
0
def slot_dependency_glob(pattern, jobname):
    "Return an OrderedDict of files with the desired pattern, keyed by slot."
    files = sorted(
        siteUtils.dependency_glob(os.path.join('S??', pattern),
                                  jobname=jobname))
    files = files + sorted(siteUtils.dependency_glob(pattern, jobname=jobname))

    print("slot_dependency_glob files = ", files, " pattern = ", pattern,
          " jobname = ", jobname, " path = ", os.path.join('S??', pattern))

    slot = {}
    for fn in files:
        if "WREB0" in fn:
            slot[fn] = "ccd1"
        if "GREB0" in fn:
            slot[fn] = "guidesensor1"
        if "GREB1" in fn:
            slot[fn] = "guidesensor2"


#    return OrderedDict([(fn.split('/')[-2], fn) for fn in files])
    return OrderedDict([(slot[fn], fn) for fn in files])
def run_bright_pixels_task(sensor_id):
    "Single sensor execution of the bright pixels task."
    import lsst.eotest.sensor as sensorTest
    import lsst.eotest.image_utils as imutils
    import siteUtils
    import eotestUtils

    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    acq_jobname = siteUtils.getProcessName('dark_raft_acq')
    dark_files = siteUtils.dependency_glob('S*/%s_dark_dark_*.fits' %
                                           sensor_id,
                                           jobname=acq_jobname,
                                           description='Dark files:')
    bias_files = siteUtils.dependency_glob('S*/%s_dark_bias_*.fits' %
                                           sensor_id,
                                           jobname=acq_jobname,
                                           description='Bias files:')
    bias_frame = eotestUtils.make_median_bias_frame(bias_files, sensor_id,
                                                    'dark_raft_acq')

    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    task = sensorTest.BrightPixelsTask()
    task.config.temp_set_point = -100.
    task.run(sensor_id, dark_files, mask_files, gains, bias_frame=bias_frame)

    siteUtils.make_png_file(
        sensorTest.plot_flat,
        '%s_medianed_dark.png' % file_prefix,
        '%s_median_dark_bp.fits' % sensor_id,
        title='%s, medianed dark for bright defects analysis' % sensor_id,
        annotation='e-/pixel, gain-corrected, bias-subtracted',
        bias_frame=bias_frame,
        gains=gains,
        binsize=4)
Exemplo n.º 30
0
def raft_divisidero_tearing(raft_name):
    """JH version of divisidero tearing analysis of BOT data."""
    import os
    from collections import defaultdict
    import json
    import matplotlib.pyplot as plt
    import siteUtils
    from lsst.eotest.sensor.cteTask import superflat
    import lsst.eotest.raft as raftTest
    from bot_eo_analyses import glob_pattern, bias_filename, get_mask_files

    run = siteUtils.getRunNumber()

    pattern = glob_pattern('divisadero_tearing', f'{raft_name}_*')
    acq_jobname = siteUtils.getProcessName('BOT_acq')
    bot_data = siteUtils.dependency_glob(pattern, acq_jobname=acq_jobname)
    if not bot_data:
        return

    sflat_files = defaultdict(list)
    for item in bot_data:
        slot = item.split('.')[0].split('_')[-1]
        sflat_files[slot].append(item)

    median_sflats = dict()
    for slot, files in sflat_files.items():
        det_name = '_'.join((raft_name, slot))
        outfile = f'{det_name}_{run}_median_sflat.fits'
        bias_frame = bias_filename(run, det_name)
        median_sflats[slot] = superflat(files,
                                        outfile=outfile,
                                        bias_frame=bias_frame)

    mask_files = dict()
    for slot in sflat_files:
        det_name = '_'.join((raft_name, slot))
        mask_files[slot] = get_mask_files(det_name)

    title = f'Run {run} {raft_name}'
    acq_run = os.environ.get('LCATR_ACQ_RUN', None)
    if acq_run is not None:
        title += f' (acq {acq_run})'

    max_divisidero_tearing \
        = raftTest.ana_divisidero_tearing(median_sflats, mask_files,
                                          title=title)
    plt.savefig(f'{raft_name}_{run}_divisidero.png')

    with open(f'{raft_name}_{run}_max_divisidero.json', 'w') as fd:
        json.dump(max_divisidero_tearing, fd)
#!/usr/bin/env python
import os
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
dark_files = siteUtils.dependency_glob('*_persistence_dark_*.fits',
                                       jobname=siteUtils.getProcessName('persist_acq'),
                                       description='Dark files:',
                                       sort=True)

flat = siteUtils.dependency_glob('*_persistence_flat_*.fits',
                                 jobname=siteUtils.getProcessName('persist_acq'),
                                 description='Flat file:')[0]

pre_flat_darks = dark_files[:3]
post_flat_darks = dark_files[3:]

mask_files = eotestUtils.glob_mask_files()
gains = eotestUtils.getSensorGains()

task = sensorTest.PersistenceTask()
task.run(sensor_id, pre_flat_darks, flat, post_flat_darks, mask_files, gains)
Exemplo n.º 32
0
#!/usr/bin/env python
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
trap_file = siteUtils.dependency_glob('*_trap_ppump_*.fits',
                                      jobname=siteUtils.getProcessName('ppump_acq'),
                                      description='Trap file:')[0]
mask_files = eotestUtils.glob_mask_files()
# Omit rolloff defects mask since a trap in the rolloff edge region can
# affect the entire column.
mask_files = [item for item in mask_files if item.find('rolloff_defects') == -1]
print("Using mask files:")
for mask_file in mask_files:
    print("  " + mask_file)

gains = eotestUtils.getSensorGains()

task = sensorTest.TrapTask()
task.run(sensor_id, trap_file, mask_files, gains)
Exemplo n.º 33
0
#!/usr/bin/env python
import siteUtils
import metUtils
from flatnessTask import flatnessTask

sensor_id = siteUtils.getUnitId()

# Find the metrology scan data
met_file = siteUtils.dependency_glob('*.dat',jobname=siteUtils.getProcessName('Room_Temp_Measurement_After_Thermal_Cycle'),description='')

met_file = met_file[0]  # siteUtils returns met_file as a list with one member;
                        # here take the first (and only) member

# The dtype below indicates the source of the data, which is always OGP
# for sensors measured at BNL
#flatnessTask(sensor_id, met_file, dtype='OGP', pickle_file='flatness.pickle')
Exemplo n.º 34
0
#!/usr/bin/env python
import siteUtils
import metUtils
from flatnessTask import flatnessTask

sensor_id = siteUtils.getUnitId()

# Find the metrology scan data
met_file = siteUtils.dependency_glob('*.dat',jobname=siteUtils.getProcessName('Pump_and_Room_Temp_Measurement'),description='')

met_file = met_file[0]  # siteUtils returns met_file as a list with one member;
                        # here take the first (and only) member

# The dtype below indicates the source of the data, which is always OGP
# for sensors measured at BNL
#flatnessTask(sensor_id, met_file, dtype='ETU', pickle_file='flatness.pickle')
#!/usr/bin/env python
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
sflat_files = siteUtils.dependency_glob('*_sflat_500_flat_H*.fits',
                                        jobname=siteUtils.getProcessName('sflat_acq'),
                                        description='Superflat files:')
mask_files = eotestUtils.glob_mask_files()

task = sensorTest.DarkPixelsTask()
task.run(sensor_id, sflat_files, mask_files)
#!/usr/bin/env python
import sys
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()
spot_files = siteUtils.dependency_glob('*_spot_*.fits',
                                       jobname=siteUtils.getProcessName('xtalk_acq'),
                                       description='Spot files:')
mask_files = eotestUtils.glob_mask_files()
system_xtalk_file = eotestUtils.getSystemCrosstalkFile()
if system_xtalk_file is None:
    print 
    print "WARNING: The system crosstalk file is not given in"
    print "config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName()
    print "No correction for system crosstalk will be performed."
    print
    sys.stdout.flush()

task = sensorTest.CrosstalkTask()
task.run(sensor_id, spot_files, mask_files, system_xtalk_file=system_xtalk_file)
import os
# This is needed so that pyplot can write to .matplotlib
os.environ['MPLCONFIGDIR'] = os.curdir
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import lsst.eotest.image_utils as imutils
import lsst.eotest.sensor as sensorTest
import siteUtils

siteUtils.aggregate_job_ids()
#sensor_id = []
#sensor_id.append(siteUtils.getUnitId())
sensor_id = siteUtils.getUnitId()
fe55_files = siteUtils.dependency_glob('*_fe55_fe55_*.fits',
                                       jobname=siteUtils.getProcessName('fe55_acq'),
                                       description='Fe55 files:')

#
# Create a mean bias file from the 25 bias files generated by fe55_acq
#
bias_files = siteUtils.dependency_glob('*_fe55_bias_*.fits',
                                       jobname=siteUtils.getProcessName('fe55_acq'),
                                       description='Bias files:')
nf = len(bias_files)
outfile = '%(sensor_id)s_mean_bias_%(nf)i.fits' % locals()
imutils.fits_mean_file(bias_files, outfile)

#
# Create a png zoom of the upper right corner of segment 1 for an Fe55
# exposure for inclusion in the test report
Exemplo n.º 38
0
def glob_mask_files(pattern='*_mask.fits'):
    return siteUtils.dependency_glob(pattern, description='Mask files:')
Exemplo n.º 39
0
#!/usr/bin/env python
import siteUtils
import metUtils
from flatnessTask import flatnessTask

sensor_id = siteUtils.getUnitId()

# Find the metrology scan data
met_file = siteUtils.dependency_glob('*.dat',jobname=siteUtils.getProcessName('Cooling_Measurement-1'),description='')

met_file = met_file[0]  # siteUtils returns met_file as a list with one member;
                        # here take the first (and only) member

# The dtype below indicates the source of the data, which is always OGP
# for sensors measured at BNL
#flatnessTask(sensor_id, met_file, dtype='OGP', pickle_file='flatness.pickle')
#!/usr/bin/env python
import sys
import os
import siteUtils
import metUtils
from flatnessTask import flatnessTask

raft_id = siteUtils.getUnitId()

# Find the TS5 metrology scan data by constructing the name of the data-taking step
acqjobname = siteUtils.getJobName().replace('_Analysis', '')
if ("Room_Temp_Measurement" in acqjobname and not "After" in acqjobname):
    acqjobname = "Pump_and_" + acqjobname

print('flatness_ts5:')
print(acqjobname)
print(siteUtils.getProcessName(acqjobname))
print('----')

# siteUtils returns a list with one member;
# here take the first (and only) member
infile = siteUtils.dependency_glob('*.csv',
                                   jobname=siteUtils.getProcessName(acqjobname),
                                   description='')[0]
print "infile = %s" % infile

flatnessTask(raft_id, infile, dtype='TS5', pickle_file='flatness_ts5.pickle')
#!/usr/bin/env python
import sys
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()

#
# Use Fe55 exposures and the overscan region instead of the bias frames
# as per 2015-09-10 TS1-TS3 sprint decision:
# https://confluence.slac.stanford.edu/display/LSSTCAM/Science+Raft+Teststands
#
bias_files = siteUtils.dependency_glob('*_fe55_fe55_*.fits',
                                       jobname=siteUtils.getProcessName('fe55_acq'),
                                       description='Fe55 files for read noise:')
gains = eotestUtils.getSensorGains()
system_noise = eotestUtils.getSystemNoise(gains)
if system_noise is None:
    print 
    print "WARNING: The system noise file is not given in"
    print "config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName()
    print "The system noise will be set to zero for all amplifiers."
    print
    sys.stdout.flush()

mask_files = eotestUtils.glob_mask_files()

task = sensorTest.ReadNoiseTask()
task.run(sensor_id, bias_files, gains, system_noise=system_noise,
#!/usr/bin/env python
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
dark_files = siteUtils.dependency_glob('*_dark_dark_*.fits',
                                       jobname=siteUtils.getProcessName('dark_acq'),
                                       description='Dark files:')
mask_files = eotestUtils.glob_mask_files()
gains = eotestUtils.getSensorGains()

task = sensorTest.BrightPixelsTask()
task.run(sensor_id, dark_files, mask_files, gains)
#!/usr/bin/env python
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()

# Use Fe55 exposures and the overscan region instead of the bias
# frames since the vendor data are not guaranteed to have the same
# gains for the bias frames.
bias_files = siteUtils.datacatalog_glob('*_fe55_fe55_*.fits',
                                        testtype="FE55",
                                        imgtype="FE55",
                                        description='Bias files (using overscan):')

gains = eotestUtils.getSensorGains(jobname='fe55_offline')
system_noise_files = siteUtils.dependency_glob('noise_*.fits', 
                                               jobname=siteUtils.getProcessName('system_noise'))
if not system_noise_files:
    system_noise_files = None
mask_files = eotestUtils.glob_mask_files()

task = sensorTest.ReadNoiseTask()
task.run(sensor_id, bias_files, gains,
         system_noise_files=system_noise_files, mask_files=mask_files,
         use_overscan=True)
#!/usr/bin/env python
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
flat_files = siteUtils.dependency_glob('*_flat*flat?_*.fits',
                                       jobname=siteUtils.getProcessName('flat_acq'),
                                       description='Flat files:')
mask_files = eotestUtils.glob_mask_files()
gains = eotestUtils.getSensorGains()

task = sensorTest.FlatPairTask()
task.run(sensor_id, flat_files, mask_files, gains, use_exptime=True)
#!/usr/bin/env python
import sys
import os
import siteUtils
import metUtils
from flatnessTask import flatnessTask

#os.system("rsync -r [email protected]:jobHarness/jh_stage/e2v-CCD/An-e2v-CCD/\* /home/LSSTuser/jobHarness/jh_stage/e2v-CCD/")

sensor_id = siteUtils.getUnitId()
ccd_vendor = siteUtils.getCcdVendor()

# Find the OGP metrology scan data
#flat_file = siteUtils.dependency_glob('*/*/*_AbsHeight*.DAT',
direcs = siteUtils.dependency_glob('*',
                                   jobname=siteUtils.getProcessName('OGP_Dimensional_Metrology_Upload'),description='OGP Absolute Height scan:')
print "direcs:"
print direcs
print "------------------------------"

dimdir = ""
for line in direcs :
    if "DimensionalMetrology" in line :
        dimdir = line

print "dimensional metrology directory = %s" % dimdir


flat_file = ""

for root, dirs, flat_files in os.walk(dimdir):
Exemplo n.º 46
0
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()

gains = eotestUtils.getSensorGains(jobname='fe55_analysis')

mask_files = eotestUtils.glob_mask_files()
# Omit rolloff defects mask since it would mask some of the edges used
# in the eper method.
mask_files = [item for item in mask_files if item.find('rolloff_defects') == -1]
print("Using mask files:")
for mask_file in mask_files:
    print("  " + mask_file)

sflat_high_files = siteUtils.dependency_glob('*_sflat_500_flat_H*.fits',
                                             jobname=siteUtils.getProcessName('sflat_acq'),
                                             description='Superflat high flux files:')

task = sensorTest.CteTask()
task.run(sensor_id, sflat_high_files, flux_level='high', gains=gains,
         mask_files=mask_files)

sflat_low_files = siteUtils.dependency_glob('*_sflat_500_flat_L*.fits',
                                            jobname=siteUtils.getProcessName('sflat_acq'),
                                            description='Superflat low flux files:')
task.run(sensor_id, sflat_low_files, flux_level='low', gains=gains,
         mask_files=mask_files)
#!/usr/bin/env python
import os
import pylab
import lsst.eotest.image_utils as imutils
import lsst.eotest.sensor as sensorTest
import siteUtils

raft_id = siteUtils.getUnitId()

ccdnames = {}
ccdmanunames = {}
ccdnames,ccdmanunames = siteUtils.getCCDNames()

for sensor_id in ccdnames :
    fe55gz_files = siteUtils.dependency_glob('*/%s_fe55_fe55_*.fits.gz' % sensor_id slotd,
                                       jobname=siteUtils.getProcessName('fe55_acq'),
                                       description='Fe55 files:')
    for fe55gz_file in fe55gz_files:
        os.system("gunzip -v %s" % fe55gz_file)

    fe55_files = siteUtils.dependency_glob('*/%s_fe55_fe55_*.fits' % sensor_id slotd,
                                       jobname=siteUtils.getProcessName('fe55_acq'),
                                       description='Fe55 files:')
    print "fe55_files ="
    print fe55_files
    print "  =============================="
#
# Create a mean bias file from the 25 bias files generated by fe55_acq
#
    bias_files = siteUtils.dependency_glob('*/%s_fe55_bias_*.fits' % sensor_id,
                                       jobname=siteUtils.getProcessName('fe55_acq'),
#!/usr/bin/env python
import os
import sys
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils

siteUtils.aggregate_job_ids()
sensor_id = siteUtils.getUnitId()
lambda_files = siteUtils.dependency_glob('*_lambda_flat_*.fits',
                                         jobname=siteUtils.getProcessName('qe_acq'),
                                         description='Lambda files:')

pd_ratio_file = eotestUtils.getPhotodiodeRatioFile()
if pd_ratio_file is None:
    message = ("The test-stand specific photodiode ratio file is " +
               "not given in config/%s/eotest_calibrations.cfg."
               % siteUtils.getSiteName())
    raise RuntimeError(message)

correction_image = eotestUtils.getIlluminationNonUniformityImage()
if correction_image is None:
    print
    print "WARNING: The correction image file is not given in"
    print "config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName()
    print "No correction for non-uniform illumination will be applied."
    print
    sys.stdout.flush()

mask_files = eotestUtils.glob_mask_files()
gains = eotestUtils.getSensorGains()
siteUtils.aggregate_job_ids()

ccdnames = {}
ccdmanunames = {}
ccdnames,ccdmanunames = siteUtils.getCCDNames()

for sensor_id in ccdnames :

#
# Use Fe55 exposures and the overscan region instead of the bias frames
# as per 2015-09-10 TS1-TS3 sprint decision:
# https://confluence.slac.stanford.edu/display/LSSTCAM/Science+Raft+Teststands
#
    biasgz_files = siteUtils.dependency_glob('*/%s_fe55_fe55_*.fits.gz' % sensor_id,
                                           jobname=siteUtils.getProcessName('fe55_acq'),
                                           description='Fe55 files for read noise:')
    for biasgz_file in biasgz_files :
        os.system("gunzip -v %s" % biasgz_file)
    bias_files = siteUtils.dependency_glob('*/%s_fe55_fe55_*.fits' % sensor_id,
                                           jobname=siteUtils.getProcessName('fe55_acq'),
                                           description='Fe55 files for read noise:')
    gains = eotestUtils.getSensorGains()
    system_noise = eotestUtils.getSystemNoise(gains)
    if system_noise is None:
        print 
        print "WARNING: The system noise file is not given in"
        print "config/%s/eotest_calibrations.cfg." % siteUtils.getSiteName()
        print "The system noise will be set to zero for all amplifiers."
        print
        sys.stdout.flush()