Skip to main content

Detergent for your dirty neuroimaging pipelines

Project description

sekupy

example workflow codecov Documentation Status Project Status: WIP – Initial development is in progress, but there has not yet been a stable, usable release suitable for the public. CodeFactor

sekupy is a python-package created for deterging your (dirty) (and) (multivariate) neuroimaging analyses. The package has been thought for decoding analyses but it includes also basic univariate analyses.

It has some utilities to vary sets of parameters of the analyses without struggling with for and if statements.

It deterges your results, by saving them in a safe manner, by also keeping in mind BIDS.

sekupy is the deterged version of pyitab.

Documentation

The documention can be found here.

Install

The package isn't yet on pip. You can install it by using:

python setup.py install

Example

The main idea is to use a dictionary to configure all parameters of your analysis, feed the configuration into an AnalysisPipeline object, call fit to obtain results, then save to store in a BIDS-ish way.

For example if we want to perform a RoiDecoding analysis using some preprocessing steps we will have a script like this (this is not a complete example):

from sekupy.analysis.configurator import AnalysisConfigurator
from sekupy.analysis.pipeline import AnalysisPipeline
from sekupy.analysis.decoding.roi_decoding import RoiDecoding

_default_config = {
                    # Here we specifiy that we have to transform the dataset labels
                    # then select samples and then balance data
                    'prepro': ['target_transformer', 'sample_slicer', 'balancer'],
                    
                    # Here we set which attribute to choose (dataset is a pymvpa dataset)
                    'target_transformer__attr': "image_type",
                    # Here we select samples with a image_type equal to I or O and evidence equal to 1
                    'sample_slicer__attr': {'image_type':["I", "O"], 'evidence':[1]},
                    # Then we say that we want to balance image_type at subject-level
                    "balancer__attr": 'subject',

                    # We setup the estimator in a sklearn way
                    'estimator': [
                        ('fsel', SelectKBest(k=50)),
                        ('clf', SVC(C=1, kernel='linear'))],
                    'estimator__clf__C': 1,
                    'estimator__clf__kernel': 'linear',
                    
                    # Then the cross-validation object (also sklearn)
                    'cv': LeaveOneGroupOut,
                    
                    'scores': ['accuracy'],
                    
                    # Then the analysis
                    'analysis': RoiDecoding,
                    'analysis__n_jobs': -1,
                    
                    'analysis__permutation': 0,
                    
                    'analysis__verbose': 0,
                    
                    # Here we say that we want use the region with value 1 in image+type mask
                    'kwargs__roi_values': [('image+type', [1]), ('image+type', [2]), ('image+type', [3]),
                                            ('image+type', [4]), ('image+type', [5])],
                    
                    # We want to use subject for our cross-validation
                    'kwargs__cv_attr': 'subject'
                    }

configuration = AnalysisConfigurator(**_default_config), 
                                     kind='configuration') 
kwargs = configuration._get_kwargs() 
a = AnalysisPipeline(conf, name="roi_decoding_across_full").fit(ds, **kwargs) 
a.save() 

Surf the code, starting from classes used here!!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sekupy-0.0.1.tar.gz (197.5 kB view details)

Uploaded Source

Built Distribution

sekupy-0.0.1-py3-none-any.whl (236.2 kB view details)

Uploaded Python 3

File details

Details for the file sekupy-0.0.1.tar.gz.

File metadata

  • Download URL: sekupy-0.0.1.tar.gz
  • Upload date:
  • Size: 197.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for sekupy-0.0.1.tar.gz
Algorithm Hash digest
SHA256 c22727006392b25e6edfd8891aa28c85a4f78c44ec46986090cdcf359eaa9e56
MD5 32a180dd0f6d5fd3181d32cd401551f7
BLAKE2b-256 e9719c0b3dbeb812df714cff55ee9811f2ff50eeea04f73fba9a5292eaa18b85

See more details on using hashes here.

File details

Details for the file sekupy-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: sekupy-0.0.1-py3-none-any.whl
  • Upload date:
  • Size: 236.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for sekupy-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 54b4c9e7d5d0929602e3e13adaabfd176843220eb6e259586e1503f05fd7622e
MD5 9047febb873d99e37464e851cb47d6ed
BLAKE2b-256 072b0d9cdde258aea7e8a0dc27ec235aae89425180b8a054a7bb2ad06ff99361

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page