Exemplo n.º 1
0
def ccsValidator(jobName, acqfilelist='acqfilelist', statusFlags=('aero_version')):
#    try:
#        hdrtools.updateFitsHeaders(acqfilelist)
#    except IOError:
#        pass


    results = []

    statusAssignments = {}
    try:
        statusFile = open("status.out")
        for flag in statusFlags:
            if (flag=='stat') :
                value = int(statusFile.readline().strip())
                statusAssignments[flag] = value
            else :
                strval = statusFile.readline().strip()
                statusAssignments[flag] = strval
    except IOError:
        for flag in statusFlags:
            statusAssignments[flag] = -1
    

    print "jobName = %s" % jobName
    print "schema = %s" % str(lcatr.schema.get(jobName))

    results.append(lcatr.schema.valid(lcatr.schema.get(jobName), 
                                      **statusAssignments))

    results.append(siteUtils.packageVersions())

    # @todo Fix this. Copying these files should not be necessary.
#    jobdir = siteUtils.getJobDir()
#    os.system("cp -vp %s/*.fits ." % jobdir)   

    # @todo Sort out which files really need to be curated.
    files = glob.glob('*.fits')
    files = files+glob.glob('*log*')
    files = files+glob.glob('*summary*')
    files = files+glob.glob('*.png')
    files = files+glob.glob('*.dat')
    print "The files that will be registered in lims from %s are:" % os.getcwd()
    for line in files :
        print "%s" % line
    data_products = [lcatr.schema.fileref.make(item) for item in files]
    results.extend(data_products)

    lcatr.schema.write_file(results)
    lcatr.schema.validate_file()
# now lets crash if that status file wasn't present
# we do this so that the traveler will know that something bad happened
    statusFileCheck = open("status.out")
#!/usr/bin/env python
import glob
import lsst.eotest.sensor as sensorTest
import lcatr.schema
import siteUtils

sensor_id = siteUtils.getUnitId()

results_file = '%s_eotest_results.fits' % sensor_id
data = sensorTest.EOTestResults(results_file)

results = []
amps = data['AMP']
dc95s = data['DARK_CURRENT_95']
for amp, dc95 in zip(amps, dc95s):
    results.append(lcatr.schema.valid(lcatr.schema.get('dark_current'),
                                      amp=amp, dark_current_95CL=dc95))

results.append(siteUtils.packageVersions())

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
Exemplo n.º 3
0
# Add/update the metadata to the primary HDU of these files.
for fitsfile in output_files:
    eotestUtils.addHeaderData(fitsfile,
                              LSST_NUM=sensor_id,
                              TESTTYPE='FE55',
                              DATE=eotestUtils.utc_now_isoformat(),
                              CCD_MANU=siteUtils.getCcdVendor().upper())

results = []

data = sensorTest.EOTestResults(gain_file)
amps = data['AMP']
gain_data = data['GAIN']
gain_errors = data['GAIN_ERROR']
sigmas = data['PSF_SIGMA']
for amp, gain_value, gain_error, sigma in zip(amps, gain_data, gain_errors,
                                              sigmas):
    results.append(
        lcatr.schema.valid(lcatr.schema.get('fe55_analysis'),
                           amp=amp,
                           gain=gain_value,
                           gain_error=gain_error,
                           psf_sigma=sigma))

results.append(siteUtils.packageVersions())

results.extend([lcatr.schema.fileref.make(x) for x in output_files])

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
Exemplo n.º 4
0
#!/usr/bin/env python
import lcatr.schema
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()
ptc_results = '%s_ptc.fits' % sensor_id
eotestUtils.addHeaderData(ptc_results,
                          LSST_NUM=sensor_id,
                          TESTTYPE='FLAT',
                          DATE=eotestUtils.utc_now_isoformat(),
                          CCD_MANU=siteUtils.getCcdVendor().upper())

results = [lcatr.schema.fileref.make(ptc_results), siteUtils.packageVersions()]

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
Exemplo n.º 5
0
if expected_path not in schema_path.split(os.path.pathsep):
    raise ValueError('Incorrect LCATR_SCHEMA_PATH: ' + schema_path)
#
# Check for expected modules.
#
import pylab

import lcatr.schema
import lcatr.schema.version
import lcatr.harness.helpers
import lcatr.harness.version

import lsst.afw
import lsst.ip.isr

import lsst.eotest

import DataCatalog
import PythonBinding
import ccsTools
import eolib
import eotestUtils
import harnessedJobs
import hdrtools
import siteUtils

results = [siteUtils.packageVersions()]

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
#!/usr/bin/env python
import lcatr.schema
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()
ptc_results = '%s_ptc.fits' % sensor_id
eotestUtils.addHeaderData(ptc_results, LSST_NUM=sensor_id, TESTTYPE='FLAT',
                          DATE=eotestUtils.utc_now_isoformat(),
                          CCD_MANU=siteUtils.getCcdVendor().upper())

results = [lcatr.schema.fileref.make(ptc_results),
           siteUtils.packageVersions()]

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
#!/usr/bin/env python
import numpy as np
import pyfits
import lcatr.schema
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()

results_file = '%s_eotest_results.fits' % sensor_id
prnu_results = pyfits.open(results_file)['PRNU_RESULTS'].data

results = []
for wl, stdev, mean in zip(prnu_results['WAVELENGTH'],
                           prnu_results['STDEV'], prnu_results['MEAN']):
    results.append(lcatr.schema.valid(lcatr.schema.get('prnu'),
                                      wavelength=int(np.round(wl)),
                                      pixel_stdev=stdev, pixel_mean=mean))
results.extend(siteUtils.packageVersions())
results.extend(siteUtils.jobInfo())
results.append(eotestUtils.eotestCalibrations())

qe_acq_job_id = siteUtils.get_prerequisite_job_id('*_lambda_flat_*.fits',
                                                  jobname=siteUtils.getProcessName('qe_acq'))
md = dict(illumination_non_uniformity_file=dict(JOB_ID=qe_acq_job_id))
results.extend(eotestUtils.eotestCalibsPersist('illumination_non_uniformity_file',
                                               metadata=md))

lcatr.schema.write_file(results)
lcatr.schema.validate_file()
Exemplo n.º 8
0
import lcatr.schema
import siteUtils
import eotestUtils

sensor_id = siteUtils.getUnitId()

results_file = '%s_eotest_results.fits' % sensor_id
prnu_results = pyfits.open(results_file)['PRNU_RESULTS'].data

results = []
for wl, stdev, mean in zip(prnu_results['WAVELENGTH'], prnu_results['STDEV'],
                           prnu_results['MEAN']):
    results.append(
        lcatr.schema.valid(lcatr.schema.get('prnu'),
                           wavelength=int(np.round(wl)),
                           pixel_stdev=stdev,
                           pixel_mean=mean))
results.extend(siteUtils.packageVersions())
results.extend(siteUtils.jobInfo())
results.append(eotestUtils.eotestCalibrations())

qe_acq_job_id = siteUtils.get_prerequisite_job_id(
    '*_lambda_flat_*.fits', jobname=siteUtils.getProcessName('qe_acq'))
md = dict(illumination_non_uniformity_file=dict(JOB_ID=qe_acq_job_id))
results.extend(
    eotestUtils.eotestCalibsPersist('illumination_non_uniformity_file',
                                    metadata=md))

lcatr.schema.write_file(results)
lcatr.schema.validate_file()