Input/Output (io)

Introduction

lstchain.io contains functions and containers to read and write LST data. Also important for the data reading is the ctapipe_io_lst library, that contains the event source to read LST data.

Reference/API

lstchain.io.config Module

Functions

get_cleaning_parameters(config, ...)

Return cleaning parameters from configuration dict.

get_standard_config()

Load the standard config from the file 'data/lstchain_standard_config.json'

get_srcdep_config()

Load the config for source-dependent analysis from the file 'data/lstchain_src_dep_config.json'

read_configuration_file(config_filename)

Read a configuration filename for the lstchain.

replace_config(base_config, new_config)

Return a copy of the base_config with new configuration from new_config

lstchain.io.data_management Module

Functions

check_and_make_dir(dir)

Check if a directory exists or contains data before to makedir.

check_data_path(data_path)

Check if the path to some data exists.

check_job_logs(job_logs_dir)

Check all the job logs named *.e for Errors Query the user to continue or not in case of errors.

get_input_filelist(data_path)

Return list of files in data_path

query_continue(question[, default])

Ask a question and if the answer is no, exit the program.

query_yes_no(question[, default])

Ask a yes/no question via raw_input() and return their answer.

lstchain.io.event_selection Module

Classes

EventSelector(**kwargs)

Filter values used for event filters and list of finite parameters are taken as inputs and filter_events() is used on a table of events called in with the Component.

DL3Cuts(**kwargs)

Selection cuts for DL2 to DL3 conversion

DataBinning(**kwargs)

Collects information on generating energy and angular bins for generating IRFs as per pyIRF requirements.

lstchain.io.io Module

Functions

add_column_table(table, ColClass, col_label, ...)

Add a column to an pytable Table

add_config_metadata(container, configuration)

Add configuration parameters to a container in container.meta.config

add_global_metadata(container, metadata)

Add global metadata to a container in container.meta

add_source_filenames(h5file, file_list)

auto_merge_h5files(file_list[, ...])

Automatic merge of HDF5 files.

check_mcheader(mcheader1, mcheader2)

Check that the information in two mcheaders are physically consistent.

check_metadata(metadata1, metadata2)

Check that to MetaData class are compatible with each other

check_mc_type(filename)

Check MC type ('point_like', 'diffuse', 'ring_wobble') based on the viewcone setting Parameters ---------- filename:path (DL1/DL2 hdf file) Returns ------- string

check_thrown_events_histogram(...)

Check that two ThrownEventsHistogram class are compatible with each other

copy_h5_nodes(from_file, to_file[, nodes])

Copy dataset (Table and Array) nodes from from_file to to_file.

extract_simulation_nsb(filename)

Get current run NSB from configuration in simtel file.

extract_observation_time(t_df)

Calculate observation time

get_dataset_keys(h5file)

Return a list of all dataset keys in a HDF5 file

get_mc_fov_offset(filename)

Calculate the mean field of view offset (the "wobble-distance") from the simulation info.

get_srcdep_assumed_positions(filename)

get assumed positions of source-dependent multi index columns

get_srcdep_params(filename[, wobble_angles])

get srcdep parameter data frame

get_stacked_table(filenames_list, node)

Stack tables at node from each file in files

global_metadata()

Get global metadata container

merge_dl2_runs(data_tag, runs[, ...])

Merge the run sequence in a single dataset and extract correct observation time based on first and last event timestamp in each file.

merging_check(file_list)

Check that a list of hdf5 files are compatible for merging regarding:

read_data_dl2_to_QTable(filename[, srcdep_pos])

Read data DL2 files from lstchain and return QTable format, along with a dict of target parameters for IRF interpolation

read_dl2_params(t_filename[, columns_to_read])

Read specified parameters from a file with DL2 data

read_mc_dl2_to_QTable(filename)

Read MC DL2 files from lstchain and convert into pyirf internal format - astropy.table.QTable.

read_metadata(filename)

Read metadata from a HDF5 file

read_simtel_energy_histogram(filename)

Read the simtel energy histogram from a HDF5 file.

read_simu_info_hdf5(filename)

Read simu info from an hdf5 file

read_simu_info_merged_hdf5(filename)

Read simu info from a merged hdf5 file.

recursive_copy_node(src_file, dir_file, path)

Copy a node recursively from a src file to a dir file without copying the tables/arrays in the node

remove_duplicated_events(data)

Remove duplicated events after gammaness/alpha cut when generating DL3 files.

stack_tables_h5files(filenames_list[, ...])

In theory similar to auto_merge_h5files but slower.

write_calibration_data(writer, mon_index, ...)

write_dataframe(dataframe, outfile, table_path)

Write a pandas dataframe to a HDF5 file using pytables formatting.

write_dl2_dataframe(dataframe, outfile[, ...])

Write DL2 dataframe to a HDF5 file

write_mcheader(mcheader, output_filename[, ...])

Write the mcheader from an event container to a HDF5 file

write_metadata(metadata, output_filename)

Write metadata to a HDF5 file

write_simtel_energy_histogram(source, ...[, ...])

Write the energy histogram from a simtel source to a HDF5 file

write_subarray_tables(writer, event[, metadata])

Write subarray tables info to a HDF5 file

get_resource_path(filename)

Get a resource data path in lstchain package

lstchain.io.lstcontainers Module

Functions to handle custom containers for the mono reconstruction of LST1

Classes

DL1MonitoringEventIndexContainer([prefix])

Container with the calibration coefficients

DL1ParametersContainer([prefix])

TODO: maybe fields could be inherited from ctapipe containers definition

DL1LikelihoodParametersContainer([prefix])

Parameters obtained with the likelihood reconstruction method

DispContainer([prefix])

Disp vector container

ExtraImageInfo([prefix])

attach the tel_id

ExtraMCInfo([prefix])

ExtraMCInfo([prefix])

LSTEventType()

Class to recognize event type from trigger bits bit 0: Mono bit 1: stereo bit 2: Calibration bit 3: Single Phe bit 4: Softrig(from the UCTS) bit 5: Pedestal bit 6: slow control bit 7: busy

MetaData([prefix])

Some metadata

ThrownEventsHistogram([prefix])

2D histogram from SimTel files