Skip to content
Roan LaPlante edited this page Aug 20, 2014 · 4 revisions

The integration tests included in the development version of cvu make use of the automated scripting mode. Many of these tests simulate many menu interactions in order to test the GUIs -- that is, directly inserting information into the GUI and asking the GUI events like button presses. However, it is usually possible to bypass the menu interactions and make calls to the controller and the datasets directly (it should almost never be necessary to access the viewports that those datasets use from the controller).

Most of the following examples come from the integration tests. However, both a menu-intensive and non-menu-intensive version of each script is shown.

Load sample data from 3 different modalities

Load sample data from 3 different modalities (with scripting shortcuts)
fmri_ds = load_parc('laus125', 'orders/laus125_cmp.txt', new_dataset=True, 
    dataset_name='fMRI network')
gqi_ds = load_parc('laus125', 'orders/laus125_cmp.txt', new_dataset=True, 
    dataset_name='Generalized Q-space Imaging network')
meg_ds = load_parc('laus125', 'orders/laus125_cmp.txt', new_dataset=True, 
    dataset_name='MEG synchronization likelihood network')

#fMRI sample dataset is already in CMP ordering, no ordering arguments needed
load_adj('data/sample_fmri.npy', fmri_ds)

#GQI sample dataset is already in CMP ordering, no ordering arguments needed
load_adj('data/sample_gqi.npy', gqi_ds)

#MEG sample dataset is in alphabetical ordering
load_adj('data/sample_meg.npy', meg_ds, ordering='orders/laus125_alph.txt',
    ignore_deletes=True)
Load sample data from 3 different modalities (with manual menu interactions)
#create the fMRI dataset
self.parcellation_chooser_window.ctl.new_dataset=True
self.parcellation_chooser_window.ctl.parcellation_name='laus125'
self.parcellation_chooser_window.ctl.labelnames_file='orders/laus125_cmp.txt'
self.parcellation_chooser_window.ctl.new_dataset_name='fMRI network'
self.parcellation_chooser_window.finished=True
self.parcellation_chooser_window.notify=True

#create the GQI dataset. Most parameters in the window are left unchanged.
self.parcellation_chooser_window.ctl.new_dataset_name=('Generalized Q-Space '
    'Imaging network')
self.parcellation_chooser_window.notify=True

#create the MEG dataset. Most parameters in the window are left unchanged.
self.parcellation_chooser_window.ctl.new_dataset_name=('MEG synchronization '
    'likelihood network')
self.parcellation_chooser_window.notify=True

#load the fMRI data into the fMRI dataset
self.adjmat_chooser_window._current_dataset_list = [
    self.controller.ds_instances['fMRI network']]
self.adjmat_chooser_window.ctl.adjmat='data/sample_fmri.npy'
#parcellation and matrix orderings are the same so we leave the ordering blank
self.adjmat_chooser_window.ctl.adjmat_order=''
self.adjmat_chooser_window.finished=True
self.adjmat_chooser_window.notify=True


#load the fMRI data into the fMRI dataset
self.adjmat_chooser_window._current_dataset_list = [
    self.controller.ds_instances['Generalized Q-Space Imaging network']]
self.adjmat_chooser_window.ctl.adjmat='data/sample_gqi.npy'
# we leave the ordering information the same
self.adjmat_chooser_window.notify=True


#load the fMRI data into the fMRI dataset
self.adjmat_chooser_window._current_dataset_list = [
    self.controller.ds_instances['MEG synchronization likelihood network']] 
self.adjmat_chooser_window.ctl.adjmat='data/sample_meg.npy'
#this matrix is in alphabetical ordering so we need to adjust it
self.adjmat_chooser_window.ctl.adjmat_order='orders/laus125_alph.txt'
self.adjmat_chooser_window.ctl.ignore_deletes=True
self.adjmat_chooser_window.notify=True

Load sample fMRI data and change color scheme

self.controller.ds_orig.opts.default_map.cmap='bone'
self.controller.ds_orig.opts.activation_map.cmap='custom_heat'
self.controller.ds_orig.opts.activation_map.reverse=True
self.controller.ds_orig.opts.connmat_map.cmap='file'
self.controller.ds_orig.opts.connmat_map.fname='cmaps/sample_heat.lut'
self.controller.ds_orig.opts.connmat_map.reverse=True

load_parc('laus125', 'orders/laus125_cmp.txt', dataset=self.controller.ds_orig)
load_adj('data/sample_gqi.npy', self.controller.ds_orig)