Generate PIPs

Functions

create_f_monomials

Generates a Python file containing JAX-compiled monomial functions.

create_f_polynomials

Generates a Python file containing JAX-compiled polynomial functions.

f_monomial_flag_0

Parses the indices for a monomial term from the input array.

msa_file_generator

Orchestrates the generation of both monomial and polynomial JAX files from MSA input.

molpipx.pip_generator.create_f_monomials(file_mono: str, file_label: str)[source]

Generates a Python file containing JAX-compiled monomial functions.

Reads a .MONO file provided by the MSA software and writes a corresponding Python script (monomials_{label}.py). :param file_mono: Path to the source .MONO file. :type file_mono: str :param file_label: Label used to suffix the output filename. :type file_label: str

molpipx.pip_generator.create_f_polynomials(file_poly: str, file_label: str, parents_path: str = '')[source]

Generates a Python file containing JAX-compiled polynomial functions.

Reads a .POLY file provided by the MSA software and writes a corresponding Python script (polynomials_{label}.py).

Parameters:
  • file_poly (str) – Path to the source .POLY file.

  • file_label (str) – Label used to suffix the output filename.

  • parents_path (str) – Dotted path to the parent package for import statements.

molpipx.pip_generator.f_monomial_flag_0(x)[source]

Parses the indices for a monomial term from the input array.

Helper function that processes a line from the MSA file to determine the indices involved in a monomial term.

Parameters:

x (np.ndarray) – Array of indices derived from the input file line.

Returns:

Returns an integer index if a single element is active, a list of indices if multiple are active, or -1 if none.

Return type:

int or list

molpipx.pip_generator.msa_file_generator(filename: str, path: str = './', label: str = None, parents_path: str = '')[source]

Orchestrates the generation of both monomial and polynomial JAX files from MSA input.

This is the main entry point for generating the python code. It checks for the existence of .MONO and .POLY files based on the filename and calls the creation functions.

Parameters:
  • filename (str) – The base name of the file (e.g., ‘MOL_1_3_4’).

  • path (str) – Directory containing the input files and where output will be saved.

  • label (str, optional) – Custom label for the output files. Defaults to filename.