Pipeline

genmaster.py

Created on Wed Sep 25 17:07:21 2019

@author: raf

class vison.pipe.genmaster.GenPipe(inputdict, dolog=True, drill=False, debug=False, startobsid=0, processes=1, tag='', cleanafter=False)

Abstract Master Class of FM-analysis, any level of assembly.

catchtraceback()
dotask(taskname, inputs, drill=False, debug=False, cleanafter=False)

Generic test master function.

get_execution_summary(exectime=None)
get_test(taskname, inputs={}, log=None, drill=False, debug=False, cleanafter=False)
launchtask(taskname)
run(explogf=None, elvis=None)
wait_and_run(dayfolder, elvis='7.5.X')
class vison.pipe.genmaster.GenPipe(inputdict, dolog=True, drill=False, debug=False, startobsid=0, processes=1, tag='', cleanafter=False)

Abstract Master Class of FM-analysis, any level of assembly.

catchtraceback()
dotask(taskname, inputs, drill=False, debug=False, cleanafter=False)

Generic test master function.

get_execution_summary(exectime=None)
get_test(taskname, inputs={}, log=None, drill=False, debug=False, cleanafter=False)
launchtask(taskname)
run(explogf=None, elvis=None)
wait_and_run(dayfolder, elvis='7.5.X')

master.py

This is the main script that will orchestrate the analysis of Euclid-VIS FM Ground Calibration Campaign.

The functions of this module are:

  • Take inputs as to what data is to be analyzed, and what analysis scripts are to be run on it.

  • Set the variables necessary to process this batch of FM calib. data.

  • Start a log of actions to keep track of what is being done.

  • Provide inputs to scripts, execute the analysis scripts and report location of analysis results.

Some Guidelines for Development:

  • Input data is “sacred”: read-only.

  • Each execution of Master must have associated a unique ANALYSIS-ID.

  • All the Analysis must be divided in TASKS. TASKS can have SUB-TASKS.

  • All data for each TASK must be under a single day-folder.

  • All results from the execution of FMmaster must be under a single directory with subdirectories for each TASK run.

  • A subfolder of this root directory will contain the logging information:

    inputs, outputs, analysis results locations.

Created on Wed Jul 27 12:16:40 2016

author

Ruyman Azzollini

class vison.pipe.master.GenPipe(inputdict, dolog=True, drill=False, debug=False, cleanafter=False)

Master Pipeline Class.

catchtraceback()
dotask(taskname, inputs, drill=False, debug=False, cleanafter=False)

Generic test master function.

get_execution_summary(exectime=None)
get_test(taskname, inputs={}, log=None, drill=False, debug=False, cleanafter=False)
launchtask(taskname)
run(explogf=None, elvis=None)
class vison.pipe.master.Pipe(inputdict, dolog=True, drill=False, debug=False, startobsid=0, processes=1, tag='', cleanafter=False)

Master Class of FM-analysis at block-level of assembly.

class BF01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PTC0X script structure dictionary.

#:param exptimes: list of ints [ms], exposure times. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 800 nm. :param diffvalues: dict, opt, differential values.

correct_BFE_G15()
debugtask()
Performs basic analysis of images:
  • extracts COVARIANCE matrix for each fluence

extract_BF()
Performs basic analysis of images:
  • extracts BF matrix for each COV matrix

extract_COV()
Performs basic analysis of images:
  • extracts COVARIANCE matrix for each fluence

extract_PTCs()
f_correct_BFE_G15(ccdobjname, fixA=False)

Applies BFE solutions from G+15 to images, to later test effectivity through PTC.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of BF01_inputs

meta_analysis()

Analyzes the BF results across fluences.

set_inpdefaults(**kwargs)
class BIAS0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

BIAS0X: Basic analysis of data.

METACODE

f. e. ObsID:
   f.e.CCD:

       load ccdobj of ObsID, CCD

       with ccdobj, f.e.Q:
           produce a 2D poly model of bias, save coefficients
           produce average profile along rows
           produce average profile along cols
           # save 2D model and profiles in a pick file for each OBSID-CCD
           measure and save RON after subtracting large scale structure

plot RON vs. time f. each CCD and Q
plot average profiles f. each CCD and Q (color coded by time)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds BIAS0X script structure dictionary.

###:param N: integer, number of frames to acquire. :param diffvalues: dict, opt, differential values. :param elvis: char, ELVIS version.

debugtask()
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of BIAS0X_inputs

meta_analysis()

METACODE

f. each CCD:
   stack all ObsIDs to produce Master Bias
   f. e. Q:
       measure average profile along rows
       measure average profile along cols
plot average profiles of Master Bias(s) f. each CCD,Q
(produce table(s) with summary of results, include in report)
save Master Bias(s) (3 images) to FITS CDPs
show Master Bias(s) (3 images) in report
save name of MasterBias(s) CDPs to DataDict, report
prep_data()

BIAS0X: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction cosmetics masking

class CHINJ00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ00 script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ00_inputs

