示例#1
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_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)
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_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 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)
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)
示例#7
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 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))
示例#9
0
def run_flat_pair_task(sensor_id):

    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:')
    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)

    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 run_trap_task(sensor_id):
    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.
    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)
示例#11
0
def run_bright_pixels_task(sensor_id):
    "Single sensor execution of the bright pixels task."
    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:')
    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)

    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')
示例#12
0
def run_dark_current_task(sensor_id):
    "Single sensor execution of dark current analysis."
    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:')
    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)

    results_file \
        = siteUtils.dependency_glob('%s_eotest_results.fits' % sensor_id,
                                    jobname='read_noise_raft')[0]
    eo_results = sensorTest.EOTestResults(results_file)
    read_noise = dict(
        pair for pair in zip(eo_results['AMP'], eo_results['TOTAL_NOISE']))

    siteUtils.make_png_file(sensorTest.total_noise_histograms,
                            '%s_total_noise_hists.png' % file_prefix,
                            dark_curr_pixels,
                            read_noise,
                            dark95s,
                            exptime=16,
                            title=sensor_id)

    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)
    siteUtils.make_png_file(plots.total_noise,
                            '%s_noise.png' % file_prefix,
                            dark95s=dark95s)
#!/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

sensor_id = siteUtils.getUnitId()
lambda_files = siteUtils.datacatalog_glob('*_lambda_flat_*.fits',
                                          testtype='LAMBDA',
                                          imgtype='FLAT',
                                          description='Lambda files:')
mask_files = eotestUtils.glob_mask_files()
gains = eotestUtils.getSensorGains(jobname='fe55_offline')
# @todo Set correction image when it becomes available.
correction_image = None

task = sensorTest.PrnuTask()
task.run(sensor_id, lambda_files, mask_files, gains, correction_image)
from __future__ import print_function
import sys
import lsst.eotest.sensor as sensorTest
import siteUtils
import eotestUtils
import camera_components

raft_id = siteUtils.getUnitId()
raft = camera_components.Raft.create_from_etrav(raft_id)

for sensor_id in raft.sensor_names:
    lambda_files = siteUtils.dependency_glob('S*/%s_lambda_flat_*.fits' % sensor_id,
                                             jobname=siteUtils.getProcessName('qe_raft_acq'),
                                             description='Lambda files:')
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)

    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()

    task = sensorTest.PrnuTask()
    task.run(sensor_id, lambda_files, mask_files, gains, correction_image)
示例#16
0
def run_cte_task(sensor_id):
    "Single sensor execution of the cte task."
    file_prefix = '%s_%s' % (sensor_id, siteUtils.getRunNumber())
    mask_files = \
        eotestUtils.glob_mask_files(pattern='%s_*mask.fits' % sensor_id)
    gains = eotestUtils.getSensorGains(jobname='fe55_raft_analysis',
                                       sensor_id=sensor_id)
    # 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)

    results_file \
        = siteUtils.dependency_glob('%s_eotest_results.fits' % sensor_id,
                                    jobname='fe55_raft_analysis',
                                    description='Fe55 results file')[0]
    shutil.copy(results_file, os.path.basename(results_file))
    results_file = os.path.basename(results_file)
    sflat_high_files = \
        siteUtils.dependency_glob('S*/%s_sflat_500_flat_H*.fits' % sensor_id,
                                  jobname=siteUtils.getProcessName('sflat_raft_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('S*/%s_sflat_500_flat_L*.fits' % sensor_id,
                                  jobname=siteUtils.getProcessName('sflat_raft_acq'),
                                  description='Superflat low flux files:')
    task.run(sensor_id,
             sflat_low_files,
             flux_level='low',
             gains=gains,
             mask_files=mask_files)

    plots = sensorTest.EOTestPlots(sensor_id, results_file=results_file)

    superflat_files = sorted(glob.glob('%s_superflat_*.fits' % sensor_id))
    mask_files = [
        x for x in glob.glob('%s*mask.fits' % sensor_id)
        if x.find('rolloff') == -1
    ]
    for sflat_file in superflat_files:
        flux_level = 'low'
        if sflat_file.find('high') != -1:
            flux_level = 'high'
        siteUtils.make_png_file(
            sensorTest.plot_flat,
            sflat_file.replace('.fits',
                               '.png').replace(sensor_id, file_prefix),
            sflat_file,
            title=('%s, CTE supeflat, %s flux ' % (sensor_id, flux_level)),
            annotation='ADU/pixel')
        siteUtils.make_png_file(plots.cte_profiles,
                                ('%s_serial_oscan_%s.png' %
                                 (file_prefix, flux_level)),
                                flux_level,
                                sflat_file,
                                mask_files,
                                serial=True)

        siteUtils.make_png_file(plots.cte_profiles,
                                ('%s_parallel_oscan_%s.png' %
                                 (file_prefix, flux_level)),
                                flux_level,
                                sflat_file,
                                mask_files,
                                serial=False)