Пример #1
0
def get_bias_files(raft_id=None):
    """Get the bias files from the Fe55 acquisition."""
    if raft_id is None:
        raft_id = os.environ['LCATR_UNIT_ID']
    raft = camera_components.Raft.create_from_etrav(raft_id)
    bias_files = dict()

    for slot, sensor_id in raft.items():
        wgSlotName = siteUtils.getWGSlotNames(raft)[sensor_id]
        print('bias_files slot = ', slot)
        bias_files[slot] \
            = siteUtils.dependency_glob('S*/%s_fe55_bias_*.fits' % wgSlotName,
                                        jobname=siteUtils.getProcessName('fe55_raft_acq'),
                                        description='Bias files for noise correlations:')[0]


#            = siteUtils.dependency_glob('S*/%s_fe55_bias_*.fits' % sensor_id,
    return bias_files
import lsst.cr_eotest.sensor as sensorTest
import lcatr.schema
import siteUtils
import eotestUtils
import camera_components

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

results = []
for slot, sensor_id in raft.items():
    print("Processing:", slot, sensor_id)

    if 'ccd2' in slot :
        continue
    wgSlotName = siteUtils.getWGSlotNames(raft)[sensor_id]

    ccd_vendor = sensor_id.split('-')[0].upper()
#    superflats = glob.glob('%(sensor_id)s_superflat_*.fits' % locals())
    superflats = glob.glob('%s_superflat_*.fits' % wgSlotName)
    for item in superflats:
        eotestUtils.addHeaderData(item, FILENAME=item,
                                  DATE=eotestUtils.utc_now_isoformat())
    results.extend([siteUtils.make_fileref(x, folder=slot) for x in superflats])

    results_file = '%s_eotest_results.fits' % wgSlotName
    data = sensorTest.EOTestResults(results_file)
    amps = data['AMP']

    cti_high_serial = data['CTI_HIGH_SERIAL']
    cti_high_serial_error = data['CTI_HIGH_SERIAL_ERROR']
Пример #3
0
def sensor_analyses(run_task_func, raft_id=None, processes=None):
    """
    Run a sensor-level analysis task implemented as a pickleable
    function that takes the desired sensor id as its single argument.

    Parameters
    ----------
    run_task_func : function
        A pickleable function that takes the sensor_id string as
        its argument.
    raft_id : str, optional
        The RTM (or RSA) LSST ID.  If None (default), the LCATR_UNIT_ID
        is used.
    processes : int, optional
        The maximum number of processes to have running at once.
        If None (default), then set to 1 or one less than
        the number of cores, whichever is larger.

    Notes
    -----
    Exceptions from subprocesses will be buffered until all of the
    subprocesses have finished running.  If any exceptions are thrown
    and are uncaught, a non-zero exit code will be generated for the
    overall process. Output to stdout or stderr from the subprocesses
    will be interleaved.

    Users can override the default or keyword argument values by setting
    the LCATR_PARALLEL_PROCESSES environment variable.
    """
    if raft_id is None:
        raft_id = siteUtils.getUnitId()

    if processes is None:
        processes = max(1, multiprocessing.cpu_count() - 1)
    processes = int(os.environ.get('LCATR_PARALLEL_PROCESSES', processes))

    print("raft_id = ", raft_id)

    raft = camera_components.Raft.create_from_etrav(raft_id)

    #    print("sensor_id = ",raft.sensor_id)
    print("sensor_names = ", raft.sensor_names)
    print("slots = ", raft.slot_names)
    wgslot = siteUtils.getWGSlotNames(raft)
    #    for slot,sensor_id in zip(raft.slot_names,raft.sensor_names):
    #        if "ccd1" in slot or "ccd2" in slot :
    #            wgslot[sensor_id] = 'WREB0'
    #        elif "guidesensor1" in slot :
    #            wgslot[sensor_id] = 'GREB0'
    #        elif "guidesensor2" in slot  :
    #            wgslot[sensor_id] = 'GREB1'

    #    for sln = raft.slot_names :
    #        if 'ccd1' in sln:

    print("wgslot = ", wgslot)

    if processes == 1:
        # For cases where only one process will be run at a time, it's
        # faster to run serially instead of using a
        # multiprocessing.Pool since the pickling that occurs can
        # cause significant overhead.
        for sensor_id in raft.sensor_names:
            run_task_func(wgslot[sensor_id])
    else:
        pool = multiprocessing.Pool(processes=processes)
        results = [
            pool.apply_async(run_task_func, (wgslot[sensor_id], ))
            for sensor_id in raft.sensor_names
        ]
        pool.close()
        pool.join()
        for res in results:
            res.get()