set_inpdefaults(**kwargs)
class CHINJ01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ01 script structure dictionary.

#:param IDL: float, [V], value of IDL (Inject. Drain Low). #:param IDH: float, [V], Injection Drain High. #:param IG2: float, [V], Injection Gate 2. #:param IG1s: list of 2 floats, [V], [min,max] values of IG1. #:param id_delays: list of 2 floats, [us], injection drain delays. #:param toi_chinj: int, [us], TOI-charge injection. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ01_inputs

meta_analysis()

Plot and model charge injection vs. IG1 Find injection threshold: Min IG1 Find notch injection amount.

prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class CHINJ02(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ02 script structure dictionary.

#:param IDLs: list of 2 ints, [V], [min,max] values of IDL (Inject. Drain Low). #:param IDH: int, [V], Injection Drain High. #:param id_delays: list of 2 ints, [us], injection drain delays. #:param toi_chinj: int, [us], TOI-charge injection. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ02_inputs

meta_analysis()

Finds the Injection Threshold for each CCD half.

METACODE

f.e.CCD:
    f.e.Q:
        load injection vs. IDL cuve
        find&save injection threshold on curve

report injection threshold as a table
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class COSMETICS00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds COSMETICS00 script structure dictionary.

Parameters
  • diffvalues – dict, opt, differential values.

  • elvis – char, ELVIS version.

check_data()
check_metrics_ST(**kwargs)

Overriding parent method

do_masks()
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)

Overriding parent method

inputsclass

alias of COS_inputs

meta()
class DARK01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds DARK01 script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of DARK01_inputs

prep_data()

DARK01: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [BIAS SUBTRACTION] cosmetics masking

stack_analysis()

METACODE

f. each CCD:
    f. e. Q:
        stack all ObsIDs to produce Master Dark
        produce mask of hot pixels / columns
        count hot pixels / columns
        measure average profile along rows
        measure average profile along cols

plot average profiles of Master Bias f. each CCD,Q
show Master Dark (images), include in report
report stats of defects, include in report
save name of MasterDark to DataDict, report
save name of Defects in Darkness Mask to DD, report
class FLAT0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds FLAT0X script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

do_indiv_flats()

METACODE

Preparation of data for further analysis and
produce flat-field for each OBSID.

f.e. ObsID:
    f.e.CCD:

        load ccdobj

        f.e.Q:

            model 2D fluence distro in image area
            produce average profile along rows
            produce average profile along cols

        save 2D model and profiles in a pick file for each OBSID-CCD
        divide by 2D model to produce indiv-flat
        save indiv-Flat to FITS(?), update add filename

plot average profiles f. each CCD and Q (color coded by time)
do_master_flat()

METACODE

Produces Master Flat-Field

f.e.CCD:
    f.e.Q:
        stack individual flat-fields by chosen estimator
save Master FF to FITS
measure PRNU and
report PRNU figures
do_prdef_mask()

METACODE

Produces mask of defects in Photo-Response
Could use master FF, or a stack of a subset of images (in order
to produce mask, needed by other tasks, quicker).

f.e.CCD:
    f.e.Q:
        produce mask of PR defects
        save mask of PR defects
        count dead pixels / columns

report PR-defects stats
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of FLATS0X_inputs

prepare_images()

