reboost.optmap package

Submodules

reboost.optmap.__main__ module

reboost.optmap.cli module

reboost.optmap.cli.optical_cli()
Return type:

None

reboost.optmap.convolve module

class reboost.optmap.convolve.OptmapForConvolve(dets, detidx, edges, weights)

Bases: NamedTuple

A loaded optmap for convolving.

Create new instance of OptmapForConvolve(dets, detidx, edges, weights)

Parameters:
  • dets (NDArray)

  • detidx (NDArray)

  • edges (tuple)

  • weights (NDArray)

_asdict()

Return a new dict which maps field names to their values.

_field_defaults = {}
_fields = ('dets', 'detidx', 'edges', 'weights')
classmethod _make(iterable)

Make a new OptmapForConvolve object from a sequence or iterable

_replace(**kwds)

Return a new OptmapForConvolve object replacing specified fields with new values

detidx: NDArray

Alias for field number 1

dets: NDArray

Alias for field number 0

edges: tuple

Alias for field number 2

weights: NDArray

Alias for field number 3

reboost.optmap.convolve._get_scint_params(material)
Parameters:

material (Literal['lar', 'pen', 'fiber'] | tuple[~pygeomoptics.scintillate.ScintConfig, tuple[~pint.registry.Quantity, ...]])

reboost.optmap.convolve._iterate_stepwise_depositions_numdet(edep_hits, rng, detidx, map_scaling, map_scaling_sigma, optmap_edges, optmap_weights, output_length, max_pes_per_hit=-1)
Parameters:
  • detidx (int)

  • map_scaling (float)

  • map_scaling_sigma (float)

  • output_length (int)

  • max_pes_per_hit (int)

reboost.optmap.convolve._iterate_stepwise_depositions_pois(edep_hits, rng, detidx, map_scaling, map_scaling_sigma, optmap_edges, optmap_weights, scint_mat_params)
Parameters:
  • detidx (int)

  • map_scaling (float)

  • map_scaling_sigma (float)

  • scint_mat_params (ComputedScintParams)

reboost.optmap.convolve._iterate_stepwise_depositions_scintillate(edep_hits, rng, scint_mat_params, mode, output_length)
Parameters:
  • scint_mat_params (ComputedScintParams)

  • mode (str)

  • output_length (int)

reboost.optmap.convolve._iterate_stepwise_depositions_times(edep_hits, rng, scint_mat_params, output_length)
Parameters:
  • scint_mat_params (ComputedScintParams)

  • output_length (int)

reboost.optmap.convolve._pdgid_to_particle(pdgid)
Parameters:

pdgid (int)

Return type:

ParticleIndex

reboost.optmap.convolve._warn_deposition_stats(res)
Parameters:

res (dict)

Return type:

None

reboost.optmap.convolve.iterate_stepwise_depositions_numdet(edep_hits, optmap, det, map_scaling=1, map_scaling_sigma=0, max_pes_per_hit=-1, rng=None)
Parameters:
Return type:

Array | tuple[Array, TypeAliasForwardRef(‘NDArray’)]

reboost.optmap.convolve.iterate_stepwise_depositions_pois(edep_hits, optmap, scint_mat_params, det, map_scaling=1, map_scaling_sigma=0, rng=None)
Parameters:
reboost.optmap.convolve.iterate_stepwise_depositions_scintillate(edep_hits, scint_mat_params, rng=None, mode='no-fano')
Parameters:
  • edep_hits (Array)

  • scint_mat_params (ComputedScintParams)

  • rng (Generator | None)

  • mode (str)

reboost.optmap.convolve.iterate_stepwise_depositions_times(edep_hits, scint_mat_params, rng=None)
Parameters:
  • edep_hits (Array)

  • scint_mat_params (ComputedScintParams)

  • rng (Generator | None)

reboost.optmap.convolve.open_optmap(optmap_fn)
Parameters:

optmap_fn (str)

Return type:

OptmapForConvolve

