pcntoolkit.normative#
Module providing entry points for fitting and predicting with normative models from the command line.
Functions#
|
|
|
Fit a new normative model. |
|
Fit a normative model and predict response variables. |
|
Get an argument parser for the normative modeling functions. |
|
Parse the arguments and return a dictionary with the configuration options. |
|
Load the data from the configuration dictionary. |
|
Load response variables from file. This will load the data and mask it if |
|
Load the test data from the file specified in the configuration dictionary. |
|
Main function to run the normative modeling functions. |
|
Create synthetic data for testing. |
|
Predict response variables using a saved normative model. |
Module Contents#
- entrypoint(*args)#
- fit(conf_dict: dict) None#
Fit a new normative model.
- Parameters:
conf_dict – Dictionary containing configuration options
- fit_predict(conf_dict: dict) None#
Fit a normative model and predict response variables.
- Parameters:
conf_dict – Dictionary containing configuration options
- get_argparser() argparse.ArgumentParser#
Get an argument parser for the normative modeling functions.
- Returns:
argparse.ArgumentParser: The argument parser
- get_conf_dict_from_args() dict[str, str | int | float | bool]#
Parse the arguments and return a dictionary with the configuration options.
- Raises:
ValueError: Raised if an argument is specified twice.
- Returns:
dict[str, str | int | float | bool]: A dictionary with the configuration option, parsed to the correct type.
- load_data(conf_dict: dict) pcntoolkit.dataio.norm_data.NormData#
Load the data from the configuration dictionary.
- Returns:
NormData: NormData object containing the data
- load_response_vars(datafile: str, maskfile: str | None = None, vol: bool = True) tuple[numpy.ndarray, numpy.ndarray | None]#
Load response variables from file. This will load the data and mask it if necessary. If the data is in ascii format it will be converted into a numpy array. If the data is in neuroimaging format it will be reshaped into a 2D array (observations x variables) and a mask will be created if necessary.
- Parameters:
datafile – File containing the response variables
maskfile – Mask file (nifti only)
vol – If True, load the data as a 4D volume (nifti only)
- Returns Y:
Response variables
- Returns volmask:
Mask file (nifti only)
- load_test_data(conf_dict: dict) pcntoolkit.dataio.norm_data.NormData#
Load the test data from the file specified in the configuration dictionary.
- Args:
conf_dict (dict): dictionary containing the configuration options
- Returns:
NormData: NormData object containing the test data