mkpy.events module

meta private

mkpy.events.build_dblock_df(dblocks_and_paths)[source]

Make a DataFrame from a subset of dblock columns.

mkpy.events.build_event_table(h5_fname, code_map, header_map_f)[source]

Construct an event table from the provided codemap and header map file.

Parameters
  • h5_fname (str) – HDF5 file name

  • code_map (pandas DataFrame) – DataFrame containing at least columns Index and regexp. The regexp column specifies regular expressions describing event code patterns.

  • header_map_f (str) – header map file name, to be replaced by DataFrame

Returns

event_table

Return type

pandas DataFrame

mkpy.events.build_header_df(dblocks_and_paths, header_map_f)[source]

Collect header ‘slicing’ data from given dblocks.

mkpy.events.build_match_df(dblocks_and_paths, code_map)[source]

Run pattern matcher on dblocks using codemap.

mkpy.events.find_evcodes(pattern, ticks, evcodes)[source]

Run a regular expression search on an array of event codes.

Parameters
  • pattern (str) – A regular expression pattern string containing exactly one anchor. For a detailed explanation of the format, see notes below.

  • ticks, evcodes (NumPy arrays) – Arrays of the same shape containing ticks and event codes of a single data block from positions with nonzero event codes. Although the last requirement is not mandatory, this is the intended use.

Returns

df – DataFrame describing matches for the pattern.

Return type

pandas DataFrame

mkpy.events.read_excel_codemap(file, sheet_name=0)[source]

Read Excel .xlsx file, return codemap pandas DataFrame.

mkpy.events.read_txt_codemap(file)[source]

Read tab-separated text file, return codemap pandas DataFrame.

mkpy.events.read_yaml_codemap(file)[source]

Read YAML file, return codemap pandas DataFrame.