reboost.optmap.convolve.open_optmap_single(optmap_fn, spm_det)
Parameters:
  • optmap_fn (str)

  • spm_det (str)

Return type:

OptmapForConvolve

reboost.optmap.create module

reboost.optmap.create._compute_hit_maps(hitcounts, optmap_count, ch_idx_to_optmap)
reboost.optmap.create._create_optical_maps_chunk(optmap_events_fn, buffer_len, all_det_ids, optmaps, ch_idx_to_map_idx)
Return type:

bool

reboost.optmap.create._create_optical_maps_process(optmap_events_fn, buffer_len, all_det_ids, ch_idx_to_map_idx)
Return type:

bool

reboost.optmap.create._create_optical_maps_process_init(optmaps, log_level)
Return type:

None

reboost.optmap.create._fill_hit_maps(optmaps, loc, hitcounts, ch_idx_to_map_idx)
Parameters:
reboost.optmap.create._merge_optical_maps_process(d, map_l5_files, output_lh5_fn, settings, check_after_create=False, write_part_file=False)
Parameters:
Return type:

str

reboost.optmap.create._optmaps_for_channels(all_det_ids, settings, chfilter=(), use_shmem=False)
Parameters:
reboost.optmap.create.check_optical_map(map_l5_file)

Run a health check on the map file.

This checks for consistency, and outputs details on map statistics.

Parameters:

map_l5_file (str)

reboost.optmap.create.create_optical_maps(optmap_events_fn, settings, buffer_len=5000000, chfilter=(), output_lh5_fn=None, after_save=None, check_after_create=False, n_procs=1, geom_fn=None)

Create optical maps.

Parameters:
  • optmap_events_fn (list[str]) – list of filenames to lh5 files, that can either be stp files from remage or “optmap-evt” files with a table /optmap_evt with columns {x,y,z}loc and one column (with numeric header) for each SiPM channel.

  • chfilter (tuple[str | int, ...] | Literal['*']) – tuple of detector ids that will be included in the resulting optmap. Those have to match the column names in optmap_events_fn.

  • n_procs (int | None) – number of processors, 1 for sequential mode, or None to use all processors.

  • buffer_len (int)

  • output_lh5_fn (str | None)

  • after_save (Callable[[int, str, OpticalMap], None] | None)

  • check_after_create (bool)

  • geom_fn (str | None)

Return type:

None

reboost.optmap.create.list_optical_maps(lh5_file)
Parameters:

lh5_file (str)

Return type:

list[str]

reboost.optmap.create.merge_optical_maps(map_l5_files, output_lh5_fn, settings, check_after_create=False, n_procs=1)

Merge optical maps from multiple files.

Parameters:
  • n_procs (int | None) – number of processors, 1 for sequential mode, or None to use all processors.

  • map_l5_files (list[str])

  • output_lh5_fn (str)

  • check_after_create (bool)

Return type:

None

reboost.optmap.create.rebin_optical_maps(map_l5_file, output_lh5_file, factor)

Rebin the optical map by an integral factor.

Note

the factor has to divide the bincounts on all axes.

Parameters:
  • map_l5_file (str)

  • output_lh5_file (str)

  • factor (int)

reboost.optmap.evt module

reboost.optmap.evt.generate_optmap_evt(lh5_in_file, detectors, buffer_len=5000000)

Create a faster map for lookup of the hits in each detector, for each primary event.

Parameters:
Return type:

Generator[Table, None, None]

reboost.optmap.evt.get_optical_detectors_from_geom(geom_fn)
Return type:

dict[int, str]

reboost.optmap.evt.read_optmap_evt(lh5_file, buffer_len=5000000)
Parameters:
  • lh5_file (str)

  • buffer_len (int)

Return type:

LH5Iterator

reboost.optmap.mapview module

reboost.optmap.mapview._channel_selector(fig)
Return type:

None

reboost.optmap.mapview._get_weights(viewdata)
Parameters:

viewdata (dict)

