wfsim package

Submodules

wfsim.load_resource module

class wfsim.load_resource.DummyMap(const, shape=())[source]

Bases: object

Return constant results the length match the length of input but from the second dimensions the shape is user defined input

reduce_last_dim()[source]
class wfsim.load_resource.Resource(config=None)[source]

Bases: object

Get the configs needed for running WFSim. Configs can be obtained in

two ways: 1. Get it directly from the mongo database. This only needs the

name of the file.

  1. Load it with straxen get_resource, this can either:

    Download from a public repository Read from local cache Download from a private repository if credentials are properly setup

static config_to_file(config)[source]

Find and complete all file paths

returns dictionary mapping item name to path

static get_file_path(base, fname)[source]

Find the full path to the resource file Try 4 methods in the following order 1. The base is not url, return base + name 2. If ntauxfiles (straxauxfiles) is installed, return will be package dir + name

pip install won’t work, try python setup.py in the packages

  1. Download the latest version using straxen mongo downloader from database, return the cached file path + md5

  2. Download using straxen get_resource from the url (github raw) simply return base + name

    Be careful with the forth options, straxen creates cache files that might not be updated with the latest github commit.

wfsim.load_resource.load_config(config)[source]

Create a Resource instance from the configuration

Uses a cache to avoid re-creating instances from the same config

wfsim.load_resource.make_patternmap(map_file, fmt=None, method='WeightedNearestNeighbors', pmt_mask=None)[source]

This is special interpretation of the of previous make_map(), but designed for pattern map loading with provided PMT mask. This way simplifies both S1 and S2 cases

wfsim.pax_interface module

class wfsim.pax_interface.PaxEventSimulator(config=None)[source]

Bases: object

Simulate wf from instruction and stored in wfsim.pax_datastructure.datastructure.Event mimicing pax.datastructure.Event Then pickled, compressed and saved mimicing pax raw data zips.

Call compute to start the simulation process.

class WriteZipped(config)[source]

Bases: object

close_current_file()[source]

Closes the currently open file, if there is one. Also handles temporary file renaming.

file_extension = 'zip'
open_new_file(first_event_number)[source]

Opens a new file, closing any old open ones

write_event(event_proxy)[source]

Write one more event to the folder, opening/closing files as needed

class WriteZippedEncoder(config)[source]

Bases: object

static make_event_proxy(event, data, block_id=None)[source]
transfer_event(event)[source]
compute()[source]
class wfsim.pax_interface.PaxEvents(config)[source]

Bases: object

wfsim.strax_interface module

class wfsim.strax_interface.ChunkRawRecords(config, rawdata_generator=<class 'wfsim.core.rawdata.RawData'>, **kwargs)[source]

Bases: object

final_results()[source]
source_finished()[source]
class wfsim.strax_interface.RawRecordsFromFax1T[source]

Bases: RawRecordsFromFaxNT

provides: tuple = ('raw_records', 'truth')
class wfsim.strax_interface.RawRecordsFromFaxNT[source]

Bases: SimulatorPlugin

check_instructions()[source]
compute()[source]
data_kind: Union[str, immutabledict, dict] = immutabledict({'raw_records': 'raw_records', 'raw_records_he': 'raw_records_he', 'raw_records_aqmon': 'raw_records_aqmon', 'truth': 'truth'})
get_instructions()[source]
infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

provides: tuple = ('raw_records', 'raw_records_he', 'raw_records_aqmon', 'truth')
class wfsim.strax_interface.RawRecordsFromFaxOpticalNT[source]

Bases: RawRecordsFromFaxNT

get_instructions()[source]
class wfsim.strax_interface.RawRecordsFromFaxnVeto[source]

Bases: RawRecordsFromMcChain

data_kind: Union[str, immutabledict, dict] = immutabledict({'raw_records_nv': 'raw_records_nv', 'truth_nv': 'truth_nv'})
provides: tuple = ('raw_records_nv', 'truth_nv')
class wfsim.strax_interface.RawRecordsFromMcChain[source]

Bases: SimulatorPlugin

