PICOcode.AnalysisModules.run_modules package

Submodules

PICOcode.AnalysisModules.run_modules.XYZlookup module

ApplyPerspectiveTransform(_horiO, _vertO, pMatrix)

Applies the perspective transform generated by PICOJarTracker.

Adapted for python from “applyJarMotion.cpp” in XYZFixL2.

BubbleFinder(closest_approach, distance, which_lines, bubcam, numcams, bubframe, logname=None)

Filter the 3D positions from LocateNearestPass and determine nbub.

The closest approach and distance are used to determine which positions are the same bubble; the average position from all cameras which saw the same bubble is used as the final position. The number of bubbles is then tallied.

Parameters:
closest_approach, distance, which_linesarray of float

Output from LocateNearestPass (with default values of -999 removed).

bubcamarray of int

The camera in the abub/getbub file from which the rays were generated.

numcamsint

Number of cameras in the detector.

bubframearray of int

The frame number in the abub/getbub file from which the rays were generated.

Returns:
positionarray of float

3D position of all bubbles found in the detector. The position is averaged from all cameras which saw the same bubble.

getbub_linesarray of int

Which lines in the abub/getbub file were used to generate the rays from the LUT.

getbub_successint

Indicates whether all lines in the abub/getbub file were used to reconstruct a bubble. 0 = not all lines used, 1 = all lines used.

cams_usedarray of int

Which cameras were used to calculate the position.

Notes

The cams_used array does not indicate which camera pairs were used to calculate the position. There may be some events which appear to have confusing output in the final file. E.g. camera 0 and 1 may be used to find the position of a bubble in one location, but the same coordinates from cam 0 and 1 may appear for a bubble in a “different” location. This means that cam 0 was used in combination with either of cams 2 or 3 to calculate this separate position, and the same for cam 1.

LocateNearestPass(startpoints, directions, logname=None)

Calculates the closest approach between sets of rays from the LUT.

The rays from the LUT (one ray per line in abub/getbub output) are compared to each other to determine the point in 3D at which they are closest, and the distance between the rays at that point. Note that this function does not care which camera the ray is from, so the closest approach for hits in the same camera are computed here but discarded later.

Parameters:
startpointsarray of float

The initial point of the ray within the jar. Found in the LUT. Dimension is (nhit, 3).

directionsarray of float

The direction in which the ray points from the starting point. The LUT data has initial points and final points, so the directions are found via startpoint - endpoint.

lognameNone or str, default: None

Name of the log to inherit from. If None, no logging occurs.

Returns:
closest_approacharray of float

Position of the closest approach between the two rays indicated by the which_lines array. Dimensions are (0.5 * nhit * (nhit - 1) + 1, 3).

distancearray of float

Distance between the two rays indicated by the which_lines argument, at the point indicated by closest_approach. Dimension is 0.5 * nhit * (nhit - 1) + 1.

costhetaarray of float

The cosine of the angle between the two rays. Same dimensions as distance.

which_linesarray of int

The lines from abub/getbub used to generate the ray. This is used in BubbleFinder to determine the cameras used. Dimensions are (0.5 * nhit * (nhit - 1) + 1, 2).

XYZlookup(abub_filename, output_directory, LUT_filename, logname=None, run='', glasses_filename='')

Convert the 2D pixel coords into the 3D coords using a lookup table.

The output from AutoBub3hs (or getbub) are converted from sets of 2D pixel coordinates to 3D positions using a lookup table (LUT) generated using raytracing.

Parameters:
abub_filenamestr

Full path to the output from AutoBub3hs.

output_directorystr

Path to the directory in which the output will be saved. The full path of the output file is output_directory/xyz_L1.txt (or output_directory/xyz_L1_run.txt if the run argument is provided).

LUT_filenamestr

Full path to the location of the lookup table.

lognameNone or str, default=None

Name of the log set up with the setup_logger(). Default is None, which skips logging.

runstr, optional

If processing a single run of data, the output file will have the run ID appended to conform to the format of the output in single run directories. Default is an empty string, which implies multiple runs in the source file.

glasses_filenamestr, optional

Path to the PICOJarTracker output file for this run or runs. If no file is specified, the jar/camera movement corrections are not applied.

Returns:
None

PICOcode.AnalysisModules.run_modules.run_level_processing_01l_21 module

convert_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge abub output into a format usable by EventDisplay

This should only be used temporarily, eventually this won’t be necessary as the functionality is merged into 3D reconstruction.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
rename_bbub_to_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Rename bbub output to abub3hs file name.

For use in the case of using faster processing, when only using bbub. If the abub file exists, does not overwrite.