reboost.optmap.mapview._prepare_data(optmap_fn, divide_fn=None, cmap_min=0.0001, cmap_max=0.01, histogram_choice='prob', detid='all')
Parameters:
Return type:

tuple[tuple[TypeAliasForwardRef(‘NDArray’)], TypeAliasForwardRef(‘NDArray’), float | Literal[‘auto’], float | ~typing.Literal[‘auto’]]

reboost.optmap.mapview._process_key(event)
Return type:

None

reboost.optmap.mapview._read_data(optmap_fn, detid='all', histogram_choice='prob')
Parameters:
  • optmap_fn (str)

  • detid (str)

  • histogram_choice (str)

Return type:

tuple[tuple[TypeAliasForwardRef(‘NDArray’)], TypeAliasForwardRef(‘NDArray’)]

reboost.optmap.mapview._slice_text(viewdata)
Parameters:

viewdata (dict)

Return type:

str

reboost.optmap.mapview._update_figure(fig)
Return type:

None

reboost.optmap.mapview.view_optmap(optmap_fn, detid='all', divide_fn=None, start_axis=2, cmap_min=0.0001, cmap_max=0.01, histogram_choice='prob', title=None)
Parameters:
Return type:

None

reboost.optmap.numba_pdg module

reboost.optmap.numba_pdg.numba_pdgid_funcs()

Load a numby-optimized copy of the scikit-hep/particle package.

reboost.optmap.optmap module

class reboost.optmap.optmap.OpticalMap(name, settings, use_shmem=False)

Bases: object

Parameters:
  • name (str)

  • settings (Mapping[str, Any] | None)

  • use_shmem (bool)

_divide_hist(h1, h2)

Calculate the ratio (and its standard error) from two histograms.

Parameters:
  • h1 (NDArray)

  • h2 (NDArray)

Return type:

tuple[ndarray[tuple[Any, …], dtype[_ScalarT]] | SynchronizedArray, ndarray[tuple[Any, …], dtype[_ScalarT]] | SynchronizedArray]

static _edges_eq(e1, e2)

Compare edge-tuples for two histograms.

Parameters:
Return type:

bool

_fill_histogram(h, xyz, for_hits=False)
Parameters:
Return type:

None

_fill_histogram_buf(h, idx)
Parameters:
Return type:

None

_lock_nda(h)
Parameters:

h (ndarray[tuple[Any, ...], dtype[_ScalarT]] | SynchronizedArray)

_mp_preinit(mp_man, vertex)
Parameters:
  • mp_man (BaseContext)

  • vertex (bool)

Return type:

None

_nda(h)
Parameters:

h (ndarray[tuple[Any, ...], dtype[_ScalarT]] | SynchronizedArray)

Return type:

NDArray

_prepare_hist()

Prepare an empty histogram with the parameters global to this map instance.

Return type:

ndarray[tuple[Any, …], dtype[_ScalarT]] | SynchronizedArray

check_histograms(include_prefix=False)
Parameters:

include_prefix (bool)

Return type:

None

static create_empty(name, settings)
Parameters:
Return type:

OpticalMap

create_probability()

Compute probability map (and map uncertainty) from vertex and hit map.

Return type:

None

fill_hits(loc)

Fill map with a chunk of hit coordinates.

Note

For performance reasons, this function is buffered and does not directly write to the map array. Use fill_hits_flush() to flush the remaining hits in the buffer to this map.

Parameters:

loc (NDArray)

Return type:

None

fill_hits_flush()

Commit all remaining hit coordinates in the buffer.

Return type:

None

fill_vertex(loc)

Fill map with a chunk of hit coordinates.

Parameters:

loc (NDArray)

Return type:

None

get_settings()

Get the binning settings that were used to create this optical map instance.

Return type:

Mapping[str, Any] | dict

static load_from_file(lh5_file, group)
Parameters:
Return type:

OpticalMap

write_lh5(lh5_file, group='all', wo_mode='write_safe')

Write this map to a LH5 file.

Parameters:
Return type:

None