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)
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'] cti_high_parallel = data['CTI_HIGH_PARALLEL'] cti_high_parallel_error = data['CTI_HIGH_PARALLEL_ERROR'] cti_low_serial = data['CTI_LOW_SERIAL'] cti_low_serial_error = data['CTI_LOW_SERIAL_ERROR'] cti_low_parallel = data['CTI_LOW_PARALLEL'] cti_low_parallel_error = data['CTI_LOW_PARALLEL_ERROR'] for values in zip(amps, cti_high_serial, cti_high_serial_error, cti_high_parallel, cti_high_parallel_error,
repackager.eotest_results['READ_NOISE']) print("total_noise = ", total_noise) for i, amp in enumerate(repackager.eotest_results['AMP']): repackager.eotest_results.add_seg_result(amp, 'DC95_SHOT_NOISE', np.float(shot_noise[i])) repackager.eotest_results['TOTAL_NOISE'][i] = total_noise[i] outfile = '%s_eotest_results.fits' % wgSlotName repackager.write(outfile) results_files[slot] = outfile gains = dict() for slot, res_file in results_files.items(): results = sensorTest.EOTestResults(res_file) print("slot = ", slot, " res_file = ", res_file, " results = ", results) gains[slot] = dict([(amp, gain) for amp, gain in zip(results['AMP'], results['GAIN'])]) print("gains = ", gains) title = '%s, %s' % (raft_id, run_number) file_prefix = '%s_%s' % (raft_id, run_number) # Raft-level mosaics of median darks, bias, superflats high and low. dark_mosaic = raftTest.RaftMosaic(slot_dependency_glob('*median_dark_bp.fits', 'bright_defects_raft'), gains=gains) dark_mosaic.plot(title='%s, medianed dark frames' % title, annotation='e-/pixel, gain-corrected, bias-subtracted') plt.savefig('%s_medianed_dark.png' % file_prefix)
import camera_components raft_id = siteUtils.getUnitId() raft = camera_components.Raft.create_from_etrav(raft_id) results = [] for slot, sensor_id in raft.items(): if 'ccd2' in slot: continue ccd_vendor = sensor_id.split('-')[0].upper() wgSlotName = siteUtils.getWGSlotNames(raft)[sensor_id]; # read_noise_file = '%s_eotest_results.fits' % sensor_id read_noise_file = '%s_eotest_results.fits' % wgSlotName data = sensorTest.EOTestResults(read_noise_file) amps = data['AMP'] read_noise_data = data['READ_NOISE'] system_noise_data = data['SYSTEM_NOISE'] total_noise_data = data['TOTAL_NOISE'] for amp, read_noise, system_noise, total_noise in zip(amps, read_noise_data, system_noise_data, total_noise_data): results.append(lcatr.schema.valid(lcatr.schema.get('read_noise_raft'), amp=amp, read_noise=read_noise, system_noise=system_noise, total_noise=total_noise, slot=slot, sensor_id=wgSlotName)) # sensor_id=sensor_id))
ccd_vendor = sensor_id.split('-')[0].upper() mask_file = '%s_dark_pixel_mask.fits' % wgSlotName eotestUtils.addHeaderData(mask_file, LSST_NUM=sensor_id, TESTTYPE='SFLAT_500', DATE=eotestUtils.utc_now_isoformat(), CCD_MANU=ccd_vendor) results.append(siteUtils.make_fileref(mask_file)) superflat = '%s_median_sflat.fits' % wgSlotName eotestUtils.addHeaderData(superflat, DATE=eotestUtils.utc_now_isoformat()) results.append(siteUtils.make_fileref(superflat)) eotest_results = '%s_eotest_results.fits' % wgSlotName data = sensorTest.EOTestResults(eotest_results) amps = data['AMP'] npixels = data['NUM_DARK_PIXELS'] ncolumns = data['NUM_DARK_COLUMNS'] for amp, npix, ncol in zip(amps, npixels, ncolumns): results.append( lcatr.schema.valid(lcatr.schema.get('dark_defects_raft'), amp=amp, dark_pixels=npix, dark_columns=ncol, slot=slot, sensor_id=wgSlotName)) # sensor_id=sensor_id)) # Persist the png files. metadata = dict(CCD_MANU=ccd_vendor, LSST_NUM=sensor_id,
# bias_mean_file = glob.glob('%(sensor_id)s_mean_bias_*.fits' % locals())[0] bias_mean_file = glob.glob('%s_mean_bias_*.fits' % wgSlotName)[0] results.append(siteUtils.make_fileref(bias_mean_file, folder=slot)) # Persist the png files. metadata = dict(CCD_MANU=ccd_vendor, LSST_NUM=sensor_id, TESTTYPE='FE55', TEST_CATEGORY='EO') results.extend( siteUtils.persist_png_files('%s*.png' % wgSlotName, sensor_id, folder=slot, metadata=metadata)) 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): if not np.isfinite(gain_error): gain_error = -1 results.append( lcatr.schema.valid(lcatr.schema.get('fe55_raft_analysis'), amp=amp, gain=gain_value, gain_error=gain_error, psf_sigma=sigma, slot=slot,