HDF_Cutils : Algorithms used for crosstalk analysis

tesfdmtools.methods.HDF_Cutils.cplot(tff, data, xax, xtitle, ytitle, titles, ps=None, filename='hdf5', num='0', xrange=(0, 0), qdata=None, qtitle='', dlabel=None, qlabel=None, dbckgr=None, qbckgr=None, ptitle=None)[source]

make plot (on screen, or postscript file) of the data. For the given pixel, plot its average pulse and the average signals at the same time of all other pixels when those do not have a pulse of their own. Plot I-signals in blue (black labels) and Q-signals in red.

Args:
  • tff = array of frequencies (pixel numbers) for the pixels of the data

  • data = 2dim array with I-signal averages for each pixel

  • xax = array with x-values for a data record

  • xtitle = x-axis title for plots

  • ytitle = y-axis title for I-signal data

  • titles = titles for plots

Kwargs:
  • ps = if not None, hardcopy plots on pdf file

  • filename = name of file which is being processed

  • ( num not used )

  • xrange = x-range of data to plot. (0,0) plot entire range

  • qdata = 2dim array with Q-signal averages for each pixel

  • qtitle = y-axis title for Q data

  • dlabel = I-signal label

  • qlabel = Q-signal label

  • dbckgr = I-signal background data

  • qbckgr = Q-signal background data

  • ptitle = title for plot page

return:

none

tesfdmtools.methods.HDF_Cutils.cprint(txtname, tff, freqs, xax, idata, qdata, xrange=(0, 0), filename='Hdf5')[source]

print basic averaged crosstalk records data to file

Args:
  • txtname = name of file for text file

  • tff = list of frequencies (pixel numbers) for pixels

  • freqs = list of real frequencies (kHz)

  • xax = sample x-axis

  • idata = I-data array

  • qdata = Q-data array

Kwargs:
  • xrange = x-range of data to plot. (0,0) plot entire range

  • filename = name of file to open and write

tesfdmtools.methods.HDF_Cutils.crossdata(cfile, channel, frequency, nrecs, threshold, ppos=False, prange=[- 200, 2000], rotate=True, debug=False)[source]

get crosstalk signals by finding records with pulse for selected frequency(pixel) at which the other pixels do not have an X-ray pulse

Args:
  • cfile = HDF5 file object

  • channel = channel to process

  • frequency = frequency to process

  • nrecs = if a number, number of records to process. Otherwise process all records

  • threshold = only consider records in which maximum-minimum is larger than the given threshold

Kwargs:
  • ppos = when True assume all pulses on same position (triggered data)

  • prange = range in samples around pulse to take into acount

  • rotate = rotate pulse in I/Q plane to compensate for average (based on 50 pulses) rotation

  • debug = print/plot extra debug info when True

Returns:
  • tff = array of frequencies (pixel numbers) for pixels

  • pfreqs = corresponding real frequencies (kHz) for pixels

  • adata = I-signal averages (true pulse for selected pixel and the no-pulse signals for the other pixels)

  • aqdata = Q-signal averages

  • nproc = number of records used for the averages

  • apulse = average of I-signal pulses for other pixels which do contain a proper pulse

tesfdmtools.methods.HDF_Cutils.pixelmap(ax, data, pixelax, title='', fig=None, ypixelax=None)[source]

Plot matrix values in falsecolor plot

Args:
  • ax = plot instance for plotting

  • data = matrix with the data

  • pixelax = array with matrix coordinates

Kwargs:
  • title = title for plot

  • fig = figure instance for colorbar

  • ypixelax = array with matrix y-coordinates

tesfdmtools.methods.HDF_Cutils.singlepulse(pulse, bl=10, fr=0.3, dc=50)[source]

see if pulse is single pulse

Args:
  • pulse = array with pulse data

Kwargs:
  • bl = number of bins from begin and end to compute baseline

  • fr = fraction of pulse height on which to search for double peaks

  • dc = max distance in bins, still seen as continuous (no double peak)

Returns:
  • True when single peak, otherwise False

tesfdmtools.methods.HDF_Cutils.surface(xx, yy, weights=None, range=None)[source]

find surface of pulse: - fit the offset level - subtract the offset level from the pulse and integrate

Args:
  • xx = x-values of pulse record

  • yy = y-values (data) of pulse

Kwargs:
  • weights = weight values for each data point

  • range = range to consider within pulse record

Returns:
  • surf = surface of pulse minus background

  • fit = fitted background signal (linear fit)