pyns.endpoints.analysis.Analyses
- class pyns.endpoints.analysis.Analyses(client)
Bases:
Base
Analyses endpoint class
- __init__(client)
Initialize a Model instance.
- Parameters:
client (
Neuroscout
) – base client instance
Methods
__init__
(client)Initialize a Model instance.
clone
(id)Clone analysis
compile
(id[, build])Submit analysis for complilation
create_analysis
(*, name, dataset_name, ...)Analysis creation "wizard".
delete
(id)Delete analysis
fill
(id[, partial, dryrun])Fill missing fields
generate_report
(id[, run_id, sampling_rate, ...])Submit analysis for report generation
get_analysis
(id)Convenience function to fetch and create Analysis object from a known analysis id
get_bundle
(id[, filename])Get analysis bundle
get_design_matrix
(id[, run_id, loop_wait])Get report design_matrix
get_full
(id)Get full analysis object (including runs and predictors)
get_report
(id[, run_id, loop_wait])Get generated reports for analysis
get_resources
(id)Get analysis resources
get_status
(id)Get analysis status
get_uploads
(id[, select])Get NeuroVault uploads associated with this analysis
load_uploads
(id[, select, download_dir, ...])Load collection upload as NiBabel images and associated meta-data You can filter which images are loaded based on either collection level attributes or statmap image level attributes.
plot_report
(id[, run_id, plot_type, loop_wait])Uses altair to plot design_matrix plot generated by report
plot_uploads
(id[, plot_args])Plot uploads for matching collections using nilearn
put
(id, **kwargs)Put analysis
upload_neurovault
(id, validation_hash[, ...])Submit analysis for report generation
- clone(id)
Clone analysis
- compile(id, build=True)
Submit analysis for complilation
- create_analysis(*, name, dataset_name, predictor_names, tasks=None, subjects=None, runs=None, session=None, hrf_variables=None, contrasts=None, dummy_contrasts=True, transformations=None, **kwargs)
Analysis creation “wizard”. Builds analysis with a pre-populated BIDS Stats Model.
- Parameters:
name (str) – analysis name
dataset_name (str) – dataset name
predictor_names (list) – predictor names to include in model
tasks (list) – list of tasks to include
subjects (list) – list of subject identifiers
runs (list) – list of run ids
session (str) – session name
hrf_variables (list) – subset of predictor_names to convolve with HRF
contrasts (list) – list of contrast dictionaries
dummy_contrasts (list) – subset of predictor_names to create dummy contrast for
transformations (list) – list of transformations
kwargs (dict) – arguments to pass to Analysis class
- Returns:
Analysis object
- Rype:
- delete(id)
Delete analysis
- fill(id, partial=True, dryrun=False)
Fill missing fields
- generate_report(id, run_id=None, sampling_rate=None, scale=False)
Submit analysis for report generation
- get_analysis(id)
Convenience function to fetch and create Analysis object from a known analysis id
- get_bundle(id, filename=None)
Get analysis bundle
- get_design_matrix(id, run_id=None, loop_wait=True)
Get report design_matrix
- get_full(id)
Get full analysis object (including runs and predictors)
- get_report(id, run_id=None, loop_wait=True)
Get generated reports for analysis
- get_resources(id)
Get analysis resources
- get_status(id)
Get analysis status
- get_uploads(id, select='latest', **kwargs)
Get NeuroVault uploads associated with this analysis
- Parameters:
- Returns:
Requests response object
- Rype:
requests.Response
- load_uploads(id, select='latest', download_dir=None, collection_filters={}, image_filters={})
Load collection upload as NiBabel images and associated meta-data You can filter which images are loaded based on either collection level attributes or statmap image level attributes. These correspond to field returns for get_uploads at the collection level or file level. In addition for images, BIDS entities are parsed and available to filter on.
- Parameters:
select (str) – How to select from multiple collections Options: “latest”, “oldest” or None. If None, returns all results.
download_dir – Path to download images. If None, tempdir.
collection_filters (dict) – Attributes to filter collections on.
image_filters (dict) – Attributes to filter images on. If any attributes are not found, they are ignored.
- Returns:
list list of tuples of format (Nifti1Image, kwargs).
- Rype:
list
- plot_report(id, run_id=None, plot_type='design_matrix_plot', loop_wait=True)
Uses altair to plot design_matrix plot generated by report
- plot_uploads(id, plot_args={}, **kwargs)
Plot uploads for matching collections using nilearn
- put(id, **kwargs)
Put analysis
- upload_neurovault(id, validation_hash, subject_paths=None, group_paths=None, collection_id=None, force=False, cli_version=None, fmriprep_version=None, estimator=None, n_subjects=None, cli_args=None)
Submit analysis for report generation
- Parameters:
validation_hash (str) – Validation hash string.
subject_paths (list) – List of image paths.
group_paths (list) – List of image paths.
force (bool) – Force upload with unique timestamped name.
cli_version (str) – neuroscout-cli version at runtime
fmriprep_version (str) – fmriprep version at runtime
estimator (str) – estimator used in fitlins (anfi/nilearn)
n_subjects (int) – Number of subjects in analysis.
cli_args (dict) – Run time CLI args
- Returns:
Arguments specified to CLI at runtime
- Rype:
dict