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_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)
Ejemplo n.º 4
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)
Ejemplo n.º 5
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')
Ejemplo n.º 6
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)
                          DATE=eotestUtils.utc_now_isoformat(),
                          CCD_MANU=siteUtils.getCcdVendor().upper())

results = [lcatr.schema.fileref.make(persistence_file)]

# Save the deferred charge for each amplifier from the first post-flat
# dark frame as the image persistence metric.
#
# Read the results from the FITS file.
persistence = pyfits.open(persistence_file)
times = persistence[1].data.field('TIME')

# Times of dark frames are relative to the MJD-OBS of the flat.
post_flat_times = times[np.where(times > 0)]
index = np.where(times == min(post_flat_times))[0][0]

# Loop over amplifiers and record the deferred charge (median pixel
# value and stdev) in the first post-flat dark frame.
gains = eotestUtils.getSensorGains()
for amp in gains:
    median_flux = persistence[1].data.field('MEDIAN%02i' % amp)[index]
    stdev = persistence[1].data.field('STDEV%02i' % amp)[index]
    results.append(lcatr.schema.valid(lcatr.schema.get('persistence'), amp=amp,
                                      deferred_charge_median=median_flux,
                                      deferred_charge_stdev=stdev))

results.extend(siteUtils.jobInfo())

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
#!/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)
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)
Ejemplo n.º 10
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)
Ejemplo n.º 11
0
#!/usr/bin/env python
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)
Ejemplo n.º 12
0
#!/usr/bin/env python
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)