ctlearn package

Submodules

ctlearn.data_loader module

class ctlearn.data_loader.KerasBatchGenerator(DL1DataReaderDL1DH, indices, batch_size=64, mode='train', shuffle=True, concat_telescopes=False)[source]

Bases: keras.utils.data_utils.Sequence

Generates batches for Keras application

on_epoch_end()[source]

Updates indexes after each epoch

ctlearn.output_handler module

ctlearn.output_handler.write_output(h5file, reader, indices, predictions, tasks, prediction_label='prediction')[source]

ctlearn.run_model module

ctlearn.run_model.main()[source]
ctlearn.run_model.run_model(config, mode='train', debug=False, log_to_file=False)[source]

ctlearn.utils module

ctlearn.utils.load_from_module(name, module, path=None, args=None)[source]
ctlearn.utils.setup_DL1DataReader(config, mode)[source]
ctlearn.utils.setup_logging(config, log_dir, debug, log_to_file)[source]

ctlearn.version module

Get version identification from git.

The update_release_version() function writes the current version to the VERSION file. This function should be called before packaging a release version.

Use the get_version() function to get the version string, including the latest commit, from git. If git is not available the VERSION file will be read.

Heres an example of such a version string:

v0.2.0.post58+git57440dc

This script was taken from here: https://github.com/cta-observatory/ctapipe/blob/master/ctapipe/version.py

but the original code comes from here: https://github.com/aebrahim/python-git-version

Combining ideas from http://blogs.nopcode.org/brainstorm/2013/05/20/pragmatic-python-versioning-via-setuptools-and-git-tags/ and Python Versioneer https://github.com/warner/python-versioneer but being much more lightwheight

ctlearn.version.get_version(pep440=False)[source]

Tracks the version number.

pep440: bool

When True, this function returns a version string suitable for a release as defined by PEP 440. When False, the githash (if available) will be appended to the version string.

The file VERSION holds the version information. If this is not a git repository, then it is reasonable to assume that the version is not being incremented and the version returned will be the release version as read from the file.

However, if the script is located within an active git repository, git-describe is used to get the version information.

The file VERSION will need to be changed manually.

ctlearn.version.get_version_pypi(abbrev=4)[source]

Module contents