pyspi: Statistics for Pairwise Interactions
pyspi GitHub
  • Welcome to pyspi
    • Citing pyspi
  • Installing and using pyspi
    • Installation
      • Alternative Installation Options
      • Troubleshooting
    • Usage
      • Walkthrough Tutorials
        • Getting Started: A Simple Demonstration
        • Neuroimaging: fMRI Time Series
        • Finance: Stock Price Time Series
        • Distributing Calculations
      • Advanced Usage
        • Creating a reduced SPI set
        • Distributing calculations on a cluster
      • FAQ
  • Information about pyspi
    • SPIs
      • Glossary of Terms
      • Table of SPIs
      • SPI Descriptions
        • Basic Statistics
        • Distance Similarity
        • Causal Inference
        • Information Theory
        • Spectral
        • Miscellaneous
      • SPI Subsets
    • API Reference
      • pyspi.calculator.CorrelationFrame
      • pyspi.calculator.Calculator
      • pyspi.data.Data
      • pyspi.calculator.CalculatorFrame
      • pyspi.utils.filter_spis
    • Publications using pyspi
    • Related Packages
  • Development
    • Development
      • Incorporating new SPIs
      • Contributing to pyspi
      • Code of Conduct
    • License
Powered by GitBook

All page cover images on this wiki are created with the help of DALL-E, an AI program developed by OpenAI, or stock images from Unsplash.

On this page
  • Example
  • Methods
  • Attributes
  1. Information about pyspi
  2. API Reference

pyspi.calculator.CalculatorFrame

class pyspi.calculator.CalculatorFrame(calculators=None, name=None, datasets=None, names=None, labels=None)

Container for batch level commands such as computing/pruning/initialising multiple datasets at once.

Example

from pyspi.calculator import CalculatorFrame
from pyspi.calculator import Calculator
from pyspi.data import Data

# provide dataset filepaths
datsets = ['../pyspi/data/cml.npy', '../pyspi/data/forex.npy', '../pyspi/data/standard_normal.npy']
# provide names for each dataset
dataset_names = ['cml', 'forex', 'standard_normal']
# optionally, provide labels for each dataset/calculator
dataset_labels = ['label1', 'label2', 'label3']

# create calculator frame
calc_frame = CalculatorFrame(
    name="MyCalculatorFrame",
    datasets = [Data(data=data, dim_order = 'sp') for data in datasets],
    names=dataset_names,
    labels=dataset_labels,
    subset = 'fast' # pass the subset parameter along to the calculators
)

# run compute on all calculators in the frame
calc_frame.compute()

# access the results table for dataset 1
calc_frame.calculators[0][0].table

# get correlation frame
cf = calc_frame.get_correlation_df()

Parameters
Description

  • calculators - Initial set of calculators to be added to the frame.

  • datasets (list, optional) - A list of datasets to initialise calculators with.

  • names (list of str, optional) - Corresponding names for each dataset in 'datasets'.

  • labels (list, optional) - Labels for the datasets in 'datasets'.

  • kwargs (dict, optional) - Additional keyword arguments for calculator initialisation.

__init__(calculators=None, name=None, datasets=None, names=None, labels=None, **kwargs)

Methods

Method
Description

from_calculator(calculator)

Creates a CalculatorFrame from a single calculator.

set_calculator(calculators)

Sets the calculator(s) for the frame.

add_calculator(calc)

Adds a calculator to the existing frame.

init_from_list(datasets, names, labels, **kwargs)

Initialises calculators from a list of datasets.

init_from_yaml(document, normalise=True, n_processes=None, n_observations=None, **kwargs)

Initialises calculators from a YAML file.

merge(other)

Merges another CalculatorFrame's calculations into the current frame.

compute(calc)

Computes results for each calculator object.

set_group(calc, *args)

Sets the group for each calculator.

get_correlation_df(with_labels=False, **kwargs)

Generates a DataFrame showing correlations between SPIs for each dataset.

Attributes

Attribute
Description

name

The name of the CalculatorFrame.

Previouspyspi.data.DataNextpyspi.utils.filter_spis

Last updated 11 months ago

name (, optional) - A name for the CalculatorFrame instance.

str