Summary
This major version release (v2.0.0
) brings several updates to pyspi including changes to how data are pre-processed prior to computing SPIs. We consider this release a semantic breaking change due to its impact on result reproducibility, even though the API remains compatible with existing pyspi pipelines.
Important note on results and reproducibility
While this release does not introduce breaking changes to the API for existing users, the modifications to the ordering of pre-processing steps may lead to different numerical results when compared to earlier (< 2.0.0
) versions of pyspi, even for identical input data. Therefore, we strongly advise treating pre-2.0 and post-2.0 results as originating from different pre-processing pipelines.
Due to these changes in pre-processing:
- Results generated with pyspi
>= 2.0.0
are not directly comparable to results generated with versions< 2.0.0
. - For scientific reproducibility, if you need to replicate results obtained with older versions, ensure you are using the corresponding version (e.g.,
pip install pyspi<2.0.0
). - For all new analyses, we recommend using pyspi
>= 2.0.0
.
Bug fixes
- Correction to the order of pre-processing steps applied to time-series data before computing SPIs. If enabled, each individual time series, corresponding to a process in a multivariate time-series dataset, are first de-trended along the time-dimension, then individually z-scored along the time dimension. Special thanks to @anniegbryant for spotting this issue.
Key changes
- Separated the combined de-trend/normalize pre-processing steps such that they can be enabled/disabled individually with their own flags,
normalise
anddetrend
, when instantiating aCalculator
(see an example below). As with previous versions of pyspi, both detrending and normalising are enabled by default. - Added a new dependency
colorama
for coloured outputs when running pyspi in a terminal window. - Users will now be notified of which pre-processing steps have been applied to their data after successfully instantiating a
Calculator
object (see the below example).
Example usage
To enable or disable either of the pre-processing steps, the corresponding flag can be passed to the Calculator:
from pyspi.calculator import Calculator
data = ... # your data
# de-trend only
calc = Calculator(dataset=data, normalise=False, detrend=True)
# normalise only
calc = Calculator(dataset=data, normalise=True, detrend=False)
# disable both detrending and normalising
calc = Calculator(dataset=data, normalise=False, detrend=False)
Note that as with previous versions of pyspi, both the detrending and normalising operations are enabled by default. After successfully instantiating a Calculator with the specified pre-processing pipeline, a summary will be printed for verification of the enabled/disabled steps:
4 SPI(s) were successfully initialised.
[1/2] Skipping detrending of the dataset...
[2/2] Normalising (z-scoring) the dataset...