check_instructions()[source]
compute()[source]
data_kind: Union[str, immutabledict, dict] = immutabledict({'raw_records': 'raw_records', 'raw_records_he': 'raw_records_he', 'raw_records_aqmon': 'raw_records_aqmon', 'raw_records_nv': 'raw_records_nv', 'truth': 'truth', 'truth_nv': 'truth_nv'})
gain_model_nv

Dispatch on URL protocol.

unrecognized protocol returns identity inspired by dasks Dispatch and fsspec fs protocols.

get_instructions()[source]

Run epix and save instructions as self.instructions_epix epix_config with all the epix run arguments is passed as a dictionary, where source_rate must be set to 0 (epix default), since time handling is done outside epix.

epix needs to be imported in here to avoid circle imports

infer_dtype()[source]

Return dtype of computed data; used only if no dtype attribute defined.

provides: tuple = ('raw_records', 'raw_records_he', 'raw_records_aqmon', 'raw_records_nv', 'truth', 'truth_nv')
set_config()[source]
set_timing()[source]

Set timing information in such a way to synchronize instructions for the TPC and nVeto

source_finished()[source]

Return whether all instructions has been used.

takes_config = immutabledict({'gain_model_mc': <straxen.url_config.URLConfig object>, 'detector': <strax.config.Option object>, 'event_rate': <strax.config.Option object>, 'chunk_size': <strax.config.Option object>, 'n_chunk': <strax.config.Option object>, 'per_pmt_truth': <strax.config.Option object>, 'fax_file': <strax.config.Option object>, 'fax_config': <strax.config.Option object>, 'fax_config_override': <strax.config.Option object>, 'fax_config_override_from_cmt': <strax.config.Option object>, 'channel_map': <strax.config.Option object>, 'n_tpc_pmts': <strax.config.Option object>, 'n_top_pmts': <strax.config.Option object>, 'right_raw_extension': <strax.config.Option object>, 'seed': <strax.config.Option object>, 'gain_model_nv': <straxen.url_config.URLConfig object>, 'epix_config': <strax.config.Option object>, 'entry_start': <strax.config.Option object>, 'entry_stop': <strax.config.Option object>, 'fax_config_nveto': <strax.config.Option object>, 'fax_config_override_nveto': <strax.config.Option object>, 'targets': <strax.config.Option object>})
class wfsim.strax_interface.RawRecordsFromMcChain1T[source]

Bases: RawRecordsFromMcChain

data_kind: Union[str, immutabledict, dict] = immutabledict({'raw_records': 'raw_records', 'truth': 'truth'})
provides: tuple = ('raw_records', 'truth')
wfsim.strax_interface.extra_truth_dtype_per_pmt(n_pmt: bool | int) List[tuple][source]

Generate the extra - truth dtype output

Return total/bottom seperation from truth_extra_dtype if n_pmt is False

Parameters:

n_pmt – Number of PMTs, when false (no PMTs, use total/bottom separation)

Returns:

dtype list

wfsim.strax_interface.read_optical(config)[source]

Function will be executed when wfsim in run in optical mode. This function expects c[‘fax_file’] to be a root file from optical mc :params config: wfsim configuration dict

wfsim.units module

Define unit system for pax (i.e., seconds, etc.) This sets up variables for the various unit abbreviations, ensuring we always have a ‘consistent’ unit system. There are almost no cases that you should change this without talking with a maintainer.

wfsim.utils module

wfsim.utils.find_intervals_below_threshold(w, threshold, holdoff, result_buffer)[source]

Fills result_buffer with l, r bounds of intervals in w < threshold. :param w: Waveform to do hitfinding in :param threshold: Threshold for including an interval :param holdoff: Holdoff number of samples after the pulse return back down to threshold :param result_buffer: numpy N*2 array of ints, will be filled by function.

if more than N intervals are found, none past the first N will be processed.

:returns : number of intervals processed Boundary indices are inclusive, i.e. the right boundary is the last index which was < threshold

wfsim.utils.optical_adjustment(instructions, timings, channels)[source]

Helper function to process optical instructions so that for each entry 1) Move the instruction timing to the first photon in the entry and move photon timings 2) Split photon timing into maximum interval of PULSE_MAX_DURATION default 1us

The split photon are put into new instruction append at the end of the instructions

Module contents