run_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Find bubble positions in a run using AutoBub3hs.

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_jar_tracker(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Run P60JarTracker to correct for jar movement

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt.

This function merges all files in the output directory with recon type 1 or 2. Should be run after run_xyz_l1() so that the level 1 position reconstruction can be passed to XYZFixL2 in run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt

This function merges the merged file from run_merge() with the position reconstruction from XYZFixL2. Should be run after run_xyz_l2().

Note that currently the only thing this does is rename the file from run_merge() to merged_all_all.txt since XYZFixL2 output is not currently compatible with the output from XYZlookup (the latter predicts too many bubbles far too often, and XYZFixL2 only runs on data with nbub=1).

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_root_conversion(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert merged and abub files to ROOT format.

The ROOT files are required for XYZFixL2, so this should be run before run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_xyz_l1(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZlookup.

XYZlookup is an older method of 3D reconstruction developed by Dan Baxter.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None

See also

PICOcode.AnalysisModules.XYZlookup.XYZlookup
run_xyz_l2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZFixL2.

XYZFixL2 is a C++ program that must be called from the command line. Subprocess is used to do this. XYZFixL2 requires output from AutoBub3hs, as well as the merged file with level one position reconstruction, both in ROOT format.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
tar_fast_plots(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

PICOcode.AnalysisModules.run_modules.run_level_processing_40l_19 module

convert_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge abub output into a format usable by EventDisplay

This should only be used temporarily, eventually this won’t be necessary as the functionality is merged into 3D reconstruction.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
rename_bbub_to_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Rename bbub output to abub3hs file name.

For use in the case of using faster processing, when only using bbub. If the abub file exists, does not overwrite.

run_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Find bubble positions in a run using AutoBub3hs.

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_jar_tracker(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Run P60JarTracker to correct for jar movement

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt.

This function merges all files in the output directory with recon type 1 or 2. Should be run after run_xyz_l1() so that the level 1 position reconstruction can be passed to XYZFixL2 in run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt

This function merges the merged file from run_merge() with the position reconstruction from XYZFixL2. Should be run after run_xyz_l2().

Note that currently the only thing this does is rename the file from run_merge() to merged_all_all.txt since XYZFixL2 output is not currently compatible with the output from XYZlookup (the latter predicts too many bubbles far too often, and XYZFixL2 only runs on data with nbub=1).

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_root_conversion(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert merged and abub files to ROOT format.

The ROOT files are required for XYZFixL2, so this should be run before run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_xyz_l1(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZlookup.

XYZlookup is an older method of 3D reconstruction developed by Dan Baxter.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None

See also

PICOcode.AnalysisModules.XYZlookup.XYZlookup
run_xyz_l2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZFixL2.

XYZFixL2 is a C++ program that must be called from the command line. Subprocess is used to do this. XYZFixL2 requires output from AutoBub3hs, as well as the merged file with level one position reconstruction, both in ROOT format.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-19”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
tar_fast_plots(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

PICOcode.AnalysisModules.run_modules.run_level_processing_40l_22 module

convert_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge abub output into a format usable by EventDisplay

This should only be used temporarily, eventually this won’t be necessary as the functionality is merged into 3D reconstruction.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
rename_bbub_to_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Rename bbub output to abub3hs file name.

For use in the case of using faster processing, when only using bbub. If the abub file exists, does not overwrite.

run_abub(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Find bubble positions in a run using AutoBub3hs.

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_jar_tracker(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Run P60JarTracker to correct for jar movement

AutoBub3hs is a C++ program that must be called from the command line. Subprocess is used to do this.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt.

This function merges all files in the output directory with recon type 1 or 2. Should be run after run_xyz_l1() so that the level 1 position reconstruction can be passed to XYZFixL2 in run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_merge2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Merge the recon files for a run into merged_<run>.txt

This function merges the merged file from run_merge() with the position reconstruction from XYZFixL2. Should be run after run_xyz_l2().

Note that currently the only thing this does is rename the file from run_merge() to merged_all_all.txt since XYZFixL2 output is not currently compatible with the output from XYZlookup (the latter predicts too many bubbles far too often, and XYZFixL2 only runs on data with nbub=1).

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_root_conversion(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert merged and abub files to ROOT format.

The ROOT files are required for XYZFixL2, so this should be run before run_xyz_l2().

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
run_xyz_l1(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZlookup.

XYZlookup is an older method of 3D reconstruction developed by Dan Baxter.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None

See also

PICOcode.AnalysisModules.XYZlookup.XYZlookup
run_xyz_l2(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Convert abub pixel coordinates to 3D data using XYZFixL2.

XYZFixL2 is a C++ program that must be called from the command line. Subprocess is used to do this. XYZFixL2 requires output from AutoBub3hs, as well as the merged file with level one position reconstruction, both in ROOT format.

Parameters:
runstr

Name of the run in question. Format is something like “20200928_0”.

data_dir, output_dir, log_dirstr

Directories which contain the data, or are targeted for output and logging, respectively.

data_seriesstr

The name of the data series. Will be something like “30l-16” or “40l-22”.

outfile_prefixstr

Naming convention for the output file. The run ID will be appended to this, so the file will be called <outfile_prefix>_<run>.txt.

Returns:
None
tar_fast_plots(run, data_dir, output_dir, log_dir, data_series, outfile_prefix)

Module contents