mxsspec: fit mxs(Cr,Cu)+Mn55 spectrum to data

tesfdmtools.methods.mxsspec.findpeaks(x, y, debug=False, fitas=False, manfit=False, pltax=None)[source]

Find peaks in spectrum, and compute approximate energy scale

Args:
  • x = the x-values of the spectrum (arbitrary scale)

  • y = the y-values(counts) of the spectrum

Kwargs:
  • debug = when True show extra info for debugging

  • fitas = fit the Al and Si lines in the spectrum

  • manfit = manually fit the Al and Si lines

  • pltax = plot instance for the plot. If None, ouput to screen.

Returns:
  • escale = approximate energy scale

  • pindx = (sorted) index positions of lines used

  • epos = (sorted) energies of lines used

  • lfit = the lines used for the energy calibration

tesfdmtools.methods.mxsspec.fitlines(energy, spectrum, debug=False, lfit={'cr': [True, True], 'cu': [True, True], 'mn': [True, True]}, pltaxs=None, lindx=None, lenergy=None, fixbgain=False, optbins=None, npoly=None)[source]

Fit the separate lines in the spectrum, using a limited spectral width around each line.

Args:
  • energy = approximate energy scale

  • spectrum = the spectrum (counts)

Kwargs:
  • debug = print debug information when True

  • lfit = dictionary of lines to fit. [True,True] will fit both alpha and beta lines

  • pltaxs = dictionary of plot instances for line fit plots

  • lindx = (sorted) spectrum index of lines used for approximate energy scale

  • lenergy = (sorted) energies of lines used for approximate energy scale

  • fixbgain = when True set gain for beta line holzer fit to alpha gain fitted value

  • optbins = optimal fit amplitude scale (corresponds to energy )

  • npoly = degree of polynomial for energy scale. When None use exponential fit

Returns:

  • escale = fitted energy scale

  • afitpar = fitted parameters for alpha lines

tesfdmtools.methods.mxsspec.getpos(event)[source]

Get interactive mouse position

tesfdmtools.methods.mxsspec.mbasecorr(optfit, bins, escale, basls, debug=False, pltax=None, pdf=None, ptitle='')[source]

Compute baseline corrections as function of energy

Args:
  • optfit = optimal fit parameters of the events

  • bins = optimal fit bins of the spectrum

  • escale = energies for the bins

  • basls = eventlist containing the baselines of the events

Kwargs:
  • debug = when True, provide debug information

  • pltax = plotinstance for result plot

  • pdf = pdf file for pdf plot

  • ptitle = title for pdf plot

Returns:
  • tfit = linear fit of baseline-dependence as function of energy

  • avbaseline = average baseline value

tesfdmtools.methods.mxsspec.pixinfo(hdf, channel, freq)[source]

Return pixel info

Args:
  • hdf = HDF instrance of the hdf data

  • channel = selected FDM channel

  • freq = select frequency (pixel)

Returns:
  • fid = pixel info

tesfdmtools.methods.mxsspec.pixpars(hdf, channel, freq, spectrum)[source]

Make dictionary with pixel info

Args:
  • hdf = HDF instrance of the hdf data

  • channel = selected FDM channel

  • freq = select frequency (pixel)

  • spectrum = the events spectrum

Returns:
  • fitpars = dictionary with pixel parameters

tesfdmtools.methods.mxsspec.showescale(pltax, escale, pindx, epos, xx)[source]

Show plot of energy scale fit

Args:
  • pltax = plot instance for plot

  • escale = energy scale

  • pindx = fitted line index

  • epos = line positions

  • xx = bins for energy scale

tesfdmtools.methods.mxsspec.showtilts(pltax, tpar)[source]

Show plot of baseline correlaion results

Args:
  • tpar = tilt correlation parameters

  • pltax = plotinstance for plot