TELF.factorization.utilities package#

Submodules#

TELF.factorization.utilities.organize_n_jobs module#

TELF.factorization.utilities.organize_n_jobs.organize_devices(n_jobs, device, use_gpu)[source]#
TELF.factorization.utilities.organize_n_jobs.organize_n_jobs(use_gpu, n_jobs)[source]#

TELF.factorization.utilities.plot_NMFk module#

TELF.factorization.utilities.plot_NMFk.plot_BNMFk(Ks, sils, bool_err, path=None, name=None)[source]#
TELF.factorization.utilities.plot_NMFk.plot_NMFk(data, k_predict, name, path, plot_predict=False, plot_final=False, simple_plot=False, calculate_error=True, Ks_not_computed=[])[source]#
TELF.factorization.utilities.plot_NMFk.plot_RESCALk(data, k_predict, name, path, plot_predict=False, plot_final=False, simple_plot=False, calculate_error=True)[source]#
TELF.factorization.utilities.plot_NMFk.plot_SymNMFk(data, name, path, plot_final=False)[source]#
TELF.factorization.utilities.plot_NMFk.plot_consensus_mat(C, figname)[source]#
TELF.factorization.utilities.plot_NMFk.plot_cophenetic_coeff(Ks, coeff, figname)[source]#

TELF.factorization.utilities.pvalue_analysis module#

TELF.factorization.utilities.pvalue_analysis.pvalue_analysis(errRegres, Ks, SILL_MIN, SILL_thr=0.9)[source]#
Parameters:
  • errRegres (TYPE) – DESCRIPTION.

  • Ks (TYPE) – DESCRIPTION.

  • SILL_MIN (TYPE) – DESCRIPTION.

  • SILL_thr (TYPE, optional) – DESCRIPTION. The default is 0.9.

Returns:

  • TYPE – DESCRIPTION.

  • TYPE – DESCRIPTION.

TELF.factorization.utilities.take_note module#

TELF.factorization.utilities.take_note.append_to_note(notes, path, lock, name='experiment')[source]#

Writes string from a list of strings called notes into a log file. Each string is separated with a newline character

This function is safe for use with multiple threads, processes (or nodes in a DFS application). Each write operation is protected by a file lock, ensuring that multiple threads or processes do not write to the file simultaneously.

Parameters:#

notes: list

A list of strings to enter on the

path: str

The directory path where the log file is located.

name: str, optional

The base name of the log and lock files. Default is “experiment”

rtype:

None

TELF.factorization.utilities.take_note.format_note(kwargs, spacing=16)[source]#

Formats the values from kwargs dictionary into a single string. The first element in kwargs is left aligned while the rest are right aligned. Each element is spaced according to the spacing parameter.

Parameters:#

kwargs: dict

The dictionary whose values are to be formatted.

spacing: int

The number of spaces between each element in the output string. Default is 16 (4 tabs)

Returns:#

str:

A string with the formatted values from the dictionary, followed by a newline.

TELF.factorization.utilities.take_note.take_note(notes, path, lock, name='experiment')[source]#

Writes key-value pairs from a dictionary into a log file in the format ‘key = value’. Each string is separated with a newline character

This function is safe for use with multiple threads, processes (or nodes in a DFS application). Each write operation is protected by a file lock, ensuring that multiple threads or processes do not write to the file simultaneously.

Parameters:#

notes: dict

Dictionary containing key-value pairs to be written to the log file.

path: str

The directory path where the log file is located.

name: str, optional

The base name of the log and lock files. Default is “experiment”

rtype:

None

TELF.factorization.utilities.take_note.take_note_fmat(path, lock, name='experiment', sort_index=0, spacing=16, **kwargs)[source]#

Records some stats into the log file in a formatted manner. These stats are the values stored in the kwargs dictionary. The keys signify the type of stat being recorded and the value is the entry into the log file. The first stat in kwargs is left aligned and the rest of the stats are right aligned. This function also takes care to sort the current batch of stats being recorded to the log file. The stats are sorted based on the value at index sort_index. This sorting is important as using multiple processes may cause the recorded stats to be out of order.

This function is safe for use with multiple threads, processes (or nodes in a DFS application). Each write operation is protected by a file lock, ensuring that multiple threads or processes do not write to the file simultaneously.

Parameters:#

path: str

The directory path where the log file is located.

name: str, optional

The base name of the log and lock files. Default is “experiment”

sort_index: int, optional

The index of the stat value on which to sort the stats

spacing: int, optional

The number of spaces between each element in the output string. Default is 16 (4 tabs)

kwargs: dict

The stats to record

rtype:

None

Module contents#