本文整理汇总了Python中siteUtils.getUnitId函数的典型用法代码示例。如果您正苦于以下问题:Python getUnitId函数的具体用法?Python getUnitId怎么用?Python getUnitId使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getUnitId函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: getSensorGains
def getSensorGains(jobname='fe55_analysis', sensor_id=None):
if sensor_id is None:
sensor_id = siteUtils.getUnitId()
try:
gain_file = dependency_glob('%s_eotest_results.fits' % sensor_id,
jobname=jobname)[0]
except IndexError:
raise RuntimeError('eotestUtils.getSensorGains: %s %s'
% (sensor_id, jobname))
data = sensorTest.EOTestResults(gain_file)
amps = data['AMP']
gains = data['GAIN']
sensorGains = dict([(amp, gains[amp-1]) for amp in amps])
return sensorGains
示例2: __init__
def __init__(self, configFile):
"""
configFile contains the names of the site-specific
configuration files. File basenames are provided in
configFile, and the full paths are constructed in the
_read(...) method.
"""
super(CcsSetup, self).__init__()
if os.environ.has_key('CCS_TS'):
self['ts']=_quote(os.getenv('CCS_TS'))
else:
self['ts'] = _quote('ts')
self['tsCWD'] = _quote(os.getcwd())
self['labname'] = _quote(siteUtils.getSiteName())
self['CCDID'] = _quote(siteUtils.getUnitId())
# self._read(os.path.join(siteUtils.getJobDir(), configFile))
CCDTYPE = _quote(siteUtils.getUnitType())
示例3: aggregate_filerefs
def aggregate_filerefs(producer, testtype, origin=None, dp_mapping=None):
"""
Aggregate the filerefs for the metrology data products and return
them as a python list.
"""
if origin is None:
origin = siteUtils.getSiteName()
if dp_mapping is None:
dp_mapping = dict(BOXPLOT='boxplot',
HISTOGRAM='hist',
POINT_CLOUD_10='point_cloud_azim_10',
POINT_CLOUD_45='point_cloud_azim_45',
RESIDUALS='residuals',
QUANTILE_TABLE='quantile_table')
# Common metadata fields for all data products.
ccd_vendor = siteUtils.getCcdVendor()
sensor_id = siteUtils.getUnitId()
md = siteUtils.DataCatalogMetadata(CCD_MANU=ccd_vendor,
LSST_NUM=sensor_id,
PRODUCER=producer,
ORIGIN=origin,
TESTTYPE=testtype,
TEST_CATEGORY='MET')
# Create filerefs for each data product, adding the file-specific
# data product metadata.
tt_ext = testtype.lower()
results = []
for dp, ext in dp_mapping.items():
pattern = '%(sensor_id)s_%(tt_ext)s_*%(ext)s.*'% locals()
dp_files = glob.glob(pattern)
results.extend([lcatr.schema.fileref.make(dp_file,
metadata=md(DATA_PRODUCT=dp))
for dp_file in dp_files])
return results
示例4: locals
#!/usr/bin/env python
import glob
import pyfits
import numpy as np
import lsst.eotest.sensor as sensorTest
import lcatr.schema
import siteUtils
import eotestUtils
sensor_id = siteUtils.getUnitId()
# Save the output file from producer script.
persistence_file = '%(sensor_id)s_persistence.fits' % locals()
eotestUtils.addHeaderData(persistence_file, LSST_NUM=sensor_id,
TESTTYPE='PERSISTENCE',
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]
示例5: Exception
#!/usr/bin/env python
import os, sys, glob
import siteUtils
print "executing producer_test_job.py"
IRODS = False
uid = siteUtils.getUnitId()
print "Running ASPIC PRODUCER on ", uid
uid = uid.split("LCA-11721-ASPIC-")[1]
uid = uid.replace("P", "0")
if not IRODS:
basedir = "/sps/lsst/DataBE/ASPIC_production"
logdir = os.path.join(basedir, "Logs")
chipdir = os.path.join(basedir, "CHIP%s" % uid)
try:
input_file = os.environ["ASPIC_LOGFILE"]
except KeyError:
try:
input_file = glob.glob(os.path.join(logdir, "log-%s-*.txt" % uid))[0]
except:
raise Exception("Input file %s not found in %s" % ("log-%s-*.txt" % uid, logdir))
os.system("cp %s ." % input_file)
os.system("ln -s %s ." % chipdir)
else:
basedir = "/lsst-fr/home/lsstcamera/ASPIC_production"
logdir = os.path.join(basedir, "Logs")
chipdir = os.path.join(basedir, "CHIP%s" % uid)
input_file = os.environ["ASPIC_LOGFILE"]
示例6: __init__
def __init__(self, configFile):
"""
configFile contains the names of the site-specific
configuration files. File basenames are provided in
configFile, and the full paths are constructed in the
_read(...) method.
"""
super(CcsSetup, self).__init__()
if os.environ.has_key('CCS_TS8'):
self['ts8']=_quote(os.getenv('CCS_TS8'))
else:
self['ts8'] = _quote('ts8')
if os.environ.has_key('CCS_JYTH'):
self['jyth']=_quote(os.getenv('CCS_JYTH'))
else:
self['jyth'] = _quote('JythonInterpreterConsole')
if os.environ.has_key('CCS_JSON_PORT'):
self['jsonport']=os.getenv('CCS_JSON_PORT')
else:
self['jsonport'] = 4444
if os.environ.has_key('CCS_PS'):
self['ps']=_quote(os.getenv('CCS_PS'))
else:
self['ps'] = _quote('ccs-rebps')
if os.environ.has_key('CCS_TS'):
self['ts']=_quote(os.getenv('CCS_TS'))
else:
self['ts'] = _quote('ts')
if os.environ.has_key('CCS_ARCHON'):
self['archon']=_quote(os.getenv('CCS_ARCHON'))
else:
self['archon'] = _quote('archon')
if os.environ.has_key('CCS_VAC_OUTLET'):
self['vac_outlet']=os.getenv('CCS_VAC_OUTLET')
# there is no default for vac_outlet - if there is a script that needs
# it and it has not been defined then I want it to crash
if os.environ.has_key('CCS_CRYO_OUTLET'):
self['cryo_outlet']=os.getenv('CCS_CRYO_OUTLET')
# there is no default for cryo_outlet - if there is a script that needs
# it and it has not been defined then I want it to crash
if os.environ.has_key('CCS_PUMP_OUTLET'):
self['pump_outlet']=os.getenv('CCS_PUMP_OUTLET')
# there is no default for pump_outlet - if there is a script that needs
# it and it has not been defined then I want it to crash
self['tsCWD'] = _quote(os.getcwd())
self['labname'] = _quote(siteUtils.getSiteName())
self['jobname'] = _quote(siteUtils.getJobName())
self['CCDID'] = _quote(siteUtils.getUnitId())
self['UNITID'] = _quote(siteUtils.getUnitId())
self['LSSTID'] = _quote(siteUtils.getLSSTId())
unitid = siteUtils.getUnitId()
CCDTYPE = _quote(siteUtils.getUnitType())
ccdnames = {}
ccdmanunames = {}
ccdnames,ccdmanunames = siteUtils.getCCDNames()
print "retrieved the following LSST CCD names list"
print ccdnames
print "retrieved the following Manufacturers CCD names list"
print ccdmanunames
for slot in ccdnames :
print "CCD %s is in slot %s" % (ccdnames[slot],slot)
self['CCD%s'%slot] = _quote(ccdnames[slot])
if 'itl' in ccdnames[slot].lower() :
CCDTYPE = 'itl'
if 'e2v' in ccdnames[slot].lower() :
CCDTYPE = 'e2v'
for slot in ccdmanunames :
print "CCD %s is in slot %s" % (ccdmanunames[slot],slot)
self['CCDMANU%s'%slot] = _quote(ccdmanunames[slot])
try:
self['RUNNUM'] = _quote(siteUtils.getRunNumber())
except:
self['RUNNUM'] = "no_lcatr_run_number"
pass
self._read(os.path.join(siteUtils.getJobDir(), configFile))
print "CCDTYPE = %s" % CCDTYPE
self['sequence_file'] = _quote("NA")
self['acffile'] = self['itl_acffile']
# set default type
self['CCSCCDTYPE'] = _quote("ITL")
if ("RTM" in unitid.upper() or "ETU" in unitid.upper() or "RSA" in unitid.upper()) :
if ("e2v" in CCDTYPE) :
self['CCSCCDTYPE'] = _quote("E2V")
self['acffile'] = self['e2v_acffile']
self['sequence_file'] = self['e2v_seqfile']
else :
self['CCSCCDTYPE'] = _quote("ITL")
self['acffile'] = self['itl_acffile']
self['sequence_file'] = self['itl_seqfile']
os.system("export | grep -i seq")
seqdir = ""
if os.environ.has_key('SEQUENCERFILESDIR') :
seqdir = os.getenv('SEQUENCERFILESDIR')
print "seqdir=",seqdir
self['sequence_file'] = self['sequence_file'].replace('${SEQUENCERFILESDIR}',seqdir)
os.system("cp -vp %s %s" % (self['sequence_file'],self['tsCWD']))
#.........这里部分代码省略.........
示例7: first
#!/usr/bin/env python
import sys
import os
import siteUtils
import metUtils
from flatnessTask import flatnessTask
raft_id = siteUtils.getUnitId()
# Find the TS5 metrology scan data by constructing the name of the data-taking step
acqjobname = siteUtils.getJobName().replace('_Analysis', '')
if ("Room_Temp_Measurement" in acqjobname and not "After" in acqjobname):
acqjobname = "Pump_and_" + acqjobname
print('flatness_ts5:')
print(acqjobname)
print(siteUtils.getProcessName(acqjobname))
print('----')
# siteUtils returns a list with one member;
# here take the first (and only) member
infile = siteUtils.dependency_glob('*.csv',
jobname=siteUtils.getProcessName(acqjobname),
description='')[0]
print "infile = %s" % infile
flatnessTask(raft_id, infile, dtype='TS5', pickle_file='flatness_ts5.pickle')
示例8: print
for k in rsp:
print ('For key %s returned value is %s\n' % (k, rsp[k]) )
# sys.exit(0)
except Exception,msg:
print 'Operation failed with exception: '
print msg
sys.exit(1)
rsp = []
try:
# rsp = conn.getHardwareHierarchy(experimentSN='LCA-10753_RSA-002_CTE_ETU',
# htype='LCA-10753_RSA',
# noBatched='false')
rsp = conn.getHardwareHierarchy(experimentSN=siteUtils.getUnitId(),
htype=siteUtils.getUnitType(),
noBatched='false')
print "Results from getHardwareHierarchy unfiltered:"
iDict = 0
for d in rsp:
print('Examining array element %d' % (iDict))
isaccd = False
ccd_sn = ""
ccd_slot = ""
ccd_htype = ""
got_manu_info = False
for k in d:
if "ccd" in k.lower() :
print('For key {0} value is {1}'.format(k, d[k]))
if ('child_hardwareTypeName value' in k and ('itl-ccd' in d[k].lower() or 'e2v-ccd' in d[k].lower()) ) :
示例9: metrology
value is not None and
wl >= wl_range[0] and
wl <= wl_range[1]):
qe_results[band].append(value)
results = []
for band in qe_results:
results.append(validate(job, band=band,
QE=np.average(qe_results[band])))
return results
def metrology(self):
return []
if __name__ == '__main__':
results = [siteUtils.packageVersions()]
lsstnum = siteUtils.getUnitId()
vendorDataDir = os.readlink('vendorData')
print 'Vendor data location:', vendorDataDir
if siteUtils.getCcdVendor() == 'ITL':
vendor = ItlResults(vendorDataDir)
translator = ItlFitsTranslator(lsstnum, vendorDataDir, '.')
else:
vendor = e2vResults(vendorDataDir)
translator = e2vFitsTranslator(lsstnum, vendorDataDir, '.')
results.extend(vendor.run_all())
translator.run_all()
results.extend([lcatr.schema.fileref.make(x) for x in translator.outfiles])
示例10:
#!/usr/bin/env python
import glob
import lcatr.schema
import siteUtils
import metUtils
from MetrologyData import md_factory
producer = 'SR-MET-07'
testtype = 'FLATNESS'
results = metUtils.aggregate_filerefs_ts5(producer, testtype)
# Add the QA plot to the results
raft_id = siteUtils.getUnitId()
qafile = glob.glob('*_qa_plot.png')[0]
#print('qafile: %s' % qafile)
#print('raft_id: %s' % raft_id)
md = siteUtils.DataCatalogMetadata(CCD_MANU=siteUtils.getCcdVendor(),
LSST_NUM=siteUtils.getUnitId(),
PRODUCER=producer,
ORIGIN=siteUtils.getSiteName(),
TESTTYPE=testtype,
TEST_CATEGORY='MET')
results.extend([lcatr.schema.fileref.make(qafile, metadata=md(DATA_PRODUCT='QA_PLOT'))])
raftData = md_factory.load('flatness_ts5_delta.pickle')
peak_valley_95 = raftData.quantiles['0.975'] - raftData.quantiles['0.025']
peak_valley_100 = raftData.quantiles['1.000'] - raftData.quantiles['0.000']