FLAT0X: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class FOCUS00(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

This is just an assignation of values measured in check_data.

build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds FOCUS00 script structure dictionary.

#:param wavelength: int, [nm], wavelength. #:param exptime: int, [ms], exposure time. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of FOCUS00_inputs

lock_on_stars()
meta_analysis()
prep_data()
class MOT_FF(inputs, log=None, drill=False, debug=False, cleanafter=False)
extract_HER()
inputsclass

alias of MOT_FF_inputs

class MOT_WARM(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()
EXPOSURES:

BIAS, RAMP, CHINJ, FLAT, POINT_w x waves_PNT

build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds MOT_WARM script structure dictionary.

Parameters
  • diffvalues – dict, opt, differential values.

  • elvis – char, ELVIS version.

check_data()
check_metrics_ST(**kwargs)
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)
inputsclass

alias of MOT_WARM_inputs

lock_on_stars()
class NL01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds NL01 script structure dictionary.

#:param expts: list of ints [ms], exposure times. #:param exptinter: int, ms, exposure time of interleaved source-stability exposures. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 0 (Neutral Density Filter) :param diffvalues: dict, opt, differential values.

do_satCTE()

METACODE

select ObsIDs with fluence(exptime) >~ 0.5 FWC

f.e. ObsID:
    CCD:
        Q:
            measure CTE from amount of charge in over-scan relative to fluence

f.e. CCD:
    Q:
        get curve of CTE vs. fluence
        measure FWC from curve in ADU

report FWCs in electrons [via gain in inputs] f.e. CCD, Q (table)
extract_stats()

Performs basic analysis: extracts statistics from image regions to later build NLC.

METACODE

create segmentation map given grid parameters

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            f.e. "img-segment": (done elsewhere)
                measure central value
                measure variance
filterexposures(structure, explog, OBSID_lims)

Loads a list of Exposure Logs and selects exposures from test NL01.

The filtering takes into account an expected structure for the acquisition script.

The datapath becomes another column in DataDict. This helps dealing with tests that run overnight and for which the input data is in several date-folders.

inputsclass

alias of NL01_inputs

prep_data()

Takes Raw Data and prepares it for further analysis.

METACODE

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            mask-out bad pixels
            mask-out detector cosmetics
            subtract offset
            opt: [sub bias frame]
produce_NLCs()

METACODE

Obtains Best-Fit Non-Linearity Curve

f.e. CCD:
    f.e. Q:

        [opt] apply correction for source variability (interspersed exposure
          with constant exptime)
        Build NL Curve (NLC) - use stats and exptimes
        fit poly. shape to NL curve

plot NL curves for each CCD, Q
report max. values of NL (table)
recalibrate_exptimes(exptimes)

Corrects exposure times given independent calibration of the shutter.

class NL02(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds NL02 script structure dictionary.

debug_NLPTC()
do_satCTE()

METACODE

select ObsIDs with fluence(exptime) >~ 0.5 FWC

f.e. ObsID:
    CCD:
        Q:
            measure CTE from amount of charge in over-scan relative to fluence

f.e. CCD:
    Q:
        get curve of CTE vs. fluence
        measure FWC from curve in ADU

report FWCs in electrons [via gain in inputs] f.e. CCD, Q (table)
extract_PTC()

Extractin a binned PTC (binned to marginalise BF).

inputsclass

alias of NL02_inputs

prep_data()

Takes Raw Data and prepares it for further analysis.

METACODE

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            mask-out bad pixels
            mask-out detector cosmetics
            subtract offset
            opt: [sub bias frame]
produce_NLCs()

METACODE

Obtains Best-Fit Non-Linearity Curve

f.e. CCD:
    f.e. Q:

        [opt] apply correction for source variability (interspersed exposure
          with constant exptime)
        Build NL Curve (NLC) - use stats and exptimes
        fit poly. shape to NL curve

plot NL curves for each CCD, Q
report max. values of NL (table)
simulNL()
class PERSIST01(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f.e.CCD:
    f.e.Q:
        measure stats in pix satur MASK across OBSIDs
         (pre-satur, satur, post-satur)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PERSISTENCE01 script structure dictionary.

Parameters
  • exptSATUR – int, saturation exposure time.

  • exptLATEN – int, latency exposure time.

  • diffvalues – dict, opt, differential values.

check_data()

PERSIST01: Checks quality of ingested data.

METACODE

check common HK values are within safe / nominal margins
check voltages in HK match commanded voltages, within margins

f.e.ObsID:
    f.e.CCD:
        f.e.Q.:
            measure offsets in pre-, over-
            measure std in pre-, over-
            measure fluence in apertures around Point Sources

assess std in pre- (~RON) is within allocated margins
assess offsets in pre-, and over- are equal, within allocated  margins
assess fluence is ~expected within apertures (PS) for each frame (pre-satur, satur, post-satur)


plot point source fluence vs. OBSID, all sources
[plot std vs. time]

issue any warnings to log
issue update to report
check_metrics_ST(**kwargs)
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)
get_satur_masks()

Basic analysis of data.

METACODE

f.e.CCD:
    use SATURATED frame to generate pixel saturation MASKs
inputsclass

alias of PERSIST01_inputs

meta_analysis()

Meta-analysis of data.

METACODE

f.e.CCD:
    f.e.Q:
        estimate delta-charge_0 and decay tau from time-series

report:
    persistence level (delta-charge_0) and time constant
prep_data()

PERSIST01: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction cosmetics masking

set_inpdefaults(**kwargs)
class PTC0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PTC0X script structure dictionary.

#:param exptimes: list of ints [ms], exposure times. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 800 nm. :param diffvalues: dict, opt, differential values.

debug_PRE_HER()
debugtask()
extract_HER()

Hard Edge Response Analysis.

Extraction of overscan profiles (also parallel, for satCTE analysis).

extract_PTC()
Performs basic analysis of images:
  • builds PTC curves: both on non-binned [and binned images]

METACODE

create list of OBSID pairs

create segmentation map given grid parameters

f.e. OBSID pair:
    CCD:
        Q:
            subtract CCD images
            f.e. segment:
                measure central value
                measure variance
f_extract_PTC(ccdobjcol, medcol, varcol, binfactor=1)
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of PTC0X_inputs

make_plotBM_dict(bmcdp)
meta_analysis()

Analyzes the variance and fluence: gain, and gain(fluence)

METACODE

f.e. CCD:
    Q:
        (using stats across segments:)
        fit PTC to quadratic model
        solve for gain
        solve for alpha (pixel-correls, Guyonnet+15)
        solve for blooming limit (ADU)
            convert bloom limit to electrons, using gain

plot PTC curves with best-fit f.e. CCD, Q
report on gain estimates f. e. CCD, Q (table)
report on blooming limits (table)
produce_Bloom_Maps(debug=False)
set_inpdefaults(**kwargs)
class STRAY00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds STRAY00 script structure dictionary. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of STRAY00_inputs

set_inpdefaults(**kwargs)
class TP00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')
check_data()

TP01: Checks quality of ingested data.

METACODE

check common HK values are within safe / nominal margins
check voltages in HK match commanded voltages, within margins

f.e.ObsID:
    f.e.CCD:
        f.e.Q.:
            measure offsets in pre-, over-
            measure std in pre-, over-
            measure mean in img-

assess std in pre- (~RON) is within allocated margins
assess offsets in pre-, and over- are equal, within allocated margins
assess offsets are within allocated margins
assess injection level is within expected margins

plot histogram of injected levels for each Q
[plot std vs. time]

issue any warnings to log
issue update to report
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP00_inputs

set_inpdefaults(**kwargs)
class TP01(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f. e. ObsID [there are different TOI_TP and TP-patterns]:
    f.e.CCD:
        f.e.Q:
            load "map of relative pumping"
            find_dipoles:
                x, y, rel-amplitude, orientation

produce & report:
    map location of dipoles
    PDF of dipole amplitudes (for N and S)
    Counts of dipoles (and N vs. S)
build_scriptdict(diffvalues={}, elvis='7.5.X')
extract()

Obtain maps of dipoles.

METACODE

f.e. id_delay (there are 2):
    f.e. CCD:
        f.e. Q:
            produce reference non-pumped injection map

f. e. ObsID:
    f.e. CCD:

        load ccdobj
        f.e.Q.:
            divide ccdobj.Q by injection map

        save dipole map and store reference
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP01_inputs

meta_analysis()

Meta-analysis of data:

Try to identify tau and pixel-phase location for each trap. Need to associate dipoles across TOI_TPs and TP-patterns

METACODE

across TOI_TP, patterns:

    build catalog of traps: x,y, tp-mode, tau, Pc
    tau, Pc = f({A,TOI})

Report on :
    Histogram of Taus
    Histogram of Pc (capture probability)
    Histogram of I-phases (larger phases should have more traps,
                      statistically) -> check

    Total Count of Traps
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class TP02(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f. e. ObsID [there are different TOI_TP and TP-patterns]:
    f.e.CCD:
        f.e.Q:
            load raw 1D map of relative pumping (from extract_data)
            identify dipoles:
                x, rel-amplitude, orientation (E or W)

produce & report:
    map location of dipoles
    PDF of dipole amplitudes (for E and W)
    Counts of dipoles (and E vs. W)
build_scriptdict(diffvalues={}, elvis='7.5.X')
extract()

Obtain Maps of Serial Dipoles.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP02_inputs

meta_analysis()

Meta-analysis of data:

Try to identify tau and pixel-phase location for each trap. Need to associate dipoles across TOI_TPs and TP-patterns

METACODE

across TOI_TP, patterns:
    build catalog of traps: x,y,R-phase, amp(dwell)
    from Amp(dwell) -> tau, Pc

Report on :
   Histogram of Taus
   Histogram of Pc (capture probability)
   Histogram of R-phases

   Total Count of Traps
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class TP11(inputs, log=None, drill=False, debug=False, cleanafter=False)
class TP21(inputs, log=None, drill=False, debug=False, cleanafter=False)
dotask(taskname, inputs, drill=False, debug=False, cleanafter=False)

Generic test master function.

wait_and_run(dayfolder, elvis='7.5.X')
class vison.pipe.master.Pipe(inputdict, dolog=True, drill=False, debug=False, startobsid=0, processes=1, tag='', cleanafter=False)

Master Class of FM-analysis at block-level of assembly.

class BF01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PTC0X script structure dictionary.

#:param exptimes: list of ints [ms], exposure times. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 800 nm. :param diffvalues: dict, opt, differential values.

correct_BFE_G15()
debugtask()
Performs basic analysis of images:
  • extracts COVARIANCE matrix for each fluence

extract_BF()
Performs basic analysis of images:
  • extracts BF matrix for each COV matrix

extract_COV()
Performs basic analysis of images:
  • extracts COVARIANCE matrix for each fluence

extract_PTCs()
f_correct_BFE_G15(ccdobjname, fixA=False)

Applies BFE solutions from G+15 to images, to later test effectivity through PTC.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of BF01_inputs

meta_analysis()

Analyzes the BF results across fluences.

set_inpdefaults(**kwargs)
class BIAS0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

BIAS0X: Basic analysis of data.

METACODE

f. e. ObsID:
   f.e.CCD:

       load ccdobj of ObsID, CCD

       with ccdobj, f.e.Q:
           produce a 2D poly model of bias, save coefficients
           produce average profile along rows
           produce average profile along cols
           # save 2D model and profiles in a pick file for each OBSID-CCD
           measure and save RON after subtracting large scale structure

plot RON vs. time f. each CCD and Q
plot average profiles f. each CCD and Q (color coded by time)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds BIAS0X script structure dictionary.

###:param N: integer, number of frames to acquire. :param diffvalues: dict, opt, differential values. :param elvis: char, ELVIS version.

debugtask()
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of BIAS0X_inputs

meta_analysis()

METACODE

f. each CCD:
   stack all ObsIDs to produce Master Bias
   f. e. Q:
       measure average profile along rows
       measure average profile along cols
plot average profiles of Master Bias(s) f. each CCD,Q
(produce table(s) with summary of results, include in report)
save Master Bias(s) (3 images) to FITS CDPs
show Master Bias(s) (3 images) in report
save name of MasterBias(s) CDPs to DataDict, report
prep_data()

BIAS0X: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction cosmetics masking

class CHINJ00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ00 script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ00_inputs

set_inpdefaults(**kwargs)
class CHINJ01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ01 script structure dictionary.

#:param IDL: float, [V], value of IDL (Inject. Drain Low). #:param IDH: float, [V], Injection Drain High. #:param IG2: float, [V], Injection Gate 2. #:param IG1s: list of 2 floats, [V], [min,max] values of IG1. #:param id_delays: list of 2 floats, [us], injection drain delays. #:param toi_chinj: int, [us], TOI-charge injection. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ01_inputs

meta_analysis()

Plot and model charge injection vs. IG1 Find injection threshold: Min IG1 Find notch injection amount.

prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class CHINJ02(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds CHINJ02 script structure dictionary.

#:param IDLs: list of 2 ints, [V], [min,max] values of IDL (Inject. Drain Low). #:param IDH: int, [V], Injection Drain High. #:param id_delays: list of 2 ints, [us], injection drain delays. #:param toi_chinj: int, [us], TOI-charge injection. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of CHINJ02_inputs

meta_analysis()

Finds the Injection Threshold for each CCD half.

METACODE

f.e.CCD:
    f.e.Q:
        load injection vs. IDL cuve
        find&save injection threshold on curve

report injection threshold as a table
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class COSMETICS00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds COSMETICS00 script structure dictionary.

Parameters
  • diffvalues – dict, opt, differential values.

  • elvis – char, ELVIS version.

check_data()
check_metrics_ST(**kwargs)

Overriding parent method

do_masks()
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)

Overriding parent method

inputsclass

alias of COS_inputs

meta()
class DARK01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds DARK01 script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of DARK01_inputs

prep_data()

DARK01: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [BIAS SUBTRACTION] cosmetics masking

stack_analysis()

METACODE

f. each CCD:
    f. e. Q:
        stack all ObsIDs to produce Master Dark
        produce mask of hot pixels / columns
        count hot pixels / columns
        measure average profile along rows
        measure average profile along cols

plot average profiles of Master Bias f. each CCD,Q
show Master Dark (images), include in report
report stats of defects, include in report
save name of MasterDark to DataDict, report
save name of Defects in Darkness Mask to DD, report
class FLAT0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds FLAT0X script structure dictionary.

Parameters

diffvalues – dict, opt, differential values.

do_indiv_flats()

METACODE

Preparation of data for further analysis and
produce flat-field for each OBSID.

f.e. ObsID:
    f.e.CCD:

        load ccdobj

        f.e.Q:

            model 2D fluence distro in image area
            produce average profile along rows
            produce average profile along cols

        save 2D model and profiles in a pick file for each OBSID-CCD
        divide by 2D model to produce indiv-flat
        save indiv-Flat to FITS(?), update add filename

plot average profiles f. each CCD and Q (color coded by time)
do_master_flat()

METACODE

Produces Master Flat-Field

f.e.CCD:
    f.e.Q:
        stack individual flat-fields by chosen estimator
save Master FF to FITS
measure PRNU and
report PRNU figures
do_prdef_mask()

METACODE

Produces mask of defects in Photo-Response
Could use master FF, or a stack of a subset of images (in order
to produce mask, needed by other tasks, quicker).

f.e.CCD:
    f.e.Q:
        produce mask of PR defects
        save mask of PR defects
        count dead pixels / columns

report PR-defects stats
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of FLATS0X_inputs

prepare_images()

FLAT0X: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class FOCUS00(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

This is just an assignation of values measured in check_data.

build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds FOCUS00 script structure dictionary.

#:param wavelength: int, [nm], wavelength. #:param exptime: int, [ms], exposure time. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of FOCUS00_inputs

lock_on_stars()
meta_analysis()
prep_data()
class MOT_FF(inputs, log=None, drill=False, debug=False, cleanafter=False)
extract_HER()
inputsclass

alias of MOT_FF_inputs

class MOT_WARM(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()
EXPOSURES:

BIAS, RAMP, CHINJ, FLAT, POINT_w x waves_PNT

build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds MOT_WARM script structure dictionary.

Parameters
  • diffvalues – dict, opt, differential values.

  • elvis – char, ELVIS version.

check_data()
check_metrics_ST(**kwargs)
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)
inputsclass

alias of MOT_WARM_inputs

lock_on_stars()
class NL01(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds NL01 script structure dictionary.

#:param expts: list of ints [ms], exposure times. #:param exptinter: int, ms, exposure time of interleaved source-stability exposures. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 0 (Neutral Density Filter) :param diffvalues: dict, opt, differential values.

do_satCTE()

METACODE

select ObsIDs with fluence(exptime) >~ 0.5 FWC

f.e. ObsID:
    CCD:
        Q:
            measure CTE from amount of charge in over-scan relative to fluence

f.e. CCD:
    Q:
        get curve of CTE vs. fluence
        measure FWC from curve in ADU

report FWCs in electrons [via gain in inputs] f.e. CCD, Q (table)
extract_stats()

Performs basic analysis: extracts statistics from image regions to later build NLC.

METACODE

create segmentation map given grid parameters

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            f.e. "img-segment": (done elsewhere)
                measure central value
                measure variance
filterexposures(structure, explog, OBSID_lims)

Loads a list of Exposure Logs and selects exposures from test NL01.

The filtering takes into account an expected structure for the acquisition script.

The datapath becomes another column in DataDict. This helps dealing with tests that run overnight and for which the input data is in several date-folders.

inputsclass

alias of NL01_inputs

prep_data()

Takes Raw Data and prepares it for further analysis.

METACODE

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            mask-out bad pixels
            mask-out detector cosmetics
            subtract offset
            opt: [sub bias frame]
produce_NLCs()

METACODE

Obtains Best-Fit Non-Linearity Curve

f.e. CCD:
    f.e. Q:

        [opt] apply correction for source variability (interspersed exposure
          with constant exptime)
        Build NL Curve (NLC) - use stats and exptimes
        fit poly. shape to NL curve

plot NL curves for each CCD, Q
report max. values of NL (table)
recalibrate_exptimes(exptimes)

Corrects exposure times given independent calibration of the shutter.

class NL02(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds NL02 script structure dictionary.

debug_NLPTC()
do_satCTE()

METACODE

select ObsIDs with fluence(exptime) >~ 0.5 FWC

f.e. ObsID:
    CCD:
        Q:
            measure CTE from amount of charge in over-scan relative to fluence

f.e. CCD:
    Q:
        get curve of CTE vs. fluence
        measure FWC from curve in ADU

report FWCs in electrons [via gain in inputs] f.e. CCD, Q (table)
extract_PTC()

Extractin a binned PTC (binned to marginalise BF).

inputsclass

alias of NL02_inputs

prep_data()

Takes Raw Data and prepares it for further analysis.

METACODE

f.e. ObsID:
    f.e.CCD:
        f.e.Q:
            mask-out bad pixels
            mask-out detector cosmetics
            subtract offset
            opt: [sub bias frame]
produce_NLCs()

METACODE

Obtains Best-Fit Non-Linearity Curve

f.e. CCD:
    f.e. Q:

        [opt] apply correction for source variability (interspersed exposure
          with constant exptime)
        Build NL Curve (NLC) - use stats and exptimes
        fit poly. shape to NL curve

plot NL curves for each CCD, Q
report max. values of NL (table)
simulNL()
class PERSIST01(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f.e.CCD:
    f.e.Q:
        measure stats in pix satur MASK across OBSIDs
         (pre-satur, satur, post-satur)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PERSISTENCE01 script structure dictionary.

Parameters
  • exptSATUR – int, saturation exposure time.

  • exptLATEN – int, latency exposure time.

  • diffvalues – dict, opt, differential values.

check_data()

PERSIST01: Checks quality of ingested data.

METACODE

check common HK values are within safe / nominal margins
check voltages in HK match commanded voltages, within margins

f.e.ObsID:
    f.e.CCD:
        f.e.Q.:
            measure offsets in pre-, over-
            measure std in pre-, over-
            measure fluence in apertures around Point Sources

assess std in pre- (~RON) is within allocated margins
assess offsets in pre-, and over- are equal, within allocated  margins
assess fluence is ~expected within apertures (PS) for each frame (pre-satur, satur, post-satur)


plot point source fluence vs. OBSID, all sources
[plot std vs. time]

issue any warnings to log
issue update to report
check_metrics_ST(**kwargs)
filterexposures(structure, explog, OBSID_lims)
get_checkstats_ST(**kwargs)
get_satur_masks()

Basic analysis of data.

METACODE

f.e.CCD:
    use SATURATED frame to generate pixel saturation MASKs
inputsclass

alias of PERSIST01_inputs

meta_analysis()

Meta-analysis of data.

METACODE

f.e.CCD:
    f.e.Q:
        estimate delta-charge_0 and decay tau from time-series

report:
    persistence level (delta-charge_0) and time constant
prep_data()

PERSIST01: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction cosmetics masking

set_inpdefaults(**kwargs)
class PTC0X(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds PTC0X script structure dictionary.

#:param exptimes: list of ints [ms], exposure times. #:param frames: list of ints, number of frames for each exposure time. #:param wavelength: int, wavelength. Default: 800 nm. :param diffvalues: dict, opt, differential values.

debug_PRE_HER()
debugtask()
extract_HER()

Hard Edge Response Analysis.

Extraction of overscan profiles (also parallel, for satCTE analysis).

extract_PTC()
Performs basic analysis of images:
  • builds PTC curves: both on non-binned [and binned images]

METACODE

create list of OBSID pairs

create segmentation map given grid parameters

f.e. OBSID pair:
    CCD:
        Q:
            subtract CCD images
            f.e. segment:
                measure central value
                measure variance
f_extract_PTC(ccdobjcol, medcol, varcol, binfactor=1)
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of PTC0X_inputs

make_plotBM_dict(bmcdp)
meta_analysis()

Analyzes the variance and fluence: gain, and gain(fluence)

METACODE

f.e. CCD:
    Q:
        (using stats across segments:)
        fit PTC to quadratic model
        solve for gain
        solve for alpha (pixel-correls, Guyonnet+15)
        solve for blooming limit (ADU)
            convert bloom limit to electrons, using gain

plot PTC curves with best-fit f.e. CCD, Q
report on gain estimates f. e. CCD, Q (table)
report on blooming limits (table)
produce_Bloom_Maps(debug=False)
set_inpdefaults(**kwargs)
class STRAY00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')

Builds STRAY00 script structure dictionary. :param diffvalues: dict, opt, differential values.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of STRAY00_inputs

set_inpdefaults(**kwargs)
class TP00(inputs, log=None, drill=False, debug=False, cleanafter=False)
build_scriptdict(diffvalues={}, elvis='7.5.X')
check_data()

TP01: Checks quality of ingested data.

METACODE

check common HK values are within safe / nominal margins
check voltages in HK match commanded voltages, within margins

f.e.ObsID:
    f.e.CCD:
        f.e.Q.:
            measure offsets in pre-, over-
            measure std in pre-, over-
            measure mean in img-

assess std in pre- (~RON) is within allocated margins
assess offsets in pre-, and over- are equal, within allocated margins
assess offsets are within allocated margins
assess injection level is within expected margins

plot histogram of injected levels for each Q
[plot std vs. time]

issue any warnings to log
issue update to report
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP00_inputs

set_inpdefaults(**kwargs)
class TP01(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f. e. ObsID [there are different TOI_TP and TP-patterns]:
    f.e.CCD:
        f.e.Q:
            load "map of relative pumping"
            find_dipoles:
                x, y, rel-amplitude, orientation

produce & report:
    map location of dipoles
    PDF of dipole amplitudes (for N and S)
    Counts of dipoles (and N vs. S)
build_scriptdict(diffvalues={}, elvis='7.5.X')
extract()

Obtain maps of dipoles.

METACODE

f.e. id_delay (there are 2):
    f.e. CCD:
        f.e. Q:
            produce reference non-pumped injection map

f. e. ObsID:
    f.e. CCD:

        load ccdobj
        f.e.Q.:
            divide ccdobj.Q by injection map

        save dipole map and store reference
filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP01_inputs

meta_analysis()

Meta-analysis of data:

Try to identify tau and pixel-phase location for each trap. Need to associate dipoles across TOI_TPs and TP-patterns

METACODE

across TOI_TP, patterns:

    build catalog of traps: x,y, tp-mode, tau, Pc
    tau, Pc = f({A,TOI})

Report on :
    Histogram of Taus
    Histogram of Pc (capture probability)
    Histogram of I-phases (larger phases should have more traps,
                      statistically) -> check

    Total Count of Traps
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class TP02(inputs, log=None, drill=False, debug=False, cleanafter=False)
basic_analysis()

Basic analysis of data.

METACODE

f. e. ObsID [there are different TOI_TP and TP-patterns]:
    f.e.CCD:
        f.e.Q:
            load raw 1D map of relative pumping (from extract_data)
            identify dipoles:
                x, rel-amplitude, orientation (E or W)

produce & report:
    map location of dipoles
    PDF of dipole amplitudes (for E and W)
    Counts of dipoles (and E vs. W)
build_scriptdict(diffvalues={}, elvis='7.5.X')
extract()

Obtain Maps of Serial Dipoles.

filterexposures(structure, explog, OBSID_lims)
inputsclass

alias of TP02_inputs

meta_analysis()

Meta-analysis of data:

Try to identify tau and pixel-phase location for each trap. Need to associate dipoles across TOI_TPs and TP-patterns

METACODE

across TOI_TP, patterns:
    build catalog of traps: x,y,R-phase, amp(dwell)
    from Amp(dwell) -> tau, Pc

Report on :
   Histogram of Taus
   Histogram of Pc (capture probability)
   Histogram of R-phases

   Total Count of Traps
prepare_images()

InjTask: Preparation of data for further analysis. Calls task.prepare_images().

Applies:

offset subtraction [bias structure subtraction, if available] cosmetics masking

set_inpdefaults(**kwargs)
class TP11(inputs, log=None, drill=False, debug=False, cleanafter=False)
class TP21(inputs, log=None, drill=False, debug=False, cleanafter=False)
dotask(taskname, inputs, drill=False, debug=False, cleanafter=False)

Generic test master function.

wait_and_run(dayfolder, elvis='7.5.X')

task.py

Generic Task (Test) Class.

Created on Tue Nov 14 14:20:04 2017

author

Ruyman Azzollini

class vison.pipe.task.Task(inputs, log=None, drill=False, debug=False, cleanafter=False)
IsComplianceMatrixOK(complidict)
addComplianceMatrix2Log(complidict, label='')
addComplianceMatrix2Report(complidict, label='', caption='')
addFigure2Report(figkey)
Adds a figure to the test report.
It serves as an interface to self.report.add_Figure()
addFigures_ST(dobuilddata=True, **kwargs)
Makes plots (self.doPlot) and adds them to the test
report (self.addFigure2Report).
addFlagsToLog()
addFlagsToReport()
addHKPlotsMatrix()

Adds to self.report a table-figure with HK [self.HKKeys] during test.

addHK_2_dd()
add_data_inventory_to_report(tDict)
add_inputs_to_report()
add_labels_to_explog(explog, structure)
build_scriptdict(diffvalues={}, elvis='7.5.X')
catchtraceback()
check_HK(HKKeys, reference='command', limits='P', tag='', doReport=False, doLog=True)
check_HK_ST()
check_data(**kwargs)

Generic check_data method

check_metrics_T()
check_stat_perCCD(arr, CCDlims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDQandCol(arr, lims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDandCol(arr, lims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDandQ(arr, CCDQlims, CCDs=['CCD1', 'CCD2', 'CCD3'])
cleanaux()
create_mockexplog(OBSID0=1000)
doPlot(figkey, **kwargs)
instantiates a figure object, configures it, and makes it
render to a hardcopy file.
filterexposures(structure, explog, OBSID_lims, colorblind=False, wavedkeys=[], surrogate='')

Loads a list of Exposure Logs and selects exposures from test ‘test’.

The filtering takes into account an expected structure for the acquisition script.

The datapath becomes another column in DataDict. This helps dealing with tests that run overnight and for which the input data is in several date-folders.

get_checkstats_T()

prepare_images(doExtract=True, doBadPixels=False, doMask=False, doOffset=False, doBias=False, doFF=False)
recover_progress(DataDictFile, reportobjFile)

Reloads dd and report from hardcopies generated by self.save_progress().

save_progress(DataDictFile, reportobjFile)

Saves self.dd and self.report to hardcopy files to save progress.

skipMissingPlot(key, ref)
class vison.pipe.task.Task(inputs, log=None, drill=False, debug=False, cleanafter=False)
IsComplianceMatrixOK(complidict)
addComplianceMatrix2Log(complidict, label='')
addComplianceMatrix2Report(complidict, label='', caption='')
addFigure2Report(figkey)
Adds a figure to the test report.
It serves as an interface to self.report.add_Figure()
addFigures_ST(dobuilddata=True, **kwargs)
Makes plots (self.doPlot) and adds them to the test
report (self.addFigure2Report).
addFlagsToLog()
addFlagsToReport()
addHKPlotsMatrix()

Adds to self.report a table-figure with HK [self.HKKeys] during test.

addHK_2_dd()
add_data_inventory_to_report(tDict)
add_inputs_to_report()
add_labels_to_explog(explog, structure)
build_scriptdict(diffvalues={}, elvis='7.5.X')
catchtraceback()
check_HK(HKKeys, reference='command', limits='P', tag='', doReport=False, doLog=True)
check_HK_ST()
check_data(**kwargs)

Generic check_data method

check_metrics_T()
check_stat_perCCD(arr, CCDlims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDQandCol(arr, lims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDandCol(arr, lims, CCDs=['CCD1', 'CCD2', 'CCD3'])
check_stat_perCCDandQ(arr, CCDQlims, CCDs=['CCD1', 'CCD2', 'CCD3'])
cleanaux()
create_mockexplog(OBSID0=1000)
doPlot(figkey, **kwargs)
instantiates a figure object, configures it, and makes it
render to a hardcopy file.
filterexposures(structure, explog, OBSID_lims, colorblind=False, wavedkeys=[], surrogate='')

Loads a list of Exposure Logs and selects exposures from test ‘test’.

The filtering takes into account an expected structure for the acquisition script.

The datapath becomes another column in DataDict. This helps dealing with tests that run overnight and for which the input data is in several date-folders.

get_checkstats_T()

prepare_images(doExtract=True, doBadPixels=False, doMask=False, doOffset=False, doBias=False, doFF=False)
recover_progress(DataDictFile, reportobjFile)

Reloads dd and report from hardcopies generated by self.save_progress().

save_progress(DataDictFile, reportobjFile)

Saves self.dd and self.report to hardcopy files to save progress.

skipMissingPlot(key, ref)