Esempio n. 1
0
    def __init__(self, configFile, sys_paths=()):
        """
        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__()
        self.commands = []
        self['tsCWD'] = os.getcwd()
        self['labname'] = siteUtils.getSiteName()
        self['jobname'] = siteUtils.getJobName()
        self['CCDID'] = siteUtils.getUnitId()
        self['UNITID'] = siteUtils.getUnitId()
        self['LSSTID'] = siteUtils.getLSSTId()
        try:
            self['RUNNUM'] = siteUtils.getRunNumber()
        except Exception:
            self['RUNNUM'] = "no_lcatr_run_number"

        self['ts'] = os.getenv('CCS_TS', default='ts')
        self['archon'] = os.getenv('CCS_ARCHON', default='archon')

        # The following are only available for certain contexts.
        if 'CCS_VAC_OUTLET' in os.environ:
            self['vac_outlet'] = os.getenv('CCS_VAC_OUTLET')
        if 'CCS_CRYO_OUTLET' in os.environ:
            self['cryo_outlet'] = os.getenv('CCS_CRYO_OUTLET')
        if 'CCS_PUMP_OUTLET' in os.environ:
            self['pump_outlet'] = os.getenv('CCS_PUMP_OUTLET')

        self._read(os.path.join(siteUtils.getJobDir(), configFile))

        self.sys_paths = sys_paths
Esempio n. 2
0
    def write_sensor_image(self, single_sensor_file, slot_name, sensor_id, **kwargs):
        """
        Write a FITS image with pixel coordinates matching the specified
        sensor_id and raft_id.  The output file name is constructed from
        the test type, sensor type, sensor_id and raft_id.

        Parameters
        ----------
        single_sensor_file : str
            Name of the file to be copied
        slot_name:  str
            Name of the slot this sensor occupies
        sensor_id:  str
            Name of the sensor, e.g., 'E2V-CCD250-104'

        Keyword arguments
        -----------------
        clobber : bool, optional
            Flag indicating whether to overwrite an existing output file
        dry_run : bool, optional
            If true, just print output file names, but do not copy files
        job_id : str, optional
            Used to construct the output file name.  Defaults to siteUtils.getJobName()
        frame_suffix : str, optional
            Used in case we are making multiple frames for the same input.
            Defaults to None
        """
        file_suffix = get_file_suffix(single_sensor_file)

        clobber = kwargs.get('clobber', True)
        dry_run = kwargs.get('dry_run', False)
        job_id = kwargs.get('job_id', siteUtils.getJobName())
        frame_suffix = kwargs.get('frame_suffix', None)
        if frame_suffix is None:
            basename = "%s%s" % (sensor_id, file_suffix)
        else:
            basename = "%s%s%s" % (sensor_id, frame_suffix, file_suffix)
        outfilename = make_outfile_path(outpath=self.output_path,
                                        slot_name=slot_name,
                                        file_string=basename,
                                        jobname=jobname)
        outdir = os.path.dirname(outfilename)
        try:
            os.makedirs(outdir)
        except OSError:
            pass

        if dry_run:
            os.system("touch %s"% outfilename)
            return
        output = fits.open(single_sensor_file)

        RaftImages.update_primary_header(slot_name, output[0])

        for ext_num in range(1, 16):
            RaftImages.update_image_header(slot_name, output[ext_num])


        output.writeto(outfilename, clobber=clobber)
        output.close()
#!/usr/bin/env python
from ccsTools import ccsProducer
import siteUtils
import os


ccsProducer('rebalive_power', 'ccseorebalive_power.py')
if (False) :
    if "connectivity0" in siteUtils.getJobName() :
        os.system("cp -p ~/c0/* .")
    if "connectivity1" in siteUtils.getJobName() :
        os.system("cp -p ~/c1/* .")
    if "connectivity2" in siteUtils.getJobName() :
        os.system("cp -p ~/c2/* .")
Esempio n. 4
0
    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']))

            # now use the local copy
#            bb = self['sequence_file'].split("/")
#            self['sequence_file'] = _quote("%s/%s" % (os.getcwd(),bb[len(bb)-1].split("'")[0]))
            print "The sequence file to be used is %s" % self['sequence_file']
        else :
            if ("ITL" in CCDTYPE) :
                self['CCSCCDTYPE'] = _quote("ITL")
                self['acffile'] = self['itl_acffile']
            if ("e2v" in CCDTYPE) :
                self['CCSCCDTYPE'] = _quote("E2V")
                self['acffile'] = self['e2v_acffile']
            print "The acffile to be used is %s" % self['acffile']
#!/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')
Esempio n. 6
0
#!/usr/bin/env python
from ccsTools import ccsProducer
import Tkinter
import glob
import os
import sys
import siteUtils

for i in range(5) :
    print " "

jobname = siteUtils.getJobName()

if '_RGLOW_' in jobname :
    parts = jobname.split('_')
    np = len(parts)
    sRGLOW = parts[np-2]+'.'+parts[np-1]
    print "sRGLOW = ",sRGLOW
    RGLOW = float(sRGLOW)
    if 'minus' in parts[np-3] :
        RGLOW = -RGLOW
else :
    print "Enter the setting for RGLOW - "
    sys.stdout.flush()
    RGLOW = raw_input(" ")

fp = open("rglow_settings.txt","w");
fp.write("RGLOW %f\n" % float(RGLOW))
fp.close()

#!/usr/bin/env python
from ccsTools import ccsProducer
import siteUtils
import os
import sys

for i in range(20) :
     print "This test may be skipped if the sensors are already fully powered and you have the authorization. Skip the step (N/y)?"
sys.stdout.flush()
answer = raw_input("\n\nThis test may be skipped if the sensors are already fully powered and you have the authorization. Skip the step (N/y)? \n\n")
if "y" in answer.lower() :
     print "Operator requested to skip the step. BYE"
else :
    ccsProducer('rebalive_power', 'ccseorebalive_power.py')

if (False) :
    if "connectivity0" in siteUtils.getJobName() :
        os.system("cp -p ~/c0/* .")
    if "connectivity1" in siteUtils.getJobName() :
        os.system("cp -p ~/c1/* .")
    if "connectivity2" in siteUtils.getJobName() :
        os.system("cp -p ~/c2/* .")
Esempio n. 8
0
    def make_victim_sensor_image(self,
                                 aggressor_spot_file,
                                 aggressor_dark_file,
                                 victim_dark_file,
                                 crosstalk,
                                 victim_slot_name,
                                 aggresor_slot_name,
                                 sensor_id,
                                 **kwargs):
        """
        Write a FITS image with pixel coordinates matching the specified
        sensor_id and raft_id emulating a victim sensor from a crosstalk test.
        The output file name is constructed from the test type, sensor type, sensor_id,
        raft_id and aggresor_slot_names.

        The output image is: crosstalk * (aggressor_spot - aggressor_dark ) +  victim_dark

        Parameters
        ----------
        aggressor_spot_file : str
            Name of the file with the spot data for the aggressor sensor
        aggressor_dark_file : str
            Name of the file with the dark data for the aggressor sensor
        victim_dark_file : str
            Name of the file with the dark data for the victim sensor
        crosstalk : float
            Crosstalk value.
        victim_slot_name:  str
            Name of the slot this sensor occupies
        aggresor_slot_name:  str
            Name of the slot this sensor occupies
        sensor_id:  str
            Name of the sensor, e.g., 'E2V-CCD250-104'

        Keyword arguments
        -----------------
        clobber : bool, optional
            Flag indicating whether to overwrite an existing output file
        dry_run : bool, optional
            If true, just print output file names, but do not copy files
        job_id : str, optional
            Used to construct the output file name.  Defaults to siteUtils.getJobName()
        """
        file_suffix = get_file_suffix(victim_dark_file).replace('sim_dark_dark',
                                                                'sim_spot_spot_multi')

        clobber = kwargs.get('clobber', True)
        dry_run = kwargs.get('dry_run', False)
        job_id = kwargs.get('job_id', siteUtils.getJobName())
        basename = "%s_%s%s" % (sensor_id, aggresor_slot_name, file_suffix)

        outfilename = make_outfile_path(outpath=self.output_path,
                                        slot_name=victim_slot_name,
                                        file_string=basename,
                                        job_id=job_id)
        outdir = os.path.dirname(outfilename)
        try:
            os.makedirs(outdir)
        except OSError:
            pass
        if dry_run:
            os.system("touch %s"% outfilename)
            return

        aggressor_spot = fits.open(aggressor_spot_file)
        aggressor_dark = fits.open(aggressor_dark_file)
        victim_dark = fits.open(victim_dark_file)

        output = aggressor_spot
        for amp in range(1, 17):
            victimimage = aggressor_spot[amp].data.astype(float)
            victimimage -= aggressor_dark[amp].data
            victimimage *= crosstalk
            victimimage += victim_dark[amp].data
            output[amp].data = victimimage.astype(int)

        RaftImages.update_primary_header(victim_slot_name, output[0])

        for ext_num in range(1, 17):
            RaftImages.update_image_header(victim_slot_name, output[ext_num])

        output.writeto(outfilename, clobber=clobber)
        output.close()