sandp package

Submodules

sandp.event module

get event property

class sandp.event.Event(event_number, file_name, config)[source]

Bases: object

Event class stores all the properties of event

baseline()[source]

get information for baseline

boundary()[source]

get S1, S2 information, including

  • S1: list of list of left and right boundaries of S1
  • S2: list of list of left and right boundaries of S2
  • NbS1Peaks: number of S1 peaks
  • NbS2Peaks: number of S2 peaks
coincidence()[source]

S1s and S2s coincidence levels

get_config(cfg)[source]

help __init__ get properties from configuration file

get_positions()[source]

get xy position for event

main_s2_in_pmt()[source]

get main s2 size in each PMT

peak_width()[source]

get peak width and rise/drop time information

prepare_entropy()[source]

get entropy for s1 and s2 peaks

size()[source]

get s1 s2 size

  • S1sTot: list of S1 size, indexed by size
  • S2sTot: list of S2 size, indexed by size
  • S1s_Key: Keys for S1 to be ordered by size
  • S2s_Key: Keys for S2 to be ordered by size
uniformity()[source]

sandp.Alls2 module

For single electron analysis

sandp.Alls2.get_all_scalar(arr1, ndarr2)[source]

vectorize a scalar based on another vector

sandp.Alls2.get_all_vector(ndarr)[source]
sandp.Alls2.get_all_vector_as_scalar(ndarr)[source]

only select the first entry of a vector if it’s non-empty

sandp.Alls2.get_all_vector_by_other_vector(ndarr1, ndarr2)[source]

get vector as scalar based on another vector, and assign nan if that vector is empty

sandp.Alls2.get_max(ndarr)[source]
sandp.Alls2.load(input, processor='sandp_test')[source]

load data into all s2 format. Input can be either folder name or run number

sandp.Alls2.load_data(file)[source]
sandp.Alls2.to_new_df(data, amplifier=True)[source]

Make dataframe for all S2s. It provides:

  • run_number: number of the run
  • event_id: event number in the run
  • event_time: when event happened in unix time in seconds
  • x: x position of event in arbitrary unit (a.u.)
  • y: y position of event in a.u.
  • s2: s2 size, PE
  • main_s2: size of main s2 for the event where the s2 is, PE
  • s2_width_50: s2 width of 50 percent area in us
  • s2_width_90: s2 width of 90 percent area in us
  • s2_rise_time: s2 rise time in us
  • s2_drop_time: s2 drop time in us
  • s1: s1 size in PE
  • s1_time: center time of main s1 in us
  • s2_time: center time of s2 in us
  • main_s2_time: center time of main s2 in us
  • s2_delay_time: how long s2 is delayed after main s2, us

sandp.utils module

Convert root into pandas dataframe

sandp.utils.code_hider()[source]

Stolen from hax Make a button in the jupyter notebook to hide all code

sandp.utils.doc_s_to_run_info(doc_s, version_name)[source]

get info of run (file location, amplifier_on, run_number) based on doc after selection and processor version name

sandp.utils.folders_to_file_s(folder, processor)[source]

find files and amplifier conditions based on folder name(s). Return dictionary with keys of file_location and amplifier_on

sandp.utils.folders_to_path(folder, processor)[source]

find absolute path of each folder based on name of folder and processor version

sandp.utils.get_coll()[source]

get data collection info from mongodb

sandp.utils.get_datasets()[source]

get run info as pd dataframe

sandp.utils.get_file_from_path(path)[source]

get absolute path for files under certain path(s)

sandp.utils.get_processor_version_name(processor)[source]

get processor name from processor name. You may find it stupid, but ‘.’ is not supported in BSON for mongodb.. Plus we would like to send a reminder if name goes wrong… limited choices!

sandp.utils.judge_str(input)[source]
sandp.utils.load(input, processor='sandix_v1.1')[source]

load data into pd dataframe by run numbers, or folder name

sandp.utils.load_dataframe(filename, amplifier=10)[source]

convert ROOT file into dataframe format.

Parameters:filename – file name including the path
Return data:data in pandas dataframe format
sandp.utils.load_path(path, amplifier=10)[source]

Load all root files from specific path

sandp.utils.run_number_to_file_s(run_numbers, processor)[source]

find file path(s) and amplifier condition based on run numbers