def qe_task(run, det_name, lambda_files, pd_ratio_file, gains,
            mask_files=(), correction_image=None, temp_set_point=-100,
            bias_frame=None, mondiode_func=None):
    """Single sensor execution of the QE task."""
    file_prefix = make_file_prefix(run, det_name)

    task = sensorTest.QeTask()
    task.config.temp_set_point = temp_set_point
    task.run(file_prefix, lambda_files, pd_ratio_file, mask_files, gains,
             correction_image=correction_image, bias_frame=bias_frame,
             mondiode_func=mondiode_func)

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

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

    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))
Example #2
0
    '-M',
    '--medians_file',
    type=str,
    help='file of median pixel values from wavelength scan dataset',
    default=None)
parser.add_argument('-c',
                    '--correction_image',
                    type=str,
                    help='correction image for illumination non-uniformity',
                    default=None)
parser.add_argument('--vendor_data',
                    default=False,
                    action='store_true',
                    help='Have data from vendor')
args = parser.parse_args()

task = sensorTest.QeTask()
task.config.output_dir = args.output_dir
task.config.verbose = args.verbose

qe_files = args.files(args.qe_files, args.qe_file_list)

task.run(args.sensor_id,
         qe_files,
         args.pd_ratio_file,
         args.mask_files(qe_files[0]),
         args.system_gains(),
         medians_file=args.medians_file,
         vendor_data=args.vendor_data,
         correction_image=args.correction_image)
Example #3
0
def run_qe_task(sensor_id):
    "Single sensor execution of the QE task."
    import os
    import sys
    import lsst.eotest.sensor as sensorTest
    import siteUtils
    import eotestUtils

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

    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.QeTask()
    task.config.temp_set_point = -100.
    task.run(sensor_id,
             lambda_files,
             pd_ratio_file,
             mask_files,
             gains,
             correction_image=correction_image,
             bias_frame=bias_frame)

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