graphnet.utilities.filesys module

File system-related utility functions relevant to the graphnet package.

graphnet.utilities.filesys.is_gcd_file(filename)[source]

Check whether filename is a GCD file.

Return type:

bool

Parameters:

filename (str)

graphnet.utilities.filesys.is_i3_file(filename)[source]

Check whether filename is an I3 file.

Return type:

bool

Parameters:

filename (str)

graphnet.utilities.filesys.has_extension(filename, extensions)[source]

Check whether filename has one of the desired extensions.

Return type:

bool

Parameters:
  • filename (str)

  • extensions (List[str])

graphnet.utilities.filesys.find_i3_files(directories, gcd_rescue, recursive)[source]

Find I3 files and corresponding GCD files in directories.

Finds I3 files in dir and matches each file with a corresponding GCD file if present in the directory, matches with gcd_rescue if gcd is not present in the directory.

Parameters:
  • directories (Union[str, List[str]]) – Directories to search recursively for I3 files.

  • gcd_rescue (Optional[str], default: None) – Path to the GCD that will be default if no GCD is present in the directory.

  • recursive (Optional[bool], default: True) – Whether or not to search the directories recursively.

Returns:

Paths to I3 files in directories gcd_list: Paths to GCD files for each I3 file.

Return type:

i3_list