diff --git a/doc/PsPM.bib b/doc/PsPM.bib index 8f8f6483d..7445ad58a 100644 --- a/doc/PsPM.bib +++ b/doc/PsPM.bib @@ -1,7 +1,7 @@ %% This BibTeX bibliography file was created using BibDesk. %% https://bibdesk.sourceforge.io/ -%% Created for Teddy at 2021-08-24 15:01:16 +0100 +%% Created for Dominik at 2024-12-14 13:02:37 +0100 %% Saved with string encoding Unicode (UTF-8) @@ -11,6 +11,147 @@ @comment{jabref-meta: +@article{Xia:2023aa, + annote = {10.1101/lm.053781.123}, + author = {Xia, Yanfang and Wehrli, Jelena and Gerster, Samuel and Kroes, Marijn and Houtekamer, Maxime and Bach, Dominik R.}, + date = {2023/07/01}, + date-added = {2024-12-14 13:02:21 +0100}, + date-modified = {2024-12-14 13:02:21 +0100}, + journal = {Learning \& Memory}, + journal1 = {Learning \& Memory}, + month = {07}, + n2 = {Fear conditioning is a laboratory paradigm commonly used to investigate aversive learning and memory. In context fear conditioning, a configuration of elemental cues (conditioned stimulus {$[$}CTX{$]$}) predicts an aversive event (unconditioned stimulus {$[$}US{$]$}). To quantify context fear acquisition in humans, previous work has used startle eyeblink responses (SEBRs), skin conductance responses (SCRs), and verbal reports, but different quantification methods have rarely been compared. Moreover, preclinical intervention studies mandate recall tests several days after acquisition, and it is unclear how to induce and measure context fear memory retention over such a time interval. First, we used a semi-immersive virtual reality paradigm. In two experiments (N = 23 and N = 28), we found successful declarative learning and memory retention over 7 d but no evidence of other conditioned responses. Next, we used a configural fear conditioning paradigm with five static room images as CTXs in two experiments (N = 29 and N = 24). Besides successful declarative learning and memory retention after 7 d, SCR and pupil dilation in response to CTX onset differentiated CTX+/CTX−during acquisition training, and SEBR and pupil dilation differentiated CTX+/CTX−during the recall test, with medium to large effect sizes for the most sensitive indices (SEBR: Hedge's g = 0.56 and g = 0.69; pupil dilation: Hedge's g = 0.99 and g = 0.88). Our results demonstrate that with a configural learning paradigm, context fear memory retention can be demonstrated over 7 d, and we provide robust and replicable measurement methods to this end.}, + number = {7}, + pages = {139--150}, + title = {Measuring human context fear conditioning and retention after consolidation}, + url = {http://learnmem.cshlp.org/content/30/7/139.abstract}, + volume = {30}, + year = {2023}, + bdsk-url-1 = {http://learnmem.cshlp.org/content/30/7/139.abstract}} + +@article{Wehrli:2022aa, + author = {Wehrli, Jelena M. and Xia, Yanfang and Gerster, Samuel and Bach, Dominik R.}, + date = {2022/12/01}, + date-added = {2024-12-14 12:58:27 +0100}, + date-modified = {2024-12-14 12:58:27 +0100}, + doi = {https://doi.org/10.1111/psyp.14119}, + isbn = {0048-5772}, + journal = {Psychophysiology}, + journal1 = {Psychophysiology}, + journal2 = {Psychophysiology}, + journal3 = {Psychophysiology}, + keywords = {calibration; fear conditioning; fear memory; fear-potentiated startle; human neuroscience; psychophysiological modeling; retrodictive validity; trace fear memory}, + month = {2024/12/14}, + n2 = {Abstract Trace fear conditioning is an important research paradigm to model aversive learning in biological or clinical scenarios, where predictors (conditioned stimuli, CS) and aversive outcomes (unconditioned stimuli, US) are separated in time. The optimal measurement of human trace fear conditioning, and in particular of memory retention after consolidation, is currently unclear. We conducted two identical experiments (N1 =?28, N2 =?28) with a 15-s trace interval and a recall test 1 week after acquisition, while recording several psychophysiological observables. In a calibration approach, we explored which learning and memory measures distinguished CS+ and CS? in the first experiment and confirmed the most sensitive measures in the second experiment. We found that in the recall test without reinforcement, only fear-potentiated startle but not skin conductance, pupil size, heart period, or respiration amplitude, differentiated CS+ and CS?. During acquisition without startle probes, skin conductance responses and pupil size responses but not heart period or respiration amplitude differentiated CS+ and CS?. As a side finding, there was no evidence for extinction of fear-potentiated startle over 30 trials without reinforcement. These results may be useful to inform future substantive research using human trace fear conditioning protocols.}, + number = {12}, + pages = {e14119}, + publisher = {John Wiley \& Sons, Ltd}, + title = {Measuring human trace fear conditioning}, + url = {https://doi.org/10.1111/psyp.14119}, + volume = {59}, + year = {2022}, + year1 = {2022}, + bdsk-url-1 = {https://doi.org/10.1111/psyp.14119}} + +@article{Gent:2019aa, + abstract = {Heart rate data are often collected in human factors studies, including those into vehicle automation. Advances in open hardware platforms and off-the-shelf photoplethysmogram (PPG) sensors allow the non-intrusive collection of heart rate data at very low cost. However, the signal is not trivial to analyse, since the morphology of PPG waveforms differs from electrocardiogram (ECG) waveforms and shows different noise patterns. Few validated open source available algorithms exist that handle PPG data well, as most of these algorithms are specifically designed for ECG data. In this paper we present the validation of a novel algorithm named HeartPy, useful for the analysis of heart rate data collected in noisy settings, such as when driving a car or when in a simulator. We benchmark the performance on two types of datasets and show that the developed algorithm performs well. Further research steps are discussed.}, + author = {van Gent, Paul and Farah, Haneen and van Nes, Nicole and van Arem, Bart}, + date = {2019/10/01/}, + date-added = {2024-12-14 12:53:34 +0100}, + date-modified = {2024-12-14 12:53:34 +0100}, + doi = {https://doi.org/10.1016/j.trf.2019.09.015}, + isbn = {1369-8478}, + journal = {Transportation Research Part F: Traffic Psychology and Behaviour}, + keywords = {Human factors; Heart rate analysis; Physiological signals; Signal analysis; Open source}, + pages = {368--378}, + title = {HeartPy: A novel heart rate algorithm for the analysis of noisy signals}, + url = {https://www.sciencedirect.com/science/article/pii/S1369847818306740}, + volume = {66}, + year = {2019}, + bdsk-url-1 = {https://www.sciencedirect.com/science/article/pii/S1369847818306740}, + bdsk-url-2 = {https://doi.org/10.1016/j.trf.2019.09.015}} + +@article{xia_liu:2024, + author = {Yanfang Xia and Huaiyu Liu and Oliver K. K{\"a}lin and Samuel Gerster and Dominik R. Bach}, + date-added = {2024-12-14 11:45:31 +0100}, + date-modified = {2024-12-14 11:46:54 +0100}, + journal = {pre-print}, + title = {Measuring human Pavlovian appetitive conditioning and memory retention}, + volume = {https://doi.org/10.31234/osf.io/qs7ku}, + year = {2024}} + +@article{Mancinelli:2024aa, + abstract = {Fear conditioning, also termed threat conditioning, is a commonly used learning model with clinical relevance. Quantification of threat conditioning in humans often relies on conditioned autonomic responses such as skin conductance responses (SCR), pupil size responses (PSR), heart period responses (HPR), or respiration amplitude responses (RAR), which are usually analyzed separately. Here, we investigate whether inter-individual variability in differential conditioned responses, averaged across acquisition, exhibits a multi-dimensional structure, and the extent to which their linear combination could enhance the precision of inference on whether threat conditioning has occurred. In a mega-analytic approach, we re-analyze nine data sets including 256 individuals, acquired by the group of the last author, using standard routines in the framework of psychophysiological modeling (PsPM). Our analysis revealed systematic differences in effect size between measures across datasets, but no evidence for a multidimensional structure across various combinations of measures. We derive the statistically optimal weights for combining the four measures and subsets thereof, and we provide out-of-sample performance metrics for these weights, accompanied by bias-corrected confidence intervals. We show that to achieve the same statistical power, combining measures allows for a relevant reduction in sample size, which in a common scenario amounts to roughly 24{\%}. To summarize, we demonstrate a one-dimensional structure of threat conditioning measures, systematic differences in effect size between measures, and provide weights for their optimal linear combination in terms of maximal retrodictive validity.}, + author = {Mancinelli, Federico and Sporrer, Juliana K. and Myrov, Vladislav and Melinscak, Filip and Zimmermann, Josua and Liu, Huaiyu and Bach, Dominik R.}, + date = {2024/09/01}, + date-added = {2024-12-14 11:44:25 +0100}, + date-modified = {2024-12-14 11:44:25 +0100}, + doi = {10.3758/s13428-024-02341-3}, + id = {Mancinelli2024}, + isbn = {1554-3528}, + journal = {Behavior Research Methods}, + number = {6}, + pages = {6119--6129}, + title = {Dimensionality and optimal combination of autonomic fear-conditioning measures in humans}, + url = {https://doi.org/10.3758/s13428-024-02341-3}, + volume = {56}, + year = {2024}, + bdsk-url-1 = {https://doi.org/10.3758/s13428-024-02341-3}} + +@article{Bach:2020ab, + abstract = {Quantification of fear conditioning is paramount to many clinical and translational studies on aversive learning. Various measures of fear conditioning co-exist, including different observables and different methods of pre-processing. Here, we first argue that low measurement error is a rational desideratum for any measurement technique. We then show that measurement error can be approximated in benchmark experiments by how closely intended fear memory relates to measured fear memory, a quantity that we term retrodictive validity. From this perspective, we discuss different approaches commonly used to quantify fear conditioning. One of these is psychophysiological modelling (PsPM). This builds on a measurement model that describes how a psychological variable, such as fear memory, influences a physiological measure. This model is statistically inverted to estimate the most likely value of the psychological variable, given the measured data. We review existing PsPMs for skin conductance, pupil size, heart period, respiration, and startle eye-blink. We illustrate the benefit of PsPMs in terms of retrodictive validity and translate this into sample size required to achieve a desired level of statistical power. This sample size can differ up to a factor of three between different observables, and between the best, and the current standard, data pre-processing methods.}, + author = {Bach, Dominik R. and Melinscak, Filip}, + date = {2020/04/01/}, + date-added = {2024-12-11 19:27:40 +0100}, + date-modified = {2024-12-11 19:27:40 +0100}, + doi = {https://doi.org/10.1016/j.brat.2020.103576}, + isbn = {0005-7967}, + journal = {Behaviour Research and Therapy}, + keywords = {Threat conditioning; Aversive learning; Return of fear; Reconsolidation; Anxiety disorder; Retrodictive validity}, + pages = {103576}, + title = {Psychophysiological modelling and the measurement of fear conditioning}, + url = {https://www.sciencedirect.com/science/article/pii/S0005796720300279}, + volume = {127}, + year = {2020}, + bdsk-url-1 = {https://www.sciencedirect.com/science/article/pii/S0005796720300279}, + bdsk-url-2 = {https://doi.org/10.1016/j.brat.2020.103576}} + +@article{Bach:2020aa, + abstract = {Behavioural researchers often seek to experimentally manipulate, measure and analyse latent psychological attributes, such as memory, confidence or attention. The best measurement strategy is often difficult to intuit. Classical psychometric theory, mostly focused on individual differences in stable attributes, offers little guidance. Hence, measurement methods in experimental research are often based on tradition and differ between communities. Here we propose a criterion, which we term `retrodictive validity', that provides a relative numerical estimate of the accuracy of any given measurement approach. It is determined by performing calibration experiments to manipulate a latent attribute and assessing the correlation between intended and measured attribute values. Our approach facilitates optimising measurement strategies and quantifying uncertainty in the measurement. Thus, it allows power analyses to define minimally required sample sizes. Taken together, our approach provides a metrological perspective on measurement practice in experimental research that complements classical psychometrics.}, + author = {Bach, Dominik R. and Melin{\v s}{\v c}ak, Filip and Fleming, Stephen M. and Voelkle, Manuel C.}, + date = {2020/12/01}, + date-added = {2024-12-11 19:27:25 +0100}, + date-modified = {2024-12-11 19:27:25 +0100}, + doi = {10.1038/s41562-020-00976-8}, + id = {Bach2020}, + isbn = {2397-3374}, + journal = {Nature Human Behaviour}, + number = {12}, + pages = {1229--1235}, + title = {Calibrating the experimental measurement of psychological attributes}, + url = {https://doi.org/10.1038/s41562-020-00976-8}, + volume = {4}, + year = {2020}, + bdsk-url-1 = {https://doi.org/10.1038/s41562-020-00976-8}} + +@article{Bach:2024aa, + abstract = {Psychometrics is historically grounded in the study of individual differences. Consequently, common metrics such as quantitative validity and reliability require between-person variance in a psychological variable to be meaningful. Experimental psychology, in contrast, deals with variance between treatments, and experiments often strive to minimise within-group person variance. In this article, I ask whether and how psychometric evaluation can be performed in experimental psychology. A commonly used strategy is to harness between-person variance in the treatment effect. Using simulated data, I show that this approach can be misleading when between-person variance is low, and in the face of methods variance. I argue that this situation is common in experimental psychology, because low between-person variance is desirable, and because methods variance is no more problematic in experimental settings than any other source of between-person variance. By relating validity and reliability with the corresponding concepts in measurement science outside psychology, I show how experiment-based calibration can serve to compare the psychometric quality of different measurement methods in experimental psychology.}, + author = {Bach, Dominik R.}, + date = {2024/08/01}, + date-added = {2024-12-11 19:25:09 +0100}, + date-modified = {2024-12-11 19:25:09 +0100}, + doi = {10.3758/s13423-023-02421-z}, + id = {Bach2024}, + isbn = {1531-5320}, + journal = {Psychonomic Bulletin \& Review}, + number = {4}, + pages = {1461--1470}, + title = {Psychometrics in experimental psychology: A case for calibration}, + url = {https://doi.org/10.3758/s13423-023-02421-z}, + volume = {31}, + year = {2024}, + bdsk-url-1 = {https://doi.org/10.3758/s13423-023-02421-z}} + @article{xia:2020, abstract = {Threat-conditioned cues are thought to capture overt attention in a bottom-up process. Quantification of this phenomenon typically relies on cue competition paradigms. Here, we sought to exploit gaze patterns during exclusive presentation of a visual conditioned stimulus, in order to quantify human threat conditioning. To this end, we capitalized on a summary statistic of visual search during CS presentation, scanpath length. During a simple delayed threat conditioning paradigm with full-screen monochrome conditioned stimuli (CS), we observed shorter scanpath length during CS+ compared to CS- presentation. Retrodictive validity, i.e., effect size to distinguish CS+ and CS-, was maximized by considering a 2-s time window before US onset. Taking into account the shape of the scan speed response resulted in similar retrodictive validity. The mechanism underlying shorter scanpath length appeared to be longer fixation duration and more fixation on the screen center during CS+ relative to CS- presentation. These findings were replicated in a second experiment with similar setup, and further confirmed in a third experiment using full-screen patterns as CS. This experiment included an extinction session during which scanpath differences appeared to extinguish. In a fourth experiment with auditory CS and instruction to fixate screen center, no scanpath length differences were observed. In conclusion, our study suggests scanpath length as a visual search summary statistic, which may be used as complementary measure to quantify threat conditioning with retrodictive validity similar to that of skin conductance responses.}, author = {Xia, Y and Melinscak, F and Bach, DR}, @@ -24,7 +165,7 @@ @uzh.ch. title = {Saccadic scanpath length: an index for human threat conditioning}, volume = {53}, year = {2020}, - Bdsk-Url-1 = {https://doi.org/10.3758/s13428-020-01490-5}} + bdsk-url-1 = {https://doi.org/10.3758/s13428-020-01490-5}} @article{schutz:2011, author = {Schutz, A. C. and Braun, D. I. and Gegenfurtner, K. R.}, @@ -40,8 +181,8 @@ @article{schutz:2011 urldate = {2019-12-16}, volume = {11}, year = {2011}, - Bdsk-Url-1 = {http://jov.arvojournals.org/Article.aspx?doi=10.1167/11.5.9}, - Bdsk-Url-2 = {https://doi.org/10.1167/11.5.9}} + bdsk-url-1 = {http://jov.arvojournals.org/Article.aspx?doi=10.1167/11.5.9}, + bdsk-url-2 = {https://doi.org/10.1167/11.5.9}} @article{Homan:2017aa, author = {Homan, Philipp and Lin, Qi and Murrough, James W and Soleimani, Laili and Bach, Dominik R and Clem, Roger L and Schiller, Daniela}, @@ -56,7 +197,7 @@ @article{Homan:2017aa title = {Prazosin during threat discrimination boosts memory of the safe stimulus}, volume = {24}, year = {2017}, - Bdsk-Url-1 = {https://doi.org/10.1101/lm.045898.117}} + bdsk-url-1 = {https://doi.org/10.1101/lm.045898.117}} @article{Tzovara:2018aa, author = {Tzovara, Athina and Korn, Christoph W and Bach, Dominik R}, @@ -71,7 +212,7 @@ @article{Tzovara:2018aa title = {Human {Pavlovian} fear conditioning conforms to probabilistic learning}, volume = {14}, year = {2018}, - Bdsk-Url-1 = {https://doi.org/10.1371/journal.pcbi.1006243}} + bdsk-url-1 = {https://doi.org/10.1371/journal.pcbi.1006243}} @article{Bach2018:aa, author = {Bach, Dominik R and Castegnetti, Giuseppe and Korn, Christoph W and Gerster, Samuel and Melinscak, Filip and Moser, Tobias}, @@ -86,7 +227,7 @@ @article{Bach2018:aa title = {Psychophysiological modeling: {Current} state and future directions}, volume = {55}, year = {2018}, - Bdsk-Url-1 = {https://doi.org/10.1111/psyp.13209}} + bdsk-url-1 = {https://doi.org/10.1111/psyp.13209}} @article{Bach:2016aa, abstract = {BACKGROUND: Cognitive processes influence respiratory physiology. This may allow inferring cognitive states from measured respiration. Here, we take a first step towards this goal and investigate whether event-related respiratory responses can be identified, and whether they are accessible to a model-based approach. @@ -108,7 +249,7 @@ @article{Bach:2016aa title = {A linear model for event-related respiration responses}, volume = {270}, year = {2016}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2016.06.001}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2016.06.001}} @article{Binks:2006aa, author = {Binks, Andrew P and Banzett, Robert B and Duvivier, Claude}, @@ -123,7 +264,7 @@ @article{Binks:2006aa title = {An inexpensive, {MRI} compatible device to measure tidal volume from chest-wall circumference}, volume = {28}, year = {2006}, - Bdsk-Url-1 = {https://doi.org/10.1088/0967-3334/28/2/004}} + bdsk-url-1 = {https://doi.org/10.1088/0967-3334/28/2/004}} @article{Wientjes:1998aa, author = {Wientjes, Cornelis JE and Grossman, Paul}, @@ -136,7 +277,7 @@ @article{Wientjes:1998aa title = {Respiratory psychophysiology as a discipline: introduction to the special issue}, volume = {49}, year = {1998}, - Bdsk-Url-1 = {https://doi.org/10.1016/s0301-0511(98)00026-x}} + bdsk-url-1 = {https://doi.org/10.1016/s0301-0511(98)00026-x}} @book{Cacioppo:2007aa, author = {Cacioppo, John T and Tassinary, Louis G and Berntson, Gary}, @@ -154,7 +295,8 @@ @inproceedings{Greco:2014aa organization = {IEEE}, pages = {2290--2293}, title = {Electrodermal activity processing: {A} convex optimization approach}, - year = {2014}} + year = {2014}, + bdsk-file-1 = {YnBsaXN0MDDSAQIDBFxyZWxhdGl2ZVBhdGhYYm9va21hcmtfECouLi8uLi8uLi8uLi8uVHJhc2gvcGVyaWNsZXNfMTQ2OTg5ODY1OS5yaXNPEQOgYm9va6ADAAAAAAQQMAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAnAIAAAUAAAABAQAAVXNlcnMAAAAHAAAAAQEAAGRvbWluaWsABgAAAAEBAAAuVHJhc2gAABcAAAABAQAAcGVyaWNsZXNfMTQ2OTg5ODY1OS5yaXMAEAAAAAEGAAAEAAAAFAAAACQAAAA0AAAACAAAAAQDAACxOAAAAAAAAAgAAAAEAwAA5FweAAAAAAAIAAAABAMAAAnJMQAAAAAACAAAAAQDAACwGckBAAAAABAAAAABBgAAbAAAAHwAAACMAAAAnAAAAAgAAAAABAAAQcaG1SVFa9AYAAAAAQIAAAEAAAAAAAAADwAAAAAAAAAAAAAAAAAAAAgAAAAEAwAAAgAAAAAAAAAEAAAAAwMAAPUBAAAIAAAAAQkAAGZpbGU6Ly8vDAAAAAEBAABNYWNpbnRvc2ggSEQIAAAABAMAAAAgRYzQAQAACAAAAAAEAABBxi/IBoAAACQAAAABAQAAMUI4NTJERjMtRjY2NS00NUYyLThFOEYtMEZDOEIxRjU2QzBBGAAAAAECAACBAAAAAQAAAO8TAAABAAAAAAAAAAAAAAABAAAAAQEAAC8AAAAAAAAAAQUAAN8AAAABAgAAYjcyN2I3ZmU0YTBjOWRmMmM1NDIxNDU0ZWVjYzU1NGYzMWNkZmNiYzdjZjA1ZTE2ZGMzZWZlNjU5NjkxNzJiNDswMDswMDAwMDAwMDswMDAwMDAwMDswMDAwMDAwMDswMDAwMDAwMDAwMDAwMDIwO2NvbS5hcHBsZS5hcHAtc2FuZGJveC5yZWFkLXdyaXRlOzAxOzAxMDAwMDEyOzAwMDAwMDAwMDFjOTE5YjA7MzY7L3VzZXJzL2RvbWluaWsvLnRyYXNoL3BlcmljbGVzXzE0Njk4OTg2NTkucmlzAADMAAAA/v///wEAAAAAAAAAEAAAAAQQAABUAAAAAAAAAAUQAACsAAAAAAAAABAQAADUAAAAAAAAAEAQAADEAAAAAAAAAAIgAACgAQAAAAAAAAUgAAAQAQAAAAAAABAgAAAgAQAAAAAAABEgAABUAQAAAAAAABIgAAA0AQAAAAAAABMgAABEAQAAAAAAACAgAACAAQAAAAAAADAgAACsAQAAAAAAAAHAAAD0AAAAAAAAABHAAAAUAAAAAAAAABLAAAAEAQAAAAAAAIDwAAC0AQAAAAAAAAAIAA0AGgAjAFAAAAAAAAACAQAAAAAAAAAFAAAAAAAAAAAAAAAAAAAD9A==}} @article{Berntson:1995, author = {Berntson, Gary G and Cacioppo, John T and Quigley, Karen S}, @@ -169,7 +311,7 @@ @article{Berntson:1995 title = {The metrics of cardiac chronotropism: {Biometric} perspectives}, volume = {32}, year = {1995}, - Bdsk-Url-1 = {https://doi.org/10.1111/j.1469-8986.1995.tb03308.x}} + bdsk-url-1 = {https://doi.org/10.1111/j.1469-8986.1995.tb03308.x}} @book{boucsein:2012, author = {Boucsein, Wolfram}, @@ -192,7 +334,7 @@ @article{Burnham:2004 title = {Multimodel inference understanding {AIC} and {BIC} in model selection}, volume = {33}, year = {2004}, - Bdsk-Url-1 = {https://doi.org/10.1177/0049124104268644}} + bdsk-url-1 = {https://doi.org/10.1177/0049124104268644}} @article{Penny:2004aa, abstract = {This article describes the use of Bayes factors for comparing dynamic causal models (DCMs). DCMs are used to make inferences about effective connectivity from functional magnetic resonance imaging (fMRI) data. These inferences, however, are contingent upon assumptions about model structure, that is, the connectivity pattern between the regions included in the model. Given the current lack of detailed knowledge on anatomical connectivity in the human brain, there are often considerable degrees of freedom when defining the connectional structure of DCMs. In addition, many plausible scientific hypotheses may exist about which connections are changed by experimental manipulation, and a formal procedure for directly comparing these competing hypotheses is highly desirable. In this article, we show how Bayes factors can be used to guide choices about model structure, both concerning the intrinsic connectivity pattern and the contextual modulation of individual connections. The combined use of Bayes factors and DCM thus allows one to evaluate competing scientific theories about the architecture of large-scale neural networks and the neuronal interactions that mediate perception and cognition.}, @@ -211,7 +353,7 @@ @article{Penny:2004aa title = {Comparing dynamic causal models}, volume = {22}, year = {2004}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2004.03.026}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2004.03.026}} @article{Staib:2015aa, abstract = {Anticipatory sympathetic arousal is often inferred from skin conductance responses (SCR) and used to quantify fear learning. We have previously provided a model-based approach for this inference, based on a quantitative Psychophysiological Model (PsPM) formulated in non-linear dynamic equations. Here we seek to optimise the inversion of this PsPM. Using two independent fear conditioning datasets, we benchmark predictive validity as the sensitivity to separate the likely presence or absence of the unconditioned stimulus. Predictive validity is optimised across both datasets by (a) using a canonical form of the SCR shape (b) filtering the signal with a bi-directional band-pass filter with cut off frequencies 0.0159 and 5Hz, (c) simultaneously inverting two trials (d) explicitly modelling skin conductance level changes between trials (e) the choice of the inversion algorithm (f) z-scoring estimates of anticipatory sympathetic arousal from each participant across trials. The original model-based method has higher predictive validity than conventional peak-scoring or an alternative model-based method (Ledalab), and benefits from constraining the model, optimised data preconditioning, and post-processing of ensuing parameters.}, @@ -230,7 +372,7 @@ @article{Staib:2015aa title = {Optimising a model-based approach to inferring fear learning from skin conductance responses}, volume = {255}, year = {2015}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2015.08.009}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2015.08.009}} @article{Bach:2015ab, abstract = {Tonic sympathetic arousal is often inferred from spontaneous fluctuations in skin conductance, and this relies on assumptions about the shape of these fluctuations and how they are generated. We have previously furnished a psychophysiological model for this relation, and an efficient and reliable inversion method to estimate tonic arousal from given data in the framework of dynamic causal modeling (DCM). Here, we provide a fast alternative inversion method in the form of a matching pursuit (MP) algorithm. Analyzing simulated data, this algorithm approximates the true underlying arousal up to about 10 spontaneous fluctuations per minute of data. For empirical data, we assess predictive validity as the ability to differentiate two known psychological arousal states. Predictive validity is comparable between the methods for three datasets, and also comparable to visual peak scoring. Computation time of the MP algorithm is 2-3 orders of magnitude faster for the MP than the DCM algorithm. In summary, the new MP algorithm provides a fast and reliable alternative to DCM inversion for SF data, in particular when the expected number of fluctuations is lower than 10 per minute, as in typical experimental situations.}, @@ -249,7 +391,7 @@ @article{Bach:2015ab title = {A matching pursuit algorithm for inferring tonic sympathetic arousal from spontaneous skin conductance fluctuations}, volume = {52}, year = {2015}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/psyp.12434}} + bdsk-url-1 = {http://dx.doi.org/10.1111/psyp.12434}} @article{Bach:2014aa, abstract = {Model-based analysis of skin conductance responses (SCR) can furnish less noisy estimates of sympathetic arousal (SA) than operational peak scoring approaches, as shown in previous work. Here, I compare two model-based methods for analysis of evoked (stimulus-locked) SCR, implemented in two software packages, SCRalyze and Ledalab, with respect to their sensitivity in recovering SA. Four datasets are analysed to compare predictive validity, i.e. the sensitivity to distinguish pairs of SA states that are known to be different. SCRalyze was significantly better able than Ledalab to recover this known difference in four out of five tested contrasts and comparable in the remaining one. SCRalyze performed significantly better than conventional analysis in all contrasts. I conclude that the model-based method engendered in SCRalyze is currently the best available approach to provide robust and sensitive estimates of sympathetic arousal.}, @@ -268,7 +410,7 @@ @article{Bach:2014aa title = {A head-to-head comparison of {SCRalyze} and {Ledalab}, two model-based methods for skin conductance analysis}, volume = {103}, year = {2014}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2014.08.006}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2014.08.006}} @article{Bach:2015aa, abstract = {Tonic sympathetic arousal is often inferred from spontaneous fluctuations in skin conductance, and this relies on assumptions about the shape of these fluctuations and how they are generated. We have previously furnished a psychophysiological model for this relation, and an efficient and reliable inversion method to estimate tonic arousal from given data in the framework of dynamic causal modeling (DCM). Here, we provide a fast alternative inversion method in the form of a matching pursuit (MP) algorithm. Analyzing simulated data, this algorithm approximates the true underlying arousal up to about 10 spontaneous fluctuations per minute of data. For empirical data, we assess predictive validity as the ability to differentiate two known psychological arousal states. Predictive validity is comparable between the methods for three datasets, and also comparable to visual peak scoring. Computation time of the MP algorithm is 2-3 orders of magnitude faster for the MP than the DCM algorithm. In summary, the new MP algorithm provides a fast and reliable alternative to DCM inversion for SF data, in particular when the expected number of fluctuations is lower than 10 per minute, as in typical experimental situations.}, @@ -287,7 +429,7 @@ @article{Bach:2015aa title = {A matching pursuit algorithm for inferring tonic sympathetic arousal from spontaneous skin conductance fluctuations}, volume = {52}, year = {2015}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/psyp.12434}} + bdsk-url-1 = {http://dx.doi.org/10.1111/psyp.12434}} @article{Daunizeau:2014aa, abstract = {This work is in line with an on-going effort tending toward a computational (quantitative and refutable) understanding of human neuro-cognitive processes. Many sophisticated models for behavioural and neurobiological data have flourished during the past decade. Most of these models are partly unspecified (i.e. they have unknown parameters) and nonlinear. This makes them difficult to peer with a formal statistical data analysis framework. In turn, this compromises the reproducibility of model-based empirical studies. This work exposes a software toolbox that provides generic, efficient and robust probabilistic solutions to the three problems of model-based analysis of empirical data: (i) data simulation, (ii) parameter estimation/model selection, and (iii) experimental design optimization.}, @@ -307,7 +449,7 @@ @article{Daunizeau:2014aa title = {{VBA}: a probabilistic treatment of nonlinear models for neurobiological and behavioural data}, volume = {10}, year = {2014}, - Bdsk-Url-1 = {http://dx.doi.org/10.1371/journal.pcbi.1003441}} + bdsk-url-1 = {http://dx.doi.org/10.1371/journal.pcbi.1003441}} @article{Pan:1985aa, author = {Pan, J and Tompkins, W J}, @@ -325,7 +467,7 @@ @article{Pan:1985aa title = {A real-time {QRS} detection algorithm}, volume = {32}, year = {1985}, - Bdsk-Url-1 = {http://dx.doi.org/10.1109/TBME.1985.325532}} + bdsk-url-1 = {http://dx.doi.org/10.1109/TBME.1985.325532}} @article{Alexander:2005aa, abstract = {We describe a new method for measuring skin conductance responses, designed to overcome the problem of overlapping skin conductance responses. The method relies on the assumptions that the underlying sudomotor nerve signal has a shorter time-constant than the skin conductance signal itself, and that the sudomotor bursts arrive as discrete, separated events. By converting the skin conductance signal into a time-series with a shorter time-constant, we are able to extract the separated peaks in the estimated underlying driver signal. The separated driver peaks are then used to re-estimate each individual skin conductance response. The method is automated and applied to a normative database of 735 subjects, for which skin conductance was measured during an auditory oddball paradigm.}, @@ -344,7 +486,7 @@ @article{Alexander:2005aa title = {Separating individual skin conductance responses in a short interstimulus-interval paradigm}, volume = {146}, year = {2005}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2005.02.001}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2005.02.001}} @article{Lim:1997aa, abstract = {Overlapping phasic skin conductance responses (SCRs) obtained using short interstimulus interval (ISI) paradigms such as those employed in cognitive research, confound measurement of each discrete phasic SCR as well as the tonic skin conductance level (SCL). We report a method of resolving this problem using a modelling technique that takes advantage of the stereotyped nature of the within-subject SCR waveform. A four-parameter sigmoid-exponential SCR model that describes the entire response, was developed and extended to five-, six- and eight-parameter skin conductance (SC) models. These SC models were successfully curve-fitted to more than 60 SC segments, each containing one SCR or two overlapping SCRs on a sloping baseline obtained from 20 normal subjects. The SC segments were consequently decomposed into their components: the tail of the previous response, one or two SCRs and the SCL. The SCRs free of the complication of overlap were then quantified. The raw SCRs of the same data set were also measured using a standard method. The standard measurement showed a significant reduction of 15% in amplitude and 140 ms in peak latency compared to our method. The basic four SCR model parameters--onset time, rise time, decay time constant and gain--showed increasing inter-subject variability in that order. These SCR model parameters may be studied as variables in normal and patient groups and as indices of treatment response. This quantitative method also provides a means to assess the relationships between central and autonomic psychophysiologic measures.}, @@ -363,7 +505,7 @@ @article{Lim:1997aa title = {Decomposing skin conductance into tonic and phasic components}, volume = {25}, year = {1997}, - Bdsk-Url-1 = {https://doi.org/10.1016/s0167-8760(96)00713-1}} + bdsk-url-1 = {https://doi.org/10.1016/s0167-8760(96)00713-1}} @article{Benedek:2010ab, abstract = {Skin conductance (SC) data are usually characterized by a sequence of overlapping phasic skin conductance responses (SCRs) overlying a tonic component. The variability of SCR shapes hereby complicates the proper decomposition of SC data. A method is proposed for full decomposition of SC data into tonic and phasic components. A two-compartment diffusion model was found to adequately describe a standard SCR shape based on the process of sweat diffusion. Nonnegative deconvolution is used to decompose SC data into discrete compact responses and at the same time assess deviations from the standard SCR shape, which could be ascribed to the additional process of pore opening. Based on the result of single non-overlapped SCRs, response parameters can be estimated precisely as shown in a paradigm with varying inter-stimulus intervals.}, @@ -383,7 +525,7 @@ @article{Benedek:2010ab title = {Decomposition of skin conductance data by means of nonnegative deconvolution}, volume = {47}, year = {2010}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2009.00972.x}} + bdsk-url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2009.00972.x}} @article{Benedek:2010aa, abstract = {Electrodermal activity is characterized by the superposition of what appear to be single distinct skin conductance responses (SCRs). Classic trough-to-peak analysis of these responses is impeded by their apparent superposition. A deconvolution approach is proposed, which separates SC data into continuous signals of tonic and phasic activity. The resulting phasic activity shows a zero baseline, and overlapping SCRs are represented by predominantly distinct, compact impulses showing an average duration of less than 2 s. A time integration of the continuous measure of phasic activity is proposed as a straightforward indicator of event-related sympathetic activity. The quality and benefit of the proposed measure is demonstrated in an experiment with short interstimulus intervals as well as by means of a simulation study. The advances compared to previous decomposition methods are discussed.}, @@ -403,7 +545,7 @@ @article{Benedek:2010aa title = {A continuous measure of phasic electrodermal activity}, volume = {190}, year = {2010}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2010.04.028}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2010.04.028}} @article{Daunizeau:2009aa, abstract = {In this paper, we describe a general variational Bayesian approach for approximate inference on nonlinear stochastic dynamic models. This scheme extends established approximate inference on hidden-states to cover: (i) nonlinear evolution and observation functions, (ii) unknown parameters and (precision) hyperparameters and (iii) model comparison and prediction under uncertainty. Model identification or inversion entails the estimation of the marginal likelihood or evidence of a model. This difficult integration problem can be finessed by optimising a free-energy bound on the evidence using results from variational calculus. This yields a deterministic update scheme that optimises an approximation to the posterior density on the unknown model variables. We derive such a variational Bayesian scheme in the context of nonlinear stochastic dynamic hierarchical models, for both model identification and time-series prediction. The computational complexity of the scheme is comparable to that of an extended Kalman filter, which is critical when inverting high dimensional models or long time-series. Using Monte-Carlo simulations, we assess the estimation efficiency of this variational Bayesian approach using three stochastic variants of chaotic dynamic systems. We also demonstrate the model comparison capabilities of the method, its self-consistency and its predictive power.}, @@ -422,7 +564,7 @@ @article{Daunizeau:2009aa title = {Variational {Bayesian} identification and prediction of stochastic nonlinear dynamic causal models}, volume = {238}, year = {2009}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.physd.2009.08.002}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.physd.2009.08.002}} @article{Friston:2000aa, abstract = {There is a growing appreciation of the importance of nonlinearities in evoked responses in fMRI, particularly with the advent of event-related fMRI. These nonlinearities are commonly expressed as interactions among stimuli that can lead to the suppression and increased latency of responses to a stimulus that are incurred by a preceding stimulus. We have presented previously a model-free characterization of these effects using generic techniques from nonlinear system identification, namely a Volterra series formulation. At the same time Buxton et al. (1998) described a plausible and compelling dynamical model of hemodynamic signal transduction in fMRI. Subsequent work by Mandeville et al. (1999) provided important theoretical and empirical constraints on the form of the dynamic relationship between blood flow and volume that underpins the evolution of the fMRI signal. In this paper we combine these system identification and model-based approaches and ask whether the Balloon model is sufficient to account for the nonlinear behaviors observed in real time series. We conclude that it can, and furthermore the model parameters that ensue are biologically plausible. This conclusion is based on the observation that the Balloon model can produce Volterra kernels that emulate empirical kernels. To enable this evaluation we had to embed the Balloon model in a hemodynamic input-state-output model that included the dynamics of perfusion changes that are contingent on underlying synaptic activation. This paper presents (i) the full hemodynamic model (ii), how its associated Volterra kernels can be derived, and (iii) addresses the model's validity in relation to empirical nonlinear characterizations of evoked responses in fMRI and other neurophysiological constraints.}, @@ -441,7 +583,7 @@ @article{Friston:2000aa title = {Nonlinear responses in {fMRI}: the {Balloon} model, {Volterra} kernels, and other hemodynamics}, volume = {12}, year = {2000}, - Bdsk-Url-1 = {http://dx.doi.org/10.1006/nimg.2000.0630}} + bdsk-url-1 = {http://dx.doi.org/10.1006/nimg.2000.0630}} @article{Friston:1998aa, abstract = {This paper presents an approach to characterizing evoked hemodynamic responses in fMRI based on nonlinear system identification, in particular the use of Volterra series. The approach employed enables one to estimate Volterra kernels that describe the relationship between stimulus presentation and the hemodynamic responses that ensue. Volterra series are essentially high-order extensions of linear convolution or "smoothing." These kernels, therefore, represent a nonlinear characterization of the hemodynamic response function that can model the responses to stimuli in different contexts (in this work, different rates of word presentation) and interactions among stimuli. The nonlinear components of the responses were shown to be statistically significant, and the kernel estimates were validated using an independent event-related fMRI experiment. One important manifestation of these nonlinear effects is a modulation of stimulus-specific responses by preceding stimuli that are proximate in time. This means that responses at high-stimulus presentation rates saturate and, in some instances, show an inverted U behavior. This behavior appears to be specific to BOLD effects (as distinct from evoked changes in cerebral blood flow) and may represent a hemodynamic "refractoriness." The aim of this paper is to describe the theory and techniques upon which these conclusions were based and to discuss the implications for experimental design and analysis.}, @@ -460,7 +602,7 @@ @article{Friston:1998aa title = {Nonlinear event-related responses in {fMRI}}, volume = {39}, year = {1998}, - Bdsk-Url-1 = {https://doi.org/10.1002/mrm.1910390109}} + bdsk-url-1 = {https://doi.org/10.1002/mrm.1910390109}} @article{Kunimoto:1992ab, abstract = {Intraneural electrical stimuli (0.3 mA, 0.2 ms) were delivered via a tungsten microelectrode inserted into a cutaneous fascicle in the median nerve at the wrist in 16 normal subjects, and the effects on the sweat glands within the innervation zone were recorded as changes of skin resistance. In order to examine the relationship between the skin resistance level and the amplitude of transient resistance responses, trains of high frequency stimulation were used to reduce the skin resistance level and then transient resistance responses were evoked by single stimuli at 0.1 Hz. Regional anaesthesia of the brachial plexus in the axilla eliminated spontaneous sympathetic activity and reflex effects. At high skin resistance levels response amplitudes to single stimuli were low but they increased successively to a maximum at intermediate levels and then decreased again at low resistance levels. Repeated stimulation sequences evoked qualitatively similar response curves but quantitatively both response amplitudes and skin resistance levels were slightly reduced upon repetition. We suggest that the changes of response amplitudes are due to variable resistivity of the corneal layer. The shifts of the response curves with repetition of stimulation may result from increased hydration of the corneum. It is concluded that the variability of response amplitudes to constant stimuli makes the amplitude of a skin resistance response unsuitable as an indicator of the strength of sympathetic sudomotor nerve traffic.}, @@ -479,7 +621,7 @@ @article{Kunimoto:1992ab title = {Non-linearity of skin resistance response to intraneural electrical stimulation of sudomotor nerves}, volume = {146}, year = {1992}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/j.1748-1716.1992.tb09433.x}} + bdsk-url-1 = {http://dx.doi.org/10.1111/j.1748-1716.1992.tb09433.x}} @article{Kunimoto:1992aa, abstract = {Intraneural electrical stimulation of cutaneous fascicles in the median nerve was performed in 24 normal subjects and the effects on sweating within the innervation zone were monitored as changes of skin resistance and water vapour partial pressure (wvpp). The aims were: (1) to investigate the response variability between repeated stimulation sequences in the same skin site and between different sites and (2) to compare quantitative effects of regular and irregular stimulation on skin resistance and wvpp. Regional axillary anaesthesia of the brachial plexus eliminated spontaneous and reflex sympathetic activity. With repeated irregular stimulation sequences skin resistance responses from the same skin site varied only slightly between trials. Differences between response curves from two skin sites in the same subject or from different subjects were also small but significantly greater (P < 0.01) than differences between responses to repeated stimulation in the same site. Irregular stimulation with average frequencies of 0.49 Hz and 3.51 Hz gave greater resistance responses than if the same number of stimuli were delivered regularly (P < 0.01). The difference was most pronounced at 0.49 Hz. At an average frequency of 0.49 Hz the stimulation usually evoked no changes of wvpp whereas an average frequency of 3.51 Hz caused an increase of wvpp which was greater with irregular than with regular stimulation in all subjects. We conclude that: (1) sweat responses to sudomotor nerve traffic vary slightly due to local factors in the skin or the terminal nerve endings and (2) irregular sudomotor nerve traffic evokes more sweat than if the same impulses occur regularly.}, @@ -498,7 +640,7 @@ @article{Kunimoto:1992aa title = {Neuro-effector characteristics of sweat glands in the human hand activated by irregular stimuli}, volume = {146}, year = {1992}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/j.1748-1716.1992.tb09415.x}} + bdsk-url-1 = {http://dx.doi.org/10.1111/j.1748-1716.1992.tb09415.x}} @article{Kunimoto:1991aa, abstract = {1. Intraneural electrical stimuli (0.3-1.2 mA, 0.2 ms) were delivered via a tungsten microelectrode inserted into a cutaneous fascicle in the median nerve at the wrist in twenty-eight normal subjects. The effects on sweat glands within the innervation zone were monitored as changes of skin resistance and water vapour partial pressure (WVPP). Regional anaesthesia of the brachial plexus in the axilla eliminated spontaneous sympathetic activity and reflex effects. 2. At stimulation frequencies of 0.1 Hz each stimulus evoked a transient skin resistance reduction, the amplitude of which varied initially but reached a steady state of less than 10 k omega after, on average, nine responses. If preceded by stimulation-free intervals of 5 min or more, up to fifteen stimuli were required before the first response occurred. With higher frequencies individual responses started to merge, skin resistance levels decreased successively and levelled off around 10 Hz. The total change of resistance (0-10 Hz) was 101 +/- 46 (n = 9) k omega and the higher the pre-stimulus level, the larger the reduction (r = 0.68, P less than 0.05). 3. Stimulus-response latencies to the onset of a skin resistance reduction (single stimuli or trains of six impulses/20 Hz given at 0.1 Hz) shortened initially but reached steady-state values after on average nine to twelve impulses. Average conduction velocity between stimulating electrode and skin resistance recording site was 0.78 m/s and average time for electrical neuroeffector transfer in sweat glands was estimated to be 348 ms. 4. In addition to direct stimulation-induced resistance responses there were also small spontaneous reductions of resistance. They were seen in all subjects and at all frequencies but were more common in some subjects and occurred predominantly at the beginning of stimulation or at changes of frequency. They occurred independently at two skin sites in the same subject and disappeared during stimulation-free periods and after atropine. 5. With train stimulation (six impulses/20 Hz) at 0.1 Hz, each train evoked transient increases of WVPP of 1 mmHg or less in some subjects (latency around 1.6 s). After averaging weak increases were seen also after single stimuli in two subjects. Increases of stimulation current or frequency led to slowly developing sustained increases of WVPP concomitant with decreases in skin resistance. 6. Responses in skin resistance and WVPP to train stimulation at 0.1 Hz were suppressed in a dose-dependent way by I.V. injections of atropine.(ABSTRACT TRUNCATED AT 400 WORDS)}, @@ -517,7 +659,7 @@ @article{Kunimoto:1991aa title = {Neuroeffector characteristics of sweat glands in the human hand activated by regular neural stimuli}, volume = {442}, year = {1991}, - Bdsk-Url-1 = {https://doi.org/10.1113/jphysiol.1991.sp018799}} + bdsk-url-1 = {https://doi.org/10.1113/jphysiol.1991.sp018799}} @article{Sugenoya:1990aa, abstract = {In a warm environment at ambient temperatures between 25 degrees and 38 degrees C (relative humidity 50%-60%) the relationship between sympathetic activity in cutaneous nerves (SSA) and pulses of sweat expulsion was investigated in five young male subjects. The SSA was recorded from the peroneal nerve using a micro-electrode. Sweat expulsion was identified on the sweat rate records obtained from skin areas on the dorsal side of the foot, for spontaneous sweating and drug-induced sweating, using capacitance hygrometry. Sweat expulsion was always preceded by bursts of SSA with latencies of 2.4-3.0 s. This temporal relationship between bursts of SSA and sweat expulsion was noted not only in various degrees of thermal sweating but also in the sweating evoked by arousal stimuli, or by painful electric stimulation. The amplitude of the sudomotor burst was linearly related to the maximal rate of increase of the corresponding sweat expulsion, the amplitude of the expulsion and the integrated amount of sweat produced for the duration of the expulsion. The results provide direct evidence that sweat expulsion reflects directly centrally-derived sudomotor activity.}, @@ -535,7 +677,7 @@ @article{Sugenoya:1990aa title = {Identification of sudomotor activity in cutaneous sympathetic nerves using sweat expulsion as the effector response}, volume = {61}, year = {1990}, - Bdsk-Url-1 = {https://doi.org/10.1007/BF00357617}} + bdsk-url-1 = {https://doi.org/10.1007/BF00357617}} @article{Bini:1980aa, abstract = {1. Recordings of multiunit sympathetic activity were made from human nerve fascicles supplying hairy and glabrous skin of the extremities in healthy subjects exposed to different ambient temperatures. Sudomotor and vasomotor events accompanying the neural activity were monitored by simultaneous recordings of electrodermal and pulse plethysmographic events (Pleth) in the neural innervation zones. 2. By exposing the subject to warm (43 degrees C) or cold (15 degrees C) environments, it was possible to obtain a selective activation of either the sudomotor or the vasoconstrictor neural system, respectively, with suppression of spontaneous activity in the other system. 3. Bursts of both vasoconstrictor and sudomotor nerve activity were found to occur at certain preferred intervals which were integer multiples of a period of about 0 . 6 sec (100 cycles/min). With high sudomotor or vasoconstrictor tone the 100 cycles/min rhythm was prominent but with decreasing tone slower subharmonic rhythms prevailed. Respiratory rhythms were also discerned as well as slower rhythms attributable to oscillatory tendencies in thermoregulatory servos. 4. Vasoconstrictor bursts had longer mean duration than sudomotor bursts, a finding attributed to a slower conduction velocity of vasoconstrictor as compared to sudomotor impulses. 5. With increasing incidence of bursts transient electrodermal or plethysmographic responses following individual bursts merged, and thus the fast neural rhythms were not discernible in either the electrodermal or Pleth traces. Given increments in firing rate of nerves produced less additional vasoconstriction at high than at low firing rates. The rhythm generating mechanisms may help to restrict rates of individual fibres to the low range which provides high gain in the neuroeffector transfer functions.}, @@ -554,7 +696,7 @@ @article{Bini:1980aa title = {Thermoregulatory and rhythm-generating mechanisms governing the sudomotor and vasoconstrictor outflow in human cutaneous nerves}, volume = {306}, year = {1980}, - Bdsk-Url-1 = {https://doi.org/10.1113/jphysiol.1980.sp013413}} + bdsk-url-1 = {https://doi.org/10.1113/jphysiol.1980.sp013413}} @article{Bach:2014ab, abstract = {A recent paper by Henderson et al. (2012) claimed that skin sympathetic nerve activity (SSNA) can not be retrieved from skin conductance responses (SCR). Here, I argue that this claim is not supported by the literature, and comment on contemporary approaches of estimating SSNA from SCR using biophysical models.}, @@ -573,7 +715,7 @@ @article{Bach:2014ab title = {Sympathetic nerve activity can be estimated from skin conductance responses - a comment on {Henderson} et al. (2012)}, volume = {84}, year = {2014}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2013.08.030}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2013.08.030}} @article{Bach:2009aa, abstract = {Event-related skin conductance responses (SCRs) are traditionally analysed by comparing the amplitude of individual peaks against a pre-stimulus baseline. Many experimental manipulations in cognitive neuroscience dictate paradigms with short inter trial intervals, precluding accurate baseline estimation for SCR measurements. Here, we present a novel and general approach to SCR analysis, derived from methods used in neuroimaging that estimate responses using a linear convolution model. In effect, the method obviates peak-scoring and makes use of the full SCR. We demonstrate, across three experiments, that the method has face validity in analysing reactions to a loud white noise and emotional pictures, can be generalised to paradigms where the shape of the response function is unknown and can account for parametric trial-by-trial effects. We suggest our approach provides greater flexibility in analysing SCRs than existing methods.}, @@ -593,7 +735,7 @@ @article{Bach:2009aa title = {Time-series analysis for rapid event-related skin conductance responses}, volume = {184}, year = {2009}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2009.08.005}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jneumeth.2009.08.005}} @article{Bach:2010ad, abstract = {Analytic tools for psychophysiological signals often make implicit assumptions that are unspecified. In developing a mathematical framework for analysis of skin conductance responses [SCRs], we formalise our assumptions by positing that SCRs can be regarded as the output of a linear time-invariant filter. Here, we provide an empirical test of these assumptions. Our findings indicate that a large component of the variance in SCRs can be explained by one response function per individual. We note that baseline variance (i.e. variance in the absence of evoked responses) is higher than variance that could not be explained by a linear time-invariant model of evoked responses. Furthermore, there was no evidence for nonlinear interactions among evoked responses that depended on their temporal overlap. We develop a canonical response function and show that it can be used for signals from different recording sites. We discuss the implications of these observations for model-based analysis of SCRs.}, @@ -613,7 +755,7 @@ @article{Bach:2010ad title = {Modelling event-related skin conductance responses}, volume = {75}, year = {2010}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.ijpsycho.2010.01.005}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.ijpsycho.2010.01.005}} @article{Bach:2010ac, abstract = {Autonomic arousal is often indexed by spontaneous fluctuations in skin conductance. Here, we derive a simple measure of sympathetic arousal, using a convolution model of how sudomotor bursting causes fluctuations in skin conductivity. Under this model, the time-integral of measured conductance is proportional to the frequency and amplitude of sudomotor bursts. We demonstrate the validity of this measure in relation to finite impulse response models, and show that it is a better predictor of autonomic arousal, relative to conventional measures.}, @@ -633,7 +775,7 @@ @article{Bach:2010ac title = {Analytic measures for quantification of arousal from spontaneous skin conductance fluctuations}, volume = {76}, year = {2010}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.ijpsycho.2010.01.011}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.ijpsycho.2010.01.011}} @article{Bach:2011a, abstract = {Spontaneous fluctuations (SF) in skin conductance are often used to index sympathetic arousal and emotional states. SF are caused by sudomotor nerve activity (SNA), which is a direct indicator of sympathetic arousal. Here, we describe a dynamic causal model (DCM) of how SNA causes SF, and apply variational Bayesian model inversion to infer SNA, given empirically observed SF. The estimated SNA bears a relationship to the number of SF as derived from conventional (semi-visual) analysis. Crucially, we show that, during public speaking induced anxiety, the estimated number of SNA bursts is a better predictor of the (known) psychological state than the number of SF. We suggest dynamic causal modeling of SF potentially allows a more precise and informed inference about arousal than purely descriptive methods.}, @@ -652,7 +794,7 @@ @article{Bach:2011a title = {Dynamic causal modeling of spontaneous fluctuations in skin conductance}, volume = {48}, year = {2011}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2010.01052.x}} + bdsk-url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2010.01052.x}} @article{Bach:2010aa, abstract = {Anticipatory skin conductance responses [SCRs] are a widely used measure of aversive conditioning in humans. Here, we describe a dynamic causal model [DCM] of how anticipatory, evoked, and spontaneous skin conductance changes are generated by sudomotor nerve activity. Inversion of this model, using variational Bayes, provides a means of inferring the most likely sympathetic nerve activity, given observed skin conductance responses. In two fear conditioning experiments, we demonstrate the predictive validity of the DCM by showing it has greater sensitivity to the effects of conditioning, relative to alternative (conventional) response estimates. Furthermore, we establish face validity by showing that trial-by-trial estimates of anticipatory sudomotor activity are better predicted by formal learning models, relative to response estimates from peak-scoring approaches. The model furnishes a potentially powerful approach to characterising SCR that exploits knowledge about how these signals are generated.}, @@ -672,7 +814,7 @@ @article{Bach:2010aa title = {Dynamic causal modelling of anticipatory skin conductance responses}, volume = {85}, year = {2010}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2010.06.007}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2010.06.007}} @article{Bach:2012aa, abstract = {Recently, the existence of a prediction error signal to the omission of expected punishment in skin conductance recordings has been posited. Here, we re-analyse an existing dataset on aversive delay conditioning and find no evidence for such a signal. We discuss methodical reasons for this discrepancy and technical implications for estimation of central processes from skin conductance data.}, @@ -691,7 +833,7 @@ @article{Bach:2012aa title = {No evidence for a negative prediction error signal in peripheral indicators of sympathetic arousal}, volume = {59}, year = {2012}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2011.08.091}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.neuroimage.2011.08.091}} @article{Bach:2013ab, abstract = {The empirical investigation of unobservable psychological processes usually rests on operational definitions. As an alternative, we propose the use of explicit causal models. This is particularly useful in psychophysiology, where formal models can be expressed mathematically, exploiting biophysical constraints, and inverted to yield estimates of unobservable processes. In psychophysiology, recent advances have been made in causal modeling for skin conductance responses, which we discuss to exemplify the development of such models. Empirical evidence suggests that these methods have a greater validity compared to operational approaches. This review concludes by considering the theoretical implications for the field of psychophysiology and benefits for practical data analysis.}, @@ -710,7 +852,7 @@ @article{Bach:2013ab title = {Model-based analysis of skin conductance responses: {Towards} causal models in psychophysiology}, volume = {50}, year = {2013}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2012.01483.x}} + bdsk-url-1 = {http://dx.doi.org/10.1111/j.1469-8986.2012.01483.x}} @article{Bach:2013aa, abstract = {Model-based analysis of psychophysiological signals is more robust to noise - compared to standard approaches - and may furnish better predictors of psychological state, given a physiological signal. We have previously established the improved predictive validity of model-based analysis of evoked skin conductance responses to brief stimuli, relative to standard approaches. Here, we consider some technical aspects of the underlying generative model and demonstrate further improvements. Most importantly, harvesting between-subject variability in response shape can improve predictive validity, but only under constraints on plausible response forms. A further improvement is achieved by conditioning the physiological signal with high pass filtering. A general conclusion is that precise modelling of physiological time series does not markedly increase predictive validity; instead, it appears that a more constrained model and optimised data features provide better results, probably through a suppression of physiological fluctuation that is not caused by the experiment.}, @@ -731,7 +873,7 @@ @article{Bach:2013aa title = {An improved algorithm for model-based analysis of evoked skin conductance responses}, volume = {94}, year = {2013}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2013.09.010}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.biopsycho.2013.09.010}} @article{Korn:2016a, abstract = {Pupil size is often used to infer central processes, including attention, memory, and emotion. Recent research has spotlighted its relation to behavioral variables from decision-making models and to neural variables such as locus coeruleus activity and cortical oscillations. As yet, a unified and principled approach for analyzing pupil responses is lacking. Here we seek to establish a formal, quantitative forward model for pupil responses by describing them with linear time-invariant systems. Based on empirical data from human participants, we show that a combination of two linear time-invariant systems can parsimoniously explain approximately all variance evoked by illuminance changes. Notably, the model makes a counterintuitive prediction that pupil constriction dominates the responses to darkness flashes, as in previous empirical reports. This prediction was quantitatively confirmed for responses to light and darkness flashes in an independent group of participants. Crucially, illuminance- and nonilluminance-related inputs to the pupillary system are presumed to share a common final pathway, composed of muscles and nerve terminals. Hence, we can harness our illuminance-based model to estimate the temporal evolution of this neural input for an auditory-oddball task, an emotional-words task, and a visual-detection task. Onset and peak latencies of the estimated neural inputs furnish plausible hypotheses for the complexity of the underlying neural circuit. To conclude, this mathematical description of pupil responses serves as a prerequisite to refining their relation to behavioral and brain indices of cognitive processes.}, @@ -751,7 +893,7 @@ @article{Korn:2016a urldate = {2016-06-16}, volume = {16}, year = {2016}, - Bdsk-Url-1 = {http://dx.doi.org/10.1167/16.3.28}} + bdsk-url-1 = {http://dx.doi.org/10.1167/16.3.28}} @article{Hayes:2015a, abstract = {Pupil size is correlated with a wide variety of important cognitive variables and is increasingly being used by cognitive scientists. Pupil data can be recorded inexpensively and non-invasively by many commonly used video-based eye-tracking cameras. Despite the relative ease of data collection and increasing prevalence of pupil data in the cognitive literature, researchers often underestimate the methodological challenges associated with controlling for confounds that can result in misinterpretation of their data. One serious confound that is often not properly controlled is pupil foreshortening error (PFE)---the foreshortening of the pupil image as the eye rotates away from the camera. Here we systematically map PFE using an artificial eye model and then apply a geometric model correction. Three artificial eyes with different fixed pupil sizes were used to systematically measure changes in pupil size as a function of gaze position with a desktop EyeLink 1000 tracker. A grid-based map of pupil measurements was recorded with each artificial eye across three experimental layouts of the eye-tracking camera and display. Large, systematic deviations in pupil size were observed across all nine maps. The measured PFE was corrected by a geometric model that expressed the foreshortening of the pupil area as a function of the cosine of the angle between the eye-to-camera axis and the eye-to-stimulus axis. The model reduced the root mean squared error of pupil measurements by 82.5 \% when the model parameters were pre-set to the physical layout dimensions, and by 97.5 \% when they were optimized to fit the empirical error surface.}, @@ -770,7 +912,7 @@ @article{Hayes:2015a urldate = {2016-06-16}, volume = {48}, year = {2015}, - Bdsk-Url-1 = {http://dx.doi.org/10.3758/s13428-015-0588-x}} + bdsk-url-1 = {http://dx.doi.org/10.3758/s13428-015-0588-x}} @article{Paulus:2016aa, author = {Philipp C. Paulus and Giuseppe Castegnetti and Dominik R. Bach}, @@ -785,7 +927,7 @@ @article{Paulus:2016aa title = {Modeling event-related heart period responses}, volume = {53}, year = {2016}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/psyp.12622}} + bdsk-url-1 = {http://dx.doi.org/10.1111/psyp.12622}} @article{Castegnetti:2016aa, author = {Giuseppe Castegnetti and Athina Tzovara and Matthias Staib and Philipp C. Paulus and Nicolas Hofer and Dominik R. Bach}, @@ -800,7 +942,7 @@ @article{Castegnetti:2016aa title = {Modeling fear-conditioned bradycardia in humans}, volume = {53}, year = {2016}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/psyp.12637}} + bdsk-url-1 = {http://dx.doi.org/10.1111/psyp.12637}} @article{Bradley:2001, author = {Margaret M. Bradley and Maurizio Codispoti and Bruce N. Cuthbert and Peter J. Lang}, @@ -814,7 +956,7 @@ @article{Bradley:2001 title = {Emotion and motivation {I}: {Defensive} and appetitive reactions in picture processing.}, volume = {1}, year = {2001}, - Bdsk-Url-1 = {http://dx.doi.org/10.1037/1528-3542.1.3.276}} + bdsk-url-1 = {http://dx.doi.org/10.1037/1528-3542.1.3.276}} @article{McDougal:2008aa, author = {McDougal, DH and Gamlin, PDR}, @@ -837,7 +979,7 @@ @article{Watson:2012aa title = {A unified formula for light-adapted pupil size}, volume = {12}, year = {2012}, - Bdsk-Url-1 = {http://dx.doi.org/10.1167/12.10.12}} + bdsk-url-1 = {http://dx.doi.org/10.1167/12.10.12}} @article{Castegnetti:2016ab, abstract = {Respiratory physiology is influenced by cognitive processes. It has been suggested that some cognitive states may be inferred from respiration amplitude responses (RAR) after external events. Here, we investigate whether RAR allow assessment of fear memory in cued fear conditioning, an experimental model of aversive learning. To this end, we built on a previously developed psychophysiological model (PsPM) of RAR, which regards interpolated RAR time series as the output of a linear time invariant system. We first establish that average RAR after CS+ and CS- are different. We then develop the response function of fear-conditioned RAR, to be used in our PsPM. This PsPM is inverted to yield estimates of cognitive input into the respiratory system. We analyze five validation experiments involving fear acquisition and retention, delay and trace conditioning, short and medium CS-US intervals, and data acquired with bellows and MRI-compatible pressure chest belts. In all experiments, CS+ and CS- are distinguished by their estimated cognitive inputs, and the sensitivity of this distinction is higher for model-based estimates than for peak scoring of RAR. Comparing these data with skin conductance responses (SCR) and heart period responses (HPR), we find that, on average, RAR performs similar to SCR in distinguishing CS+ and CS-, but is less sensitive than HPR. Overall, our work provides a novel and robust tool to investigate fear memory in humans that may allow wide and straightforward application to diverse experimental contexts.}, @@ -850,7 +992,7 @@ @article{Castegnetti:2016ab title = {Assessing fear learning via conditioned respiratory amplitude responses}, volume = {54}, year = {2017}, - Bdsk-Url-1 = {https://doi.org/10.1111/psyp.12778}} + bdsk-url-1 = {https://doi.org/10.1111/psyp.12778}} @article{Khemka:2016a, author = {Saurabh Khemka and Athina Tzovara and Samuel Gerster and Boris B. Quednow and Dominik R. Bach}, @@ -866,7 +1008,7 @@ @article{Khemka:2016a url = {http://dx.doi.org/10.1111/psyp.12775}, volume = {54}, year = {2017}, - Bdsk-Url-1 = {http://dx.doi.org/10.1111/psyp.12775}} + bdsk-url-1 = {http://dx.doi.org/10.1111/psyp.12775}} @article{Kirno:1991aa, abstract = {To study the relationship between skin sympathetic nerve activity and changes in skin resistance (galvanic skin response--GSR), efferent sympathetic and sensory nerves to the hand were blocked by an axillary nerve blockade in 15 healthy subjects. Subsequently, intraneural electrical stimuli in the median nerve distal to the axillary nerve block were used to evoke changes in skin resistance and in water vapor partial pressure in the sensory and sympathetically denervated hand. With increasing frequency of stimulation, skin resistance decreased and water vapor partial pressure increased until stimuli exceeded 10 Hz. When an additional burst of impulses was added to the background stimulation, GSR amplitude varied in a nonlinear fashion with the background frequency. Stimulation-induced GSR was completely abolished in a dose-dependent manner by systemically (intravenously) administered atropine. The results indicate that GSR depends on the preceding level of nerve traffic in the sympathetic sudomotor nerve fibers. Consequently, skin resistance recordings cannot be used to quantify sympathetic nerve traffic and thus do not express the completeness of sympathetic blockade in regional anesthesia.}, @@ -897,7 +1039,7 @@ @article{Yeomans:2002aa title = {Tactile, acoustic and vestibular systems sum to elicit the startle reflex}, volume = {26}, year = {2002}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/s0149-7634(01)00057-4}} + bdsk-url-1 = {http://dx.doi.org/10.1016/s0149-7634(01)00057-4}} @inbook{Lang:1997aa, address = {Mahwah, NJ}, @@ -926,7 +1068,7 @@ @article{Bach:2015ac title = {A cost minimisation and {Bayesian} inference model predicts startle reflex modulation across species}, volume = {370}, year = {2015}, - Bdsk-Url-1 = {http://dx.doi.org/10.1016/j.jtbi.2015.01.031}} + bdsk-url-1 = {http://dx.doi.org/10.1016/j.jtbi.2015.01.031}} @article{Brown:1951aa, author = {Judson S. Brown and Harry I. Kalish and I. E. Farber}, @@ -939,7 +1081,7 @@ @article{Brown:1951aa title = {Conditioned fear as revealed by magnitude of startle response to an auditory stimulus}, volume = {41}, year = {1951}, - Bdsk-Url-1 = {http://dx.doi.org/10.1037/h0060166}} + bdsk-url-1 = {http://dx.doi.org/10.1037/h0060166}} @article{Korn:2017a, abstract = {During fear conditioning, pupil size responses dissociate between conditioned stimuli that are contingently paired (CS+) with an aversive unconditioned stimulus, and those that are unpaired (CS-). Current approaches to assess fear learning from pupil responses rely on ad hoc specifications. Here, we sought to develop a psychophysiological model (PsPM) in which pupil responses are characterized by response functions within the framework of a linear time-invariant system. This PsPM can be written as a general linear model, which is inverted to yield amplitude estimates of the eliciting process in the central nervous system. We first characterized fear-conditioned pupil size responses based on an experiment with auditory CS. PsPM-based parameter estimates distinguished CS+/CS- better than, or on par with, two commonly used methods (peak scoring, area under the curve). We validated this PsPM in four independent experiments with auditory, visual, and somatosensory CS, as well as short (3.5 s) and medium (6 s) CS/US intervals. Overall, the new PsPM provided equal or decisively better differentiation of CS+/CS- than the two alternative methods and was never decisively worse. We further compared pupil responses with concurrently measured skin conductance and heart period responses. Finally, we used our previously developed luminance-related pupil responses to infer the timing of the likely neural input into the pupillary system. Overall, we establish a new PsPM to assess fear conditioning based on pupil responses. The model has a potential to provide higher statistical sensitivity, can be applied to other conditioning paradigms in humans, and may be easily extended to nonhuman mammals.}, @@ -959,8 +1101,8 @@ @article{Korn:2017a urldate = {2017-01-05}, volume = {54}, year = {2017}, - Bdsk-Url-1 = {http://onlinelibrary.wiley.com/doi/10.1111/psyp.12801/abstract}, - Bdsk-Url-2 = {http://dx.doi.org/10.1111/psyp.12801}} + bdsk-url-1 = {http://onlinelibrary.wiley.com/doi/10.1111/psyp.12801/abstract}, + bdsk-url-2 = {http://dx.doi.org/10.1111/psyp.12801}} @book{Pinheiro:2000aa, address = {New York}, @@ -973,7 +1115,7 @@ @book{Pinheiro:2000aa title = {Mixed-{Effects} {Models} in {S} and {S}-{PLUS}}, url = {http://link.springer.com/10.1007/b98882}, year = {2000}, - Bdsk-Url-1 = {http://link.springer.com/10.1007/b98882}} + bdsk-url-1 = {http://link.springer.com/10.1007/b98882}} @article{Bach:2017aa, abstract = {Learning to predict threat is a fundamental ability of many biological organisms, and a laboratory model for anxiety disorders. Interfering with such memories in humans would be of high clinical relevance. On the basis of studies in cell cultures and slice preparations, it is hypothesised that synaptic remodelling required for threat learning involves the extracellular enzyme matrix metalloproteinase (MMP) 9. However, in vivo evidence for this proposal is lacking. Here we investigate human Pavlovian fear conditioning under the blood--brain barrier crossing MMP inhibitor doxycyline in a pre-registered, randomised, double-blind, placebo-controlled trial. We find that recall of threat memory, measured with fear-potentiated startle 7 days after acquisition, is attenuated by {\textasciitilde}60\% in individuals who were under doxycycline during acquisition. This threat memory impairment is also reflected in increased behavioural surprise signals to the conditioned stimulus during subsequent re-learning, and already late during initial acquisition. Our findings support an emerging view that extracellular signalling pathways are crucially required for threat memory formation. Furthermore, they suggest novel pharmacological methods for primary prevention and treatment of posttraumatic stress disorder.}, @@ -992,8 +1134,8 @@ @article{Bach:2017aa urldate = {2017-10-06}, volume = {23}, year = {2017}, - Bdsk-Url-1 = {http://www.nature.com/mp/journal/vaop/ncurrent/full/mp201765a.html?foxtrotcallback=true}, - Bdsk-Url-2 = {http://dx.doi.org/10.1038/mp.2017.65}} + bdsk-url-1 = {http://www.nature.com/mp/journal/vaop/ncurrent/full/mp201765a.html?foxtrotcallback=true}, + bdsk-url-2 = {http://dx.doi.org/10.1038/mp.2017.65}} @article{Gerster:2017aa, abstract = {Skin conductance responses (SCR) are increasingly analyzed with model-based approaches that assume a linear and time-invariant (LTI) mapping from sudomotor nerve (SN) activity to observed SCR. These LTI assumptions have previously been validated indirectly, by quantifying how much variance in SCR elicited by sensory stimulation is explained under an LTI model. This approach, however, collapses sources of variability in the nervous and effector organ systems. Here, we directly focus on the SN/SCR mapping by harnessing two invasive methods. In an intraneural recording experiment, we simultaneously track SN activity and SCR. This allows assessing the SN/SCR relationship but possibly suffers from interfering activity of non-SN sympathetic fibers. In an intraneural stimulation experiment under regional anesthesia, such influences are removed. In this stimulation experiment, about 95\% of SCR variance is explained under LTI assumptions when stimulation frequency is below 0.6 Hz. At higher frequencies, nonlinearities occur. In the intraneural recording experiment, explained SCR variance is lower, possibly indicating interference from non-SN fibers, but higher than in our previous indirect tests. We conclude that LTI systems may not only be a useful approximation but in fact a rather accurate description of biophysical reality in the SN/SCR system, under conditions of low baseline activity and sporadic external stimuli. Intraneural stimulation under regional anesthesia is the most sensitive method to address this question.}, @@ -1010,8 +1152,8 @@ @article{Gerster:2017aa url = {http://onlinelibrary.wiley.com/doi/10.1111/psyp.12986/abstract}, volume = {55}, year = {2017}, - Bdsk-Url-1 = {http://onlinelibrary.wiley.com/doi/10.1111/psyp.12986/abstract}, - Bdsk-Url-2 = {http://dx.doi.org/10.1111/psyp.12986}} + bdsk-url-1 = {http://onlinelibrary.wiley.com/doi/10.1111/psyp.12986/abstract}, + bdsk-url-2 = {http://dx.doi.org/10.1111/psyp.12986}} @article{Kleckner:2017a, author = {I. R. {Kleckner} and R. M. {Jones} and O. {Wilder-Smith} and J. B. {Wormwood} and M. {Akcakaya} and K. S. {Quigley} and C. {Lord} and M. S. {Goodwin}}, @@ -1027,7 +1169,7 @@ @article{Kleckner:2017a title = {Simple, Transparent, and Flexible Automated Quality Assessment Procedures for Ambulatory Electrodermal Activity Data}, volume = {65}, year = {2018}, - Bdsk-Url-1 = {http://dx.doi.org/10.1109/TBME.2017.2758643}} + bdsk-url-1 = {http://dx.doi.org/10.1109/TBME.2017.2758643}} @article{liu2012statistical, author = {Liu, Zhongming and de Zwart, Jacco A and van Gelderen, Peter and Kuo, Li-Wei and Duyn, Jeff H}, @@ -1040,7 +1182,7 @@ @article{liu2012statistical title = {Statistical feature extraction for artifact removal from concurrent {fMRI-EEG} recordings}, volume = {59}, year = {2012}, - Bdsk-Url-1 = {https://doi.org/10.1016/j.neuroimage.2011.10.042}} + bdsk-url-1 = {https://doi.org/10.1016/j.neuroimage.2011.10.042}} @article{kret2018preprocessing, author = {Kret, Mariska E and Sjak-Shie, Elio E}, @@ -1053,4 +1195,4 @@ @article{kret2018preprocessing title = {Preprocessing pupil size data: Guidelines and code}, volume = {51}, year = {2018}, - Bdsk-Url-1 = {https://doi.org/10.3758/s13428-018-1075-y}} + bdsk-url-1 = {https://doi.org/10.3758/s13428-018-1075-y}} diff --git a/doc/PsPM_Developers_Guide.lyx b/doc/PsPM_Developers_Guide.lyx index b5a21d6eb..6fe5e866a 100644 --- a/doc/PsPM_Developers_Guide.lyx +++ b/doc/PsPM_Developers_Guide.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 620 \begin_document \begin_header \save_transient_properties true @@ -20,11 +20,11 @@ \usepackage{enumitem} \setlist[itemize]{noitemsep} \end_preamble \use_default_options true -\maintain_unincluded_children false +\maintain_unincluded_children no \language english \language_package default \inputencoding utf8 -\fontencoding global +\fontencoding auto \font_roman "default" "default" \font_sans "default" "default" \font_typewriter "default" "default" @@ -32,7 +32,9 @@ \font_default_family default \use_non_tex_fonts false \font_sc false -\font_osf false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false @@ -66,7 +68,9 @@ \suppress_date false \justification true \use_refstyle 1 +\use_formatted_ref 0 \use_minted 0 +\use_lineno 0 \index Index \shortcut idx \color #008000 @@ -83,18 +87,24 @@ \papercolumns 1 \papersides 1 \paperpagestyle default +\tablestyle default \listings_params "language=Matlab,float=hbp,basicstyle={\footnotesize\ttfamily},identifierstyle={\color{colIdentifier}},keywordstyle={\color{colKeys}},stringstyle={\color{colString}},commentstyle={\itshape\color{colComments}},columns=fixed,tabsize=2,extendedchars=true,showspaces=false,showstringspaces=false,captionpos=t,backgroundcolor={\color{white}},framexleftmargin=1pt,frame=l" \tracking_changes false \output_changes false +\change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 \end_header \begin_body \begin_layout Title -PsPM: Psychophysiological Modelling +PsPM: + Psychophysiological Modelling \end_layout \begin_layout Title @@ -121,8 +131,9 @@ status open \begin_layout Plain Layout \noindent -If you have comments on or error corrections to this documentation, please - send them to the PsPM team or post them on: +If you have comments on or error corrections to this documentation, + please send them to the PsPM team or post them on: + \begin_inset CommandInset href LatexCommand href name "bachlab.org/pspm" @@ -143,9 +154,23 @@ literal "false" \begin_layout Standard \align center -Dominik R Bach, Giuseppe Castegnetti, Laure Ciernik, Samuel Gerster, Saurabh - Khemka, Christoph Korn, Samuel Maxwell, Tobias Moser, Philipp C Paulus, - Ivan Rojkov, Matthias Staib, Eshref Yozdemir, Teddy Zhao and collaborators +Dominik R Bach, + Giuseppe Castegnetti, + Laure Ciernik, + Samuel Gerster, + Uzay Gökay, + Saurabh Khemka, + Christoph Korn, + Samuel Maxwell, + Tobias Moser, + Philipp C Paulus, + Ivan Rojkov, + Matthias Staib, + Bernhard Agoué von Raußendorf, + Yanfang Xia, + Eshref Yozdemir, + Teddy Zhao, + and collaborators \end_layout \begin_layout Standard @@ -178,18 +203,19 @@ Contributed by Teddy Zhao in April 2023 \end_layout \begin_layout Standard -PsychoPhysiological Modelling, abbreviated as PsPM, is a software package - for model-based analysis of psychophysiological signals. - PsPM can be accessed through either graphical user interface (GUI) or command - lines. - PsPM is written in MATLAB language, thus it supports cross platform usages, - either Windows, macOS or Linux, and can be easily utilised in customised - shell scripts. - PsPM is actively updated and maintained by bringing new features and fixing - bugs, thus the latest version of PsPM is always encouraged for users. - The recommended version of MATLAB for running PsPM is MATLAB 2023a (version - 9.14), and the earliest version of MATLAB that could be used for running - PsPM is MATLAB 2006a (version 7.2). +PsychoPhysiological Modelling, + abbreviated as PsPM, + is a software package for model-based analysis of psychophysiological signals. + PsPM can be accessed through either graphical user interface (GUI) or command lines. + PsPM is written in MATLAB language, + thus it supports cross platform usages, + either Windows, + macOS or Linux, + and can be easily utilised in customised shell scripts. + PsPM is actively updated and maintained by bringing new features and fixing bugs, + thus the latest version of PsPM is always encouraged for users. + The recommended version of MATLAB for running PsPM is MATLAB 2023a (version 9.14), + and the earliest version of MATLAB that could be used for running PsPM is MATLAB 2006a (version 7.2). \end_layout \begin_layout Section @@ -209,7 +235,8 @@ Data files \end_layout \begin_layout Standard -In PsPM, data and information is stored as +In PsPM, + data and information is stored as \family typewriter struct \family default @@ -222,8 +249,9 @@ mat \family typewriter struct \family default - may contain mutiple cells, and each cell contains a struct with channel - specific fields, + may contain mutiple cells, + and each cell contains a struct with channel specific fields, + \family typewriter infos \family default @@ -232,7 +260,8 @@ infos data \family default . - Specifically, + Specifically, + \family typewriter infos \family default @@ -240,7 +269,8 @@ infos \family typewriter struct \family default - variable with general information, and + variable with general information, + and \family typewriter data \family default @@ -257,12 +287,13 @@ infos \family typewriter data \family default - have the following mandatory subfields, whilst + have the following mandatory subfields, + whilst \family typewriter infos \family default - may have some optional subfields that can be defined if necessary, as is - shown in + may have some optional subfields that can be defined if necessary, + as is shown in \series bold Table 1 \series default @@ -363,7 +394,8 @@ duration \begin_inset Text \begin_layout Plain Layout -The duration of the acquired data, normally defined in seconds +The duration of the acquired data, + normally defined in seconds \end_layout \end_inset @@ -405,7 +437,8 @@ header.channeltype \begin_inset Text \begin_layout Plain Layout -The type of the corresponding channel, as defined in the settings. +The type of the corresponding channel, + as defined in the settings. \end_layout \end_inset @@ -445,8 +478,8 @@ header.sr \begin_inset Text \begin_layout Plain Layout -the sample rate (or frequency) in 1/second (or Hz), or timestamp units in - seconds +the sample rate (or frequency) in 1/second (or Hz), + or timestamp units in seconds \end_layout \end_inset @@ -486,7 +519,8 @@ header.units \begin_inset Text \begin_layout Plain Layout -the unit of data, or the `events' +the unit of data, + or the `events' \end_layout \end_inset @@ -782,7 +816,8 @@ rectime \end_layout \begin_layout Standard -In most cases, only the subfield +In most cases, + only the subfield \family typewriter data \family default @@ -790,9 +825,9 @@ data \family typewriter data \family default - will be modified since new results have been generated and are expected - to replace the old data. - All the other fields, for both + will be modified since new results have been generated and are expected to replace the old data. + All the other fields, + for both \family typewriter data \family default @@ -800,18 +835,21 @@ data \family typewriter infos \family default -, the content will be kept unchanged. - However, some data manipulation functions, for example +, + the content will be kept unchanged. + However, + some data manipulation functions, + for example \family typewriter pspm_trim \family default -, will update +, + will update \family typewriter infos \family default to record some file history. - Please check the specific descriptions of each function for understanding - how + Please check the specific descriptions of each function for understanding how \family typewriter data \family default @@ -822,6 +860,526 @@ infos will be updated. \end_layout +\begin_layout Subsection +Types of functions in PsPM +\end_layout + +\begin_layout Subsubsection +Interactive functions +\end_layout + +\begin_layout Itemize +pspm_data_editor +\end_layout + +\begin_layout Itemize +pspm_display +\end_layout + +\begin_layout Itemize +pspm_ecg_editor +\end_layout + +\begin_layout Itemize +pspm_guide +\end_layout + +\begin_layout Itemize +pspm_review +\end_layout + +\begin_layout Subsubsection +Functions that create data files +\end_layout + +\begin_layout Itemize +pspm_import +\end_layout + +\begin_layout Itemize +pspm_trim +\end_layout + +\begin_layout Itemize +pspm_split_sessions +\end_layout + +\begin_layout Itemize +pspm_merge +\end_layout + +\begin_layout Itemize +pspm_ren +\end_layout + +\begin_layout Itemize +pspm_interpolate (only if run on all channels) +\end_layout + +\begin_layout Subsubsection +Functions that change channels +\end_layout + +\begin_layout Itemize +pspm_combine_markerchannels +\end_layout + +\begin_layout Itemize +pspm_convert_area2diameter +\end_layout + +\begin_layout Itemize +pspm_convert_au2unit +\end_layout + +\begin_layout Itemize +pspm_convert_ecg2hb +\end_layout + +\begin_layout Itemize +pspm_convert_ecg2hb_amri +\end_layout + +\begin_layout Itemize +pspm_convert_gaze +\end_layout + +\begin_layout Itemize +pspm_convert_hb2hp +\end_layout + +\begin_layout Itemize +pspm_convert_ppg2hb +\end_layout + +\begin_layout Itemize +pspm_emg_pp +\end_layout + +\begin_layout Itemize +pspm_find_sounds +\end_layout + +\begin_layout Itemize +pspm_find_valid_fixations +\end_layout + +\begin_layout Itemize +pspm_gaze_pp +\end_layout + +\begin_layout Itemize +pspm_interpolate +\end_layout + +\begin_layout Itemize +pspm_pp +\end_layout + +\begin_layout Itemize +pspm_pupil_correct_eyelink +\end_layout + +\begin_layout Itemize +pspm_pupil_pp +\end_layout + +\begin_layout Itemize +pspm_remove_epochs +\end_layout + +\begin_layout Itemize +pspm_resp_pp +\end_layout + +\begin_layout Itemize +pspm_scr_pp +\end_layout + +\begin_layout Itemize +pspm_remove_epochs (not available in GUI) +\end_layout + +\begin_layout Itemize +pspm_expand_epochs (not available in GUI) +\end_layout + +\begin_layout Subsubsection +First level models +\end_layout + +\begin_layout Itemize +pspm_dcm +\end_layout + +\begin_layout Itemize +pspm_glm +\end_layout + +\begin_layout Itemize +pspm_process_illuminance +\end_layout + +\begin_layout Itemize +pspm_sf +\end_layout + +\begin_layout Itemize +pspm_tam (not available in GUI) +\end_layout + +\begin_layout Subsubsection +User-accessible I/O functions +\end_layout + +\begin_layout Itemize +pspm_exp +\end_layout + +\begin_layout Itemize +pspm_extract_segments +\end_layout + +\begin_layout Itemize +pspm_get_markerinfo +\end_layout + +\begin_layout Subsubsection +Internal and helper functions +\end_layout + +\begin_layout Itemize +pspm_align_channels +\end_layout + +\begin_layout Itemize +pspm_blink_saccade_filt +\end_layout + +\begin_layout Itemize +pspm_butter +\end_layout + +\begin_layout Itemize +pspm_check_model +\end_layout + +\begin_layout Itemize +pspm_convert_pixel2unit_core +\end_layout + +\begin_layout Itemize +pspm_convert_unit +\end_layout + +\begin_layout Itemize +pspm_convert_visangle2sps_core +\end_layout + +\begin_layout Itemize +pspm_convert_visual_angle_core +\end_layout + +\begin_layout Itemize +pspm_denoise_spike +\end_layout + +\begin_layout Itemize +pspm_downsample +\end_layout + +\begin_layout Itemize +pspm_epochs2logical +\end_layout + +\begin_layout Itemize +pspm_extract_segments_core +\end_layout + +\begin_layout Itemize +pspm_eye pspm_filtfilt +\end_layout + +\begin_layout Itemize +pspm_find_channel +\end_layout + +\begin_layout Itemize +pspm_find_eye +\end_layout + +\begin_layout Itemize +pspm_get_timing +\end_layout + +\begin_layout Itemize +pspm_interp1 +\end_layout + +\begin_layout Itemize +pspm_leaky_integrator +\end_layout + +\begin_layout Itemize +pspm_load1 +\end_layout + +\begin_layout Itemize +pspm_load_channel +\end_layout + +\begin_layout Itemize +pspm_load_data +\end_layout + +\begin_layout Itemize +pspm_load_gaze +\end_layout + +\begin_layout Itemize +pspm_logical2epochs +\end_layout + +\begin_layout Itemize +pspm_multi2index +\end_layout + +\begin_layout Itemize +pspm_prepdata +\end_layout + +\begin_layout Itemize +pspm_pulse_convert +\end_layout + +\begin_layout Itemize +pspm_pupil_correct +\end_layout + +\begin_layout Itemize +pspm_select_channels +\end_layout + +\begin_layout Itemize +pspm_sf_auc +\end_layout + +\begin_layout Itemize +pspm_sf_dcm +\end_layout + +\begin_layout Itemize +pspm_sf_mp +\end_layout + +\begin_layout Itemize +pspm_sf_scl +\end_layout + +\begin_layout Itemize +pspm_sf_theta +\end_layout + +\begin_layout Itemize +pspm_show_arms +\end_layout + +\begin_layout Itemize +pspm_struct2vec +\end_layout + +\begin_layout Itemize +pspm_time2index +\end_layout + +\begin_layout Itemize +pspm_transfer_function +\end_layout + +\begin_layout Itemize +pspm_update_channeltype +\end_layout + +\begin_layout Itemize +pspm_version pspm_write_channel +\end_layout + +\begin_layout Itemize +pspm_dcm_inv +\end_layout + +\begin_layout Itemize +pspm_get_rf +\end_layout + +\begin_layout Itemize +pspm_glm_recon +\end_layout + +\begin_layout Subsubsection +Basis functions +\end_layout + +\begin_layout Itemize +pspm_bf_data +\end_layout + +\begin_layout Itemize +pspm_bf_FIR +\end_layout + +\begin_layout Itemize +pspm_bf_hprf +\end_layout + +\begin_layout Itemize +pspm_bf_hprf_e +\end_layout + +\begin_layout Itemize +pspm_bf_hprf_fc +\end_layout + +\begin_layout Itemize +pspm_bf_hprf_fc_f +\end_layout + +\begin_layout Itemize +pspm_bf_lcrf_gm +\end_layout + +\begin_layout Itemize +pspm_bf_ldrf_gm +\end_layout + +\begin_layout Itemize +pspm_bf_ldrf_gu +\end_layout + +\begin_layout Itemize +pspm_bf_psrf_erl +\end_layout + +\begin_layout Itemize +pspm_bf_psrf_fc +\end_layout + +\begin_layout Itemize +pspm_bf_rarf_e +\end_layout + +\begin_layout Itemize +pspm_bf_rarf_fc +\end_layout + +\begin_layout Itemize +pspm_bf_rfrrf_e +\end_layout + +\begin_layout Itemize +pspm_bf_rprf_e +\end_layout + +\begin_layout Itemize +pspm_bf_scrf +\end_layout + +\begin_layout Itemize +pspm_bf_scrf_f +\end_layout + +\begin_layout Itemize +pspm_bf_sebrf +\end_layout + +\begin_layout Itemize +pspm_bf_spsrf_box +\end_layout + +\begin_layout Itemize +pspm_bf_spsrf_gamma +\end_layout + +\begin_layout Itemize +f_SCR +\end_layout + +\begin_layout Itemize +f_SF +\end_layout + +\begin_layout Itemize +g_SCR +\end_layout + +\begin_layout Subsubsection +Housekeeping functions +\end_layout + +\begin_layout Itemize +pspm_check_model +\end_layout + +\begin_layout Itemize +pspm_check_python +\end_layout + +\begin_layout Itemize +pspm_check_python_modules +\end_layout + +\begin_layout Itemize +pspm_init +\end_layout + +\begin_layout Itemize +pspm_options +\end_layout + +\begin_layout Itemize +pspm_overwrite +\end_layout + +\begin_layout Itemize +pspm_path +\end_layout + +\begin_layout Itemize +pspm_quit +\end_layout + +\begin_layout Itemize +pspm_pupil_pp_options +\end_layout + +\begin_layout Subsubsection +Convencience functions +\end_layout + +\begin_layout Itemize +pspm_multi_channel +\end_layout + +\begin_layout Itemize +pspm_pull_zenodo +\end_layout + +\begin_layout Subsubsection +Not accessible to users +\end_layout + +\begin_layout Itemize +pspm_jobman +\end_layout + +\begin_layout Itemize +pspm_format_history +\end_layout + +\begin_layout Itemize +pspm_format_history_from_file +\end_layout + \begin_layout Subsection How to add a new import data type \end_layout @@ -855,11 +1413,15 @@ Format \begin_layout Standard \family typewriter -[sts, import, sourceinfo] = pspm_get_xxx(datafile, import). +[sts, + import, + sourceinfo] = pspm_get_xxx(datafile, + import). \end_layout \begin_layout Standard -The function needs to take an import job and add, for each job. +The function needs to take an import job and add, + for each job. \end_layout \begin_layout Subparagraph @@ -920,7 +1482,8 @@ timestamps \family typewriter continuous \family default -, see +, + see \family typewriter pspm_get_marker \family default @@ -976,7 +1539,8 @@ sts \family typewriter sourceinfo \family default - Contains information on the source file, with field + Contains information on the source file, + with field \end_layout \begin_deeper @@ -987,15 +1551,18 @@ sourceinfo \family typewriter .chan \family default - A cell of string descriptions of the imported source channels, e. + A cell of string descriptions of the imported source channels, + e. g. - names, or numbers any optional fields that will be added to + names, + or numbers any optional fields that will be added to \family typewriter infos.source \family default (e. g. - recording date & time, and others) + recording date & time, + and others) \family typewriter \end_layout @@ -1009,8 +1576,7 @@ Notes for multiple blocks \end_layout \begin_layout Standard -File formats that support multiple block storage within one file can return - cell arrays +File formats that support multiple block storage within one file can return cell arrays \family typewriter import{1:blkno} \family default @@ -1019,7 +1585,8 @@ import{1:blkno} sourceinfo{1:blkno} \family default . - PsPM will save individual files for each block, with a filename + PsPM will save individual files for each block, + with a filename \family typewriter pspm_fn_blk0x.mat \family default @@ -1061,61 +1628,81 @@ defaults.import.datatypes(1) = ... \begin_layout Plain Layout -struct(`short', `xxx', ... +struct(`short', + `xxx', + ... % short name for internal purposes \end_layout \begin_layout Plain Layout -`long', `Datatype description', ... +`long', + `Datatype description', + ... % long name for GUI \end_layout \begin_layout Plain Layout -`ext', `*', ... +`ext', + `*', + ... % data file extension \end_layout \begin_layout Plain Layout -`funct', @pspm_get_xxx, ... +`funct', + @pspm_get_xxx, + ... % import function \end_layout \begin_layout Plain Layout -`chantypes', {{defaults.chantypes.type}}, ... +`chantypes', + {{defaults.chantypes.type}}, + ... % allowed channel types \end_layout \begin_layout Plain Layout -`chandescription', `channel', ... +`chandescription', + `channel', + ... % description of channels for GUI \end_layout \begin_layout Plain Layout -`multioption', 1, ... +`multioption', + 1, + ... % import of multiple channels for GUI \end_layout \begin_layout Plain Layout -`searchoption', 1, ... +`searchoption', + 1, + ... % allow channel name search for GUI \end_layout \begin_layout Plain Layout -`automarker', 0, ... +`automarker', + 0, + ... % marker not stored in separate channel \end_layout \begin_layout Plain Layout -`autosr', 1); % sample rate automatically assigned +`autosr', + 1); + % sample rate automatically assigned \end_layout \end_inset @@ -1134,7 +1721,8 @@ The ``long'' definition is used in the GUI – make sure it's readable. \end_layout \begin_layout Itemize -If no event channels can be imported, change +If no event channels can be imported, + change \family typewriter .chantypes \family default @@ -1142,7 +1730,8 @@ If no event channels can be imported, change \end_layout \begin_layout Itemize -If channels have searchable names in the import file, set +If channels have searchable names in the import file, + set \family typewriter .searchoption \family default @@ -1150,7 +1739,8 @@ If channels have searchable names in the import file, set \end_layout \begin_layout Itemize -If no channel number needs to be assigned for the marker channel, set +If no channel number needs to be assigned for the marker channel, + set \family typewriter .automarker = 1 \family default @@ -1167,8 +1757,7 @@ If sample rate is contained in import file and determined during import, \end_layout \begin_layout Itemize -If you need external functions – put them into a folder in the `import' - subdirectory and add/remove this path within the +If you need external functions – put them into a folder in the `import' subdirectory and add/remove this path within the \family typewriter pspm_get_xxx \family default @@ -1210,7 +1799,8 @@ Format \begin_layout Standard \family typewriter -[sts, data] = pspm_get_channeltype(import) +[sts, + data] = pspm_get_channeltype(import) \end_layout \begin_layout Subparagraph @@ -1238,7 +1828,8 @@ Good to know \end_layout \begin_layout Standard -For event channels, use the function +For event channels, + use the function \family typewriter pspm_get_events \family default @@ -1275,12 +1866,14 @@ defaults.chantypes(k).type = `xxx';% channel type name \begin_layout Plain Layout -defaults.chantypes(k).import = @pspm_get_xxx; % conversion function +defaults.chantypes(k).import = @pspm_get_xxx; + % conversion function \end_layout \begin_layout Plain Layout -defaults.chantypes(k).data = `xxx'; % `wave' or `events' +defaults.chantypes(k).data = `xxx'; + % `wave' or `events' \end_layout \end_inset @@ -1311,13 +1904,20 @@ defaults.glm(1) = ... \begin_layout Plain Layout -struct(`modality', `scr', ... +struct(`modality', + `scr', + ... % modality name \end_layout \begin_layout Plain Layout -`cbf', struct(`fhandle', @pspm_bf_scrf, `args', 1), ... +`cbf', + struct(`fhandle', + @pspm_bf_scrf, + `args', + 1), + ... \end_layout @@ -1328,13 +1928,26 @@ struct(`modality', `scr', ... \begin_layout Plain Layout -`filter', struct(`lpfreq', 5, `lporder', 1, ... +`filter', + struct(`lpfreq', + 5, + `lporder', + 1, + ... \end_layout \begin_layout Plain Layout -`hpfreq', 0.05, `hporder', 1, `down', 10, `direction', `uni')); +`hpfreq', + 0.05, + `hporder', + 1, + `down', + 10, + `direction', + `uni')); + \end_layout \begin_layout Plain Layout @@ -1370,8 +1983,9 @@ Arguments \end_layout \begin_layout Standard -vector of arguments, first element is time resolution, further arguments - as defined in +vector of arguments, + first element is time resolution, + further arguments as defined in \family typewriter defaults.glm(n).cbf.args \family default @@ -1779,7 +2393,8 @@ Pulse oxymeter \begin_inset Text \begin_layout Plain Layout -Gaze x/y, l/r +Gaze x/y, + l/r \end_layout \end_inset @@ -2389,7 +3004,8 @@ Biopac AcqKnowledge (exported) \begin_inset Text \begin_layout Plain Layout -Labchart (any Version, Windows only) +Labchart (any Version, + Windows only) \end_layout \end_inset @@ -4867,7 +5483,8 @@ Biopac \begin_inset Text \begin_layout Plain Layout -Labchart (any Version, Windows only) +Labchart (any Version, + Windows only) \end_layout \end_inset @@ -6102,8 +6719,8 @@ Arrington Research \end_layout \begin_layout Standard -Note: Automarkers means no channel number has to be specified because markers - are always at the same place. +Note: + Automarkers means no channel number has to be specified because markers are always at the same place. \end_layout \begin_layout Standard @@ -6126,7 +6743,8 @@ Revised by Teddy Zhao in Feburary 2022. \end_layout \begin_layout Subsection -MATLABbatch: Getting started +MATLABbatch: + Getting started \end_layout \begin_layout Enumerate @@ -6138,8 +6756,7 @@ Type \family typewriter pspm_init \family default - into the command window (after the execution of the command the folders - + into the command window (after the execution of the command the folders \family typewriter pspm_cfg \family default @@ -6155,8 +6772,7 @@ cfg_ui \end_layout \begin_layout Enumerate -If the item PsPM exists in the menu bar of MATLABbatch you can skip steps - 5 to 7 and continue at step 8 +If the item PsPM exists in the menu bar of MATLABbatch you can skip steps 5 to 7 and continue at step 8 \end_layout \begin_layout Enumerate @@ -6176,16 +6792,20 @@ pspm_cfg.m \end_layout \begin_layout Enumerate -A new item, called PsPM, will appear in the upper menu bar. +A new item, + called PsPM, + will appear in the upper menu bar. \end_layout \begin_layout Enumerate -By selecting PsPM the desired action can be selected (at the moment, there - is only Data Preparation → {Import, Trim} available) +By selecting PsPM the desired action can be selected (at the moment, + there is only Data Preparation → {Import, + Trim} available) \end_layout \begin_layout Subsubsection -Example Function: Trim +Example Function: + Trim \end_layout \begin_layout Standard @@ -6206,17 +6826,17 @@ Fill in the desired values in the fields which are marked with "<-X" \end_layout \begin_layout Itemize -After you have chosen a file and filled in all values correctly, you will - see a green arrow on the upper left part of the window +After you have chosen a file and filled in all values correctly, + you will see a green arrow on the upper left part of the window \end_layout \begin_layout Itemize -By pressing on the green arrow the selected file will be trimmed according - to the filled in values +By pressing on the green arrow the selected file will be trimmed according to the filled in values \end_layout \begin_layout Subsection -MATLABbatch: How to +MATLABbatch: + How to \end_layout \begin_layout Subsubsection @@ -6228,8 +6848,7 @@ Add folder of MATLABbatch to the MATLAB path \end_layout \begin_layout Itemize -Add first application and then load the batch in order to execute a function - +Add first application and then load the batch in order to execute a function \end_layout \begin_layout Subsubsection @@ -6257,7 +6876,8 @@ Root node of a tree is specified last \end_layout \begin_layout Itemize -Some examples of items: +Some examples of items: + \begin_inset Separator latexpar \end_inset @@ -6283,17 +6903,20 @@ status open \begin_layout Plain Layout -item1= cfg_item; % Defines generic configuration item +item1= cfg_item; + % Defines generic configuration item \end_layout \begin_layout Plain Layout -item1.name= `Def 1'; % The display name +item1.name= `Def 1'; + % The display name \end_layout \begin_layout Plain Layout -item1.tag = `def1'; % The name appearing in the harvested job +item1.tag = `def1'; + % The name appearing in the harvested job \end_layout \begin_layout Plain Layout @@ -6314,12 +6937,14 @@ item1.tag = `def1'; % The name appearing in the harvested job \begin_layout Plain Layout -item1.val = {true}; % Value of item (optional) +item1.val = {true}; + % Value of item (optional) \end_layout \begin_layout Plain Layout -item1.help = {`Help...'}; % Help text +item1.help = {`Help...'}; + % Help text \end_layout \end_inset @@ -6345,32 +6970,38 @@ status open \begin_layout Plain Layout -entry1 = cfg_entry; % Defines entry configuration item +entry1 = cfg_entry; + % Defines entry configuration item \end_layout \begin_layout Plain Layout -entry1.name = `Input'; +entry1.name = `Input'; + \end_layout \begin_layout Plain Layout -entry1.tag = `input'; +entry1.tag = `input'; + \end_layout \begin_layout Plain Layout -entry1.strtye = `r'; % Type of values which can be entered +entry1.strtye = `r'; + % Type of values which can be entered \end_layout \begin_layout Plain Layout -entry1.num = [1 1]; % Expected dimension of the input +entry1.num = [1 1]; + % Expected dimension of the input \end_layout \begin_layout Plain Layout -entry1.help = {`Help...'}; +entry1.help = {`Help...'}; + \end_layout \end_inset @@ -6396,7 +7027,8 @@ status open \begin_layout Plain Layout -choice = cfg_item; % Defines choice configuration item +choice = cfg_item; + % Defines choice configuration item \end_layout \begin_layout Plain Layout @@ -6411,7 +7043,9 @@ choice.tag = `choice'; \begin_layout Plain Layout -choice.values = {item1, entry1}; % Defines which items will be +choice.values = {item1, + entry1}; + % Defines which items will be \end_layout \begin_layout Plain Layout @@ -6422,7 +7056,8 @@ choice.values = {item1, entry1}; % Defines which items will be \begin_layout Plain Layout -choice.help = {`Help...'}; +choice.help = {`Help...'}; + \end_layout \end_inset @@ -6448,22 +7083,26 @@ status open \begin_layout Plain Layout -fct = cfg_exbranch; % Defines the branch that has information +fct = cfg_exbranch; + % Defines the branch that has information \end_layout \begin_layout Plain Layout -% about how to run this module fct.name = `Trim'; +% about how to run this module fct.name = `Trim'; + \end_layout \begin_layout Plain Layout -fct.tag = `trim'; +fct.tag = `trim'; + \end_layout \begin_layout Plain Layout -fct.val = {choice}; % The items that belong to this branch. +fct.val = {choice}; + % The items that belong to this branch. \end_layout @@ -6495,7 +7134,8 @@ status open \begin_layout Plain Layout -fct.prog = @cfg_run_fct; % A function handle that will be called +fct.prog = @cfg_run_fct; + % A function handle that will be called \end_layout \begin_layout Plain Layout @@ -6510,7 +7150,8 @@ fct.prog = @cfg_run_fct; % A function handle that will be called \begin_layout Plain Layout -trim.vout = @cfg_vout_fct; % A function handle that will be +trim.vout = @cfg_vout_fct; + % A function handle that will be \end_layout \begin_layout Plain Layout @@ -6525,7 +7166,8 @@ trim.vout = @cfg_vout_fct; % A function handle that will be \begin_layout Plain Layout -trim.help = {Help...'}; +trim.help = {Help...'}; + \end_layout \end_inset @@ -6535,35 +7177,43 @@ trim.help = {Help...'}; \begin_layout Itemize There exists a number of other item classes. - Here is a list of the most important classes: + Here is a list of the most important classes: + \family typewriter cfg_item \family default -, +, + \family typewriter cfg_entry \family default -, +, + \family typewriter cfg_choice \family default -, +, + \family typewriter cfg_menu \family default -, +, + \family typewriter cfg_exbranch \family default -, +, + \family typewriter cfg_files \family default -, +, + \family typewriter cfg_branch \family default -, +, + \family typewriter cfg_repeat \family default @@ -6589,8 +7239,8 @@ The inputs to each module have to be described in a tree-like structure. \end_layout \begin_layout Standard -During data entry, there is no way to change the tree structure based on - input data. +During data entry, + there is no way to change the tree structure based on input data. Add application to the configuration tree by default \end_layout @@ -6599,9 +7249,7 @@ Add application to the configuration tree by default \end_layout \begin_layout Standard -In the following it is shown how an application can be added to the menu - bar of MATLABbatch by default (without adding it every time MATLABbatch - is started) +In the following it is shown how an application can be added to the menu bar of MATLABbatch by default (without adding it every time MATLABbatch is started) \end_layout \begin_layout Itemize @@ -6617,12 +7265,12 @@ MATLABbatch/cfg_confgui \end_layout \begin_layout Itemize -Put Generate code into the Module list by selecting ConfGUI → Generate code - in the menu bar +Put Generate code into the Module list by selecting ConfGUI → Generate code in the menu bar \end_layout \begin_layout Itemize -Fill out all the input fields on the right side: +Fill out all the input fields on the right side: + \begin_inset Separator latexpar \end_inset @@ -6631,22 +7279,24 @@ Fill out all the input fields on the right side: \begin_deeper \begin_layout Itemize -Output filename: This file will contain the whole menu structure, validity - constraints and links to run time code of the appliaction. +Output filename: + This file will contain the whole menu structure, + validity constraints and links to run time code of the appliaction. \end_layout \begin_layout Itemize -Output directory: All files which are created by the ConfGUI will be stored - into this directory (chose a directory which is added to the MATLAB path) +Output directory: + All files which are created by the ConfGUI will be stored into this directory (chose a directory which is added to the MATLAB path) \end_layout \begin_layout Itemize -Root node of config: Name of the root node of the appliaction's configuration - tree +Root node of config: + Name of the root node of the appliaction's configuration tree \end_layout \begin_layout Itemize -Options: +Options: + \begin_inset Separator latexpar \end_inset @@ -6655,7 +7305,8 @@ Options: \begin_deeper \begin_layout Enumerate -Create Defaults File: +Create Defaults File: + \family typewriter Yes \end_layout @@ -6665,7 +7316,8 @@ Create \family typewriter mlbatch_appcfg \family default - File: + File: + \family typewriter Yes \end_layout @@ -6673,7 +7325,8 @@ Yes \begin_layout Enumerate Create Code for \family typewriter -addpath(): No +addpath(): + No \family default \end_layout @@ -6689,11 +7342,13 @@ As no error occurred 3 new files ( \family typewriter {Output filename}.m \family default -, +, + \family typewriter {Output filename}_def.m \family default -, +, + \family typewriter cfg_mlbatch_appcfg.m \family default @@ -6705,12 +7360,12 @@ Output directory \end_layout \begin_layout Itemize -Each time MATLABbatch is started, it will search for any +Each time MATLABbatch is started, + it will search for any \family typewriter cfg_mlbatch_appcfg.m \family default - file (this file contains the names of the configuration files) and will - add the corresponding application to the batch editor. + file (this file contains the names of the configuration files) and will add the corresponding application to the batch editor. \end_layout @@ -6739,52 +7394,72 @@ status open \begin_layout Plain Layout -arg1 = `scr.prep.import_data'; +arg1 = `scr.prep.import_data'; + \end_layout \begin_layout Plain Layout -arg2 = `scr.prep.trim'; +arg2 = `scr.prep.trim'; + \end_layout \begin_layout Plain Layout -mod_cfg_id1 = cfg_util(`tag2mod_cfg_id',arg1); +mod_cfg_id1 = cfg_util(`tag2mod_cfg_id',arg1); + \end_layout \begin_layout Plain Layout -mod_cfg_id2 = cfg_util(`tag2mod_cfg_id',arg2); +mod_cfg_id2 = cfg_util(`tag2mod_cfg_id',arg2); + \end_layout \begin_layout Plain Layout -cjob = cfg_util(`initjob'); +cjob = cfg_util(`initjob'); + \end_layout \begin_layout Plain Layout -mod_job_id1 = cfg_util(`addtojob', cjob, mod_cfg_id1); +mod_job_id1 = cfg_util(`addtojob', + cjob, + mod_cfg_id1); + \end_layout \begin_layout Plain Layout -mod_job_id2 = cfg_util(`addtojob', cjob, mod_cfg_id2); +mod_job_id2 = cfg_util(`addtojob', + cjob, + mod_cfg_id2); + \end_layout \begin_layout Plain Layout -cfg_util(`harvest', cjob, mod_job_id1); +cfg_util(`harvest', + cjob, + mod_job_id1); + \end_layout \begin_layout Plain Layout -cfg_util(`harvest', cjob, mod_job_id2); +cfg_util(`harvest', + cjob, + mod_job_id2); + \end_layout \begin_layout Plain Layout -cfg_ui(`local_showjob', cfg_ui, cjob); +cfg_ui(`local_showjob', + cfg_ui, + cjob); + \end_layout \end_inset @@ -6801,16 +7476,18 @@ In the function \family typewriter private/cfg_onscreen \family default - at line 36 figure(fg); is commented out in order to prevent the appearance - of the GUI for a short time if the function + at line 36 figure(fg); + is commented out in order to prevent the appearance of the GUI for a short time if the function \family typewriter -cfg_ui(`Visible', `off') +cfg_ui(`Visible', + `off') \family default is called. \end_layout \begin_layout Subsection -MATLABbatch: changing help texts and fieldnames +MATLABbatch: + changing help texts and fieldnames \end_layout \begin_layout Subsubsection @@ -6818,10 +7495,9 @@ File structure of MATLABbatch GUI \end_layout \begin_layout Standard -There exist two files per function: 1 configuration file and 1 run file. - The configuration file defines the structure of the corresponding function - in the MATLABbatch GUI whereas the run file firstly gathers all entered - values and secondly calls the corresponding SCR function. +There exist two files per function: + 1 configuration file and 1 run file. + The configuration file defines the structure of the corresponding function in the MATLABbatch GUI whereas the run file firstly gathers all entered values and secondly calls the corresponding SCR function. Both types of files are located in the subfolder \family typewriter pspm_cfg @@ -6846,7 +7522,8 @@ pspm_import.m \family typewriter pspm_cfg_import.m \family default -, +, + \family typewriter pspm_cfg_run_import.m \family default @@ -6858,10 +7535,8 @@ Edit help texts and fieldname \end_layout \begin_layout Standard -In order to change any help text or fieldname in a MATLABbatch GUI function - the corresponding configuration file has to be opened. - For each item in a MATLABbatch GUI function a struct variable which contains - several struct fields is defined in the configuration file. +In order to change any help text or fieldname in a MATLABbatch GUI function the corresponding configuration file has to be opened. + For each item in a MATLABbatch GUI function a struct variable which contains several struct fields is defined in the configuration file. \end_layout @@ -6870,28 +7545,26 @@ Help text The field \family typewriter .help \family default - defines the help text of the item which can be edited in order to change - the help text. - As soon as MATLABbatch has been closed and opened again, the changes in - the help text will be visible in MATLABbatch GUI. + defines the help text of the item which can be edited in order to change the help text. + As soon as MATLABbatch has been closed and opened again, + the changes in the help text will be visible in MATLABbatch GUI. \end_layout \begin_layout Itemize -Fieldname The fieldname of an MATLABbatch GUI item is defined by the struct - field +Fieldname The fieldname of an MATLABbatch GUI item is defined by the struct field \family typewriter .tag \family default . - In case a fieldname of an item should be changed be careful to verify if - no other item, which has the same root node, hold the same fieldname. + In case a fieldname of an item should be changed be careful to verify if no other item, + which has the same root node, + hold the same fieldname. Otherwise MATLABbatch will not work properly. After the fieldname of an item has been changed the run file ( \family typewriter pspm_cfg_run_functionname.m \family default -) of the corresponding function has to be adapted as well in order to ensure - that the function call in the run file is done properly. +) of the corresponding function has to be adapted as well in order to ensure that the function call in the run file is done properly. \end_layout \begin_layout Subsection @@ -6899,20 +7572,20 @@ Python Support \end_layout \begin_layout Standard -PsPM provides some features that are enabled by using Python packages, namly - HeartPy and Bioread, and descriptions in the GUI. +PsPM provides some features that are enabled by using Python packages, + namly HeartPy and Bioread, + and descriptions in the GUI. This is controled through \family typewriter pspm_cfg_python \family default . - Any PsPM functions or features that require Python-enabled features need - to call + Any PsPM functions or features that require Python-enabled features need to call \family typewriter pspm_cfg_python \family default - to show Python path specification in the GUI, so that users can select - appropriate Python location for calling the packages. + to show Python path specification in the GUI, + so that users can select appropriate Python location for calling the packages. \end_layout \begin_layout Subsubsection @@ -6920,12 +7593,12 @@ Python packages \end_layout \begin_layout Standard -The Python packages that are used by PsPM are Bioread and HeartPy, until - PsPM version 7.0. - This is to support the features of importing .acq data for Bioread and process - PPG data for HeartPy. - The tested competible version of these packages are Python 3.11, Bioread - 3.0.1, and HeartPy 1.2.7. +The Python packages that are used by PsPM are Bioread and HeartPy, + until PsPM version 7.0. + This is to support the features of importing .acq data for Bioread and process PPG data for HeartPy. + The tested competible version of these packages are Python 3.11, + Bioread 3.0.1, + and HeartPy 1.2.7. Because some packages may have dependence on other packages such as numpy, here is a list of Python packages that work on both Windows and macOS \end_layout @@ -7099,27 +7772,27 @@ The package \family typewriter HeartPy \family default - (stylised to be in line with its official website) (https://pypi.org/project/hea -rtpy/) is designed for analysing PPG signals and used for processing PPG - data in PsPM. + (stylised to be in line with its official website) (https://pypi.org/project/heartpy/) is designed for analysing PPG signals and used for processing PPG data in PsPM. \end_layout \begin_layout Standard The process of using HeartPy to process PPG data is described as following. - Initially, PsPM will check if python has been installed in the computer, + Initially, + PsPM will check if python has been installed in the computer, and this is done by using the function \family typewriter pspm_check_python \family default . - In this process, + In this process, + \family typewriter pspm_check_python \family default - requires a path of python that is provided by the user so that it can determine - if python has been installed there. - Secondly, PsPM checks if HeartPy package has been installed in the defined - python path, and this is handled with + requires a path of python that is provided by the user so that it can determine if python has been installed there. + Secondly, + PsPM checks if HeartPy package has been installed in the defined python path, + and this is handled with \family typewriter pspm_check_python_modules \family default @@ -7128,7 +7801,8 @@ pspm_check_python_modules \family typewriter HeartPy \family default - have been installed, it is then safe to use function family + have been installed, + it is then safe to use function family \family typewriter py.heartpy \family default @@ -7137,8 +7811,7 @@ py.heartpy \family typewriter HeartPy \family default - can be found at https://python-heart-rate-analysis-toolkit.readthedocs.io/en/late -st/heartpy.heartpy.html. + can be found at https://python-heart-rate-analysis-toolkit.readthedocs.io/en/latest/heartpy.heartpy.html. The details about how PPG data are processed can be found at \family typewriter pspm_convert_ppg2hb @@ -7155,9 +7828,8 @@ The package \family typewriter Bioread \family default - (https://pypi.org/project/bioread/) supports reading biopac files in any - version, and it has been included in PsPM for importing biopac files since - version 7.0. + (https://pypi.org/project/bioread/) supports reading biopac files in any version, + and it has been included in PsPM for importing biopac files since version 7.0. \family typewriter Bioread-based @@ -7168,8 +7840,8 @@ Bioread-based acqread_python \family default . - Users have to specify the functionality of importing biopac data with python - to use this method, but they can also call the function + Users have to specify the functionality of importing biopac data with python to use this method, + but they can also call the function \family typewriter acqread_python \family default @@ -7187,9 +7859,7 @@ HeartPy \family typewriter acqread_python \family default - is to get the main content and other metadata from original files and then - save such information to the corresponding places for meeting PsPM's data - storage requirements. + is to get the main content and other metadata from original files and then save such information to the corresponding places for meeting PsPM's data storage requirements. Further information is available in \family typewriter acqread_python @@ -7218,22 +7888,22 @@ https://uk.mathworks.com/help/matlab/migrate-guide-apps.html \end_inset was originally used as the framework for designing the GUI of PsPM. - However, the framework suffers from the risk that plots may be unexpectedly - displayed on such figures since they need to be called by users' command - lines. - At the same time, GUIDE based GUI will lose support from Mathworks in a - future release of MATLAB. - Consequently, PsPM is currently slowly being migrated to the new UI designing - framework, MATLAB AppDesigner. - Instead of creating .fig files, the new AppDesigner frameworks will create - .mlapp files. + However, + the framework suffers from the risk that plots may be unexpectedly displayed on such figures since they need to be called by users' command lines. + At the same time, + GUIDE based GUI will lose support from Mathworks in a future release of MATLAB. + Consequently, + PsPM is currently slowly being migrated to the new UI designing framework, + MATLAB AppDesigner. + Instead of creating .fig files, + the new AppDesigner frameworks will create .mlapp files. The \family typewriter .mlapp \family default file can be created natively through the new MATLAB GUI guide. - Alternatively, it can be generated by converting the classic GUIDE based - .fig file through the feature + Alternatively, + it can be generated by converting the classic GUIDE based .fig file through the feature \shape italic migration \shape default @@ -7243,8 +7913,7 @@ migration \begin_layout Standard The main GUI has been recreated by using AppDesigner in PsPM version 6.1, where the function lists inherted from the legacy of GUIDE-based GUI. - The code has been re-sorted out in MATLAB by following the coding style - of AppDesigner. + The code has been re-sorted out in MATLAB by following the coding style of AppDesigner. A typical button corresponds to the function shown below \begin_inset Newline linebreak \end_inset @@ -7263,7 +7932,8 @@ function \begin_layout Plain Layout -button_Callback(app, event) +button_Callback(app, + event) \end_layout \begin_layout Plain Layout @@ -7278,7 +7948,8 @@ case 'A' \begin_layout Plain Layout -action; +action; + \end_layout \begin_layout Plain Layout @@ -7302,9 +7973,12 @@ The new GUI is currently using the colour #7f2534 \family default for stylishing. - The main typeface for UI design is Segoe UI, San Francisco (or Helvetica - Neue for Yosemite, Lucida Grande for pre-Yosemite) and DejaVu Sans for - Windows, macOS, and Linux, respectively. + The main typeface for UI design is Segoe UI, + San Francisco (or Helvetica Neue for Yosemite, + Lucida Grande for pre-Yosemite) and DejaVu Sans for Windows, + macOS, + and Linux, + respectively. \end_layout \begin_layout Subsection @@ -7316,28 +7990,28 @@ Introduction \end_layout \begin_layout Standard -Help text refers to the descriptive text that is included in the initial - couple of lines of source code. +Help text refers to the descriptive text that is included in the initial couple of lines of source code. Such help text can be sorted by calling the function \family typewriter pspm_help \family default into a struct. - Typically, the help text shall be written into sections as + Typically, + the help text shall be written into sections as \end_layout \begin_layout Labeling \labelwidthstring 00.00.0000 Description The general introduction of a function. - This is normally describing the use of the function and how it works, such - as importing a specific type of data and how information is read and managed. + This is normally describing the use of the function and how it works, + such as importing a specific type of data and how information is read and managed. \end_layout \begin_layout Labeling \labelwidthstring 00.00.0000 Format The format of a function as how it can be called. - If the function has some varabile arguments, then the details can be listed - as multiple lines. + If the function has some varabile arguments, + then the details can be listed as multiple lines. \end_layout \begin_layout Labeling @@ -7356,10 +8030,9 @@ Outputs The list of output variables of a function with their descriptions, \begin_layout Labeling \labelwidthstring 00.00.0000 -Developer's_notes This section can be used as a paragraph of technical notes - for the function. - Such information is typically useful for developing the function, and it - is relatively more useful for developers than for users. +Developer's_notes This section can be used as a paragraph of technical notes for the function. + Such information is typically useful for developing the function, + and it is relatively more useful for developers than for users. \end_layout \begin_layout Labeling @@ -7389,12 +8062,17 @@ General introduction of the function. \begin_layout Standard \noindent - [output1, output2, output3] = pspm_xxx(varargin); + [output1, + output2, + output3] = pspm_xxx(varargin); \end_layout \begin_layout Standard \noindent - [output1, output2, output3] = pspm_xxx(input1, input2); + [output1, + output2, + output3] = pspm_xxx(input1, + input2); \end_layout \begin_layout Standard @@ -7404,12 +8082,14 @@ General introduction of the function. \begin_layout Standard \noindent -* input1 : description of input1. +* input1 : + description of input1. \end_layout \begin_layout Standard \noindent -* input2 : description of input2. +* input2 : + description of input2. \end_layout \begin_layout Standard @@ -7419,12 +8099,14 @@ General introduction of the function. \begin_layout Standard \noindent -├─.subfield1 : description of subfield1. +├─.subfield1 : + description of subfield1. \end_layout \begin_layout Standard \noindent -└─.subfield2 : description of subfield2. +└─.subfield2 : + description of subfield2. \end_layout \begin_layout Standard @@ -7434,12 +8116,14 @@ General introduction of the function. \begin_layout Standard \noindent -* output1 : description of output1. +* output1 : + description of output1. \end_layout \begin_layout Standard \noindent -* output2 : description of output2. +* output2 : + description of output2. \end_layout \begin_layout Standard @@ -7449,12 +8133,14 @@ General introduction of the function. \begin_layout Standard \noindent -├─.subfield1 : description of subfield1. +├─.subfield1 : + description of subfield1. \end_layout \begin_layout Standard \noindent -└─.subfield2 : description of subfield2. +└─.subfield2 : + description of subfield2. \end_layout \begin_layout Standard @@ -7494,7 +8180,8 @@ Test Environment \end_layout \begin_layout Quote -Contributed by Linus Rüttimann, Tobias Moser and Teddy Zhao. +Contributed by Linus Rüttimann, + Tobias Moser and Teddy Zhao. \end_layout \begin_layout Quote @@ -7502,7 +8189,8 @@ Revised and updated by Teddy Zhao in Feburary 2022. \end_layout \begin_layout Subsubsection -Unittest: General implementation +Unittest: + General implementation \end_layout \begin_layout Standard @@ -7511,13 +8199,15 @@ In PsPM the MATLAB Unit Testing Framework is used for testing of functions. \family typewriter functionname_test \family default -, which contains the unittests for that specific function. +, + which contains the unittests for that specific function. Additionally there is a documentation page for each of the test classes, where information about the unittests can be found. \end_layout \begin_layout Standard -To run the unittests of a test class, an object of the class has to be created +To run the unittests of a test class, + an object of the class has to be created \end_layout \begin_layout Standard @@ -7585,8 +8275,7 @@ testCase.run(unittest_name'). \end_layout \begin_layout Standard -Remember that a new test class object must be generated each time the test - class has been changed. +Remember that a new test class object must be generated each time the test class has been changed. \end_layout \begin_layout Subsubsection @@ -7594,8 +8283,7 @@ parameterised test classes \end_layout \begin_layout Standard -Parmeterised test classes is a feature provided by the MATLAB test case - class. +Parmeterised test classes is a feature provided by the MATLAB test case class. A test class is parameterised when it has \end_layout @@ -7608,12 +8296,10 @@ Test methods implementing the defined test parameters \end_layout \begin_layout Standard -Each function implementing test parameters will be called multiple times - with each possible parameter combination (which is determined by MATLAB). - Thus parameterised classes allow to write single tests for different parameter - combinations. - If one of the following test cases is a parameterised test class, it will - be mentioned accordingly. +Each function implementing test parameters will be called multiple times with each possible parameter combination (which is determined by MATLAB). + Thus parameterised classes allow to write single tests for different parameter combinations. + If one of the following test cases is a parameterised test class, + it will be mentioned accordingly. \end_layout \begin_layout Subsection @@ -7641,7 +8327,10 @@ Format \begin_layout Standard \family typewriter -[sts, data, duration] = pspm_align_channels(data, induration) +[sts, + data, + duration] = pspm_align_channels(data, + induration) \end_layout \begin_layout Subsubsection @@ -7699,8 +8388,7 @@ Description \end_layout \begin_layout Standard -Passes an optional duration that is less than the maximum duration of all - channels in the input to +Passes an optional duration that is less than the maximum duration of all channels in the input to \family typewriter pspm_align_channels \family default @@ -7738,8 +8426,7 @@ Description \end_layout \begin_layout Standard -Passes an optional duration that is equal to the maximum duration of all - channels in the input to +Passes an optional duration that is equal to the maximum duration of all channels in the input to \family typewriter pspm_align_channels \family default @@ -7765,8 +8452,7 @@ Description \end_layout \begin_layout Standard -Passes an optional duration that is higher than the maximum duration of - all channels. +Passes an optional duration that is higher than the maximum duration of all channels. \end_layout \begin_layout Subparagraph @@ -7774,8 +8460,7 @@ Tests \end_layout \begin_layout Enumerate -Assert that durations of all returned channels is the same as the passed - optional duration. +Assert that durations of all returned channels is the same as the passed optional duration. \end_layout \begin_layout Paragraph @@ -7809,8 +8494,7 @@ Tests \end_layout \begin_layout Enumerate -Assert that all returned channels are aligned to the maximum duration passed - in marker channel. +Assert that all returned channels are aligned to the maximum duration passed in marker channel. \end_layout \begin_layout Paragraph @@ -7852,8 +8536,7 @@ Description \end_layout \begin_layout Standard -In each of these cases check if the returned channels have the same duration - that is equal to the maximum duration of all input channels. +In each of these cases check if the returned channels have the same duration that is equal to the maximum duration of all input channels. \end_layout \begin_layout Subsection @@ -7883,7 +8566,11 @@ Function \begin_layout Standard \family typewriter -[sts, b, a] = pspm_butter(order, freqratio, pass) +[sts, + b, + a] = pspm_butter(order, + freqratio, + pass) \end_layout \begin_layout Subsubsection @@ -7909,8 +8596,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid and if the signal - processing toolbox is installed. +Checks for warnings, + if the input arguments are invalid and if the signal processing toolbox is installed. \end_layout \begin_layout Subparagraph @@ -8075,7 +8762,8 @@ Format \begin_layout Standard \family typewriter -[bs, x] = pspm_bf_ +[bs, + x] = pspm_bf_ \end_layout \begin_layout Subsubsection @@ -8124,8 +8812,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data or option should be - passed to each basis function. +These are parameters which define what kind of data or option should be passed to each basis function. \end_layout \begin_layout Standard @@ -8159,8 +8846,7 @@ Specifies for the basic test different time resolutions (argument td <= duration \family default ). - The values are logarithmic and have to be translated before passed to the - basis function. + The values are logarithmic and have to be translated before passed to the basis function. \end_layout \end_inset @@ -8196,7 +8882,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout @@ -8321,7 +9008,8 @@ Function name \begin_layout Standard \family typewriter -test_basic(this, time_res_log) +test_basic(this, + time_res_log) \end_layout \begin_layout Subparagraph @@ -8329,8 +9017,7 @@ Description \end_layout \begin_layout Standard -Test for different requirements to verify whether the current basis function - is valid or not. +Test for different requirements to verify whether the current basis function is valid or not. \end_layout \begin_layout Subparagraph* @@ -8342,7 +9029,8 @@ Test with \family typewriter td = 0.1 \family default -, verify that no warning is issued and determine the duration +, + verify that no warning is issued and determine the duration \end_layout \begin_layout Enumerate @@ -8354,8 +9042,7 @@ td = 0.01 \end_layout \begin_layout Enumerate -Test if function runs through without warning and that the time vector begins - at +Test if function runs through without warning and that the time vector begins at \family typewriter <= 0 \family default @@ -8399,7 +9086,10 @@ Function \begin_layout Standard \family typewriter -[sts, converted] = pspm_convert_unit(data, from, to) +[sts, + converted] = pspm_convert_unit(data, + from, + to) \end_layout \begin_layout Subsubsection @@ -8469,7 +9159,8 @@ Tests \end_layout \begin_layout Enumerate -If empty input data is passed, result is also empty. +If empty input data is passed, + result is also empty. \end_layout \begin_layout Enumerate @@ -8563,7 +9254,9 @@ Format \begin_layout Standard \family typewriter -[sts,pt_debug] = pspm_ecg2hb(fn, chan, options) +[sts,pt_debug] = pspm_ecg2hb(fn, + chan, + options) \end_layout \begin_layout Subsubsection @@ -8577,7 +9270,10 @@ Constants \begin_layout Itemize \family typewriter -testdata{0}.chan_struct = struct(`nr', 1, `name', `ecg'); +testdata{0}.chan_struct = struct(`nr', + 1, + `name', + `ecg'); \end_layout \begin_layout Itemize @@ -8599,7 +9295,10 @@ testdata{0}.num_channels = 1 \begin_layout Itemize \family typewriter -testdata{1}.chan_struct = struct(`nr', 3, `name', `ecg'); +testdata{1}.chan_struct = struct(`nr', + 3, + `name', + `ecg'); \end_layout \begin_layout Itemize @@ -8627,7 +9326,8 @@ backup_suffix = `_backup'; \begin_layout Itemize \family typewriter -options = struct(`semi', 0); +options = struct(`semi', + 0); \end_layout \begin_layout Subsubsection @@ -8741,7 +9441,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_ecg2hb(this.fn, `bla') [invalid channel (text)] +pspm_ecg2hb(this.fn, + `bla') [invalid channel (text)] \end_layout \end_inset @@ -8765,7 +9466,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_ecg2hb(this.fn, 1) [invalid channel type] +pspm_ecg2hb(this.fn, + 1) [invalid channel type] \end_layout \end_inset @@ -8789,8 +9491,10 @@ ID:not_allowed_channeltype \begin_layout Plain Layout \family typewriter -o.twthresh = `bla'; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid twthresh - (text)] +o.twthresh = `bla'; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid twthresh (text)] \end_layout \end_inset @@ -8814,8 +9518,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -o.minHR = 202; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid minHR (> default_maxHR -)] +o.minHR = 202; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid minHR (> default_maxHR)] \end_layout \end_inset @@ -8839,8 +9545,11 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -o.minHR = 202; o.maxHR = 19; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid minHR - > maxHR] +o.minHR = 202; + o.maxHR = 19; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid minHR > maxHR] \end_layout \end_inset @@ -8864,8 +9573,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -o.maxHR = 19; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid maxHR (< default_minHR) -] +o.maxHR = 19; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid maxHR (< default_minHR)] \end_layout \end_inset @@ -8889,8 +9600,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -o.debugmode = 5; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid debugmode (not - in [0,1])] +o.debugmode = 5; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid debugmode (not in [0,1])] \end_layout \end_inset @@ -8914,7 +9627,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -o.semi = 5; pspm_ecg2hb(this.fn, this.chan.nr, o) [invalid semi (not in [0,1])] +o.semi = 5; + pspm_ecg2hb(this.fn, + this.chan.nr, + o) [invalid semi (not in [0,1])] \end_layout \end_inset @@ -8997,7 +9713,9 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_ecg2hb(this.fn, this.chan.nr, this.options) +pspm_ecg2hb(this.fn, + this.chan.nr, + this.options) \end_layout \end_inset @@ -9019,7 +9737,9 @@ pspm_ecg2hb(this.fn, this.chan.nr, this.options) \begin_layout Plain Layout \family typewriter -pspm_ecg2hb(this.fn, this.chan.name, this.options) +pspm_ecg2hb(this.fn, + this.chan.name, + this.options) \end_layout \end_inset @@ -9357,7 +10077,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -9425,8 +10146,7 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_filtfilt([1:10],[1:20],[1:10]) [data length less than 3 times filter - order] +pspm_filtfilt([1:10],[1:20],[1:10]) [data length less than 3 times filter order] \end_layout \end_inset @@ -9475,7 +10195,8 @@ Format \begin_layout Standard \family typewriter -chan = pspm_find_channel(headercell, chantype) +chan = pspm_find_channel(headercell, + chantype) \end_layout \begin_layout Subsubsection @@ -9501,7 +10222,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -9511,7 +10233,9 @@ Setup \begin_layout Standard \family typewriter -headercell = {`heart', `scr', `pupil'}; +headercell = {`heart', + `scr', + `pupil'}; \end_layout \begin_layout Subparagraph @@ -9579,7 +10303,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, `str') +pspm_find_channel(headercell, + `str') \end_layout \end_inset @@ -9603,7 +10328,8 @@ ID:not_allowed_channeltype \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, 4) [no string chantype] +pspm_find_channel(headercell, + 4) [no string chantype] \end_layout \end_inset @@ -9656,7 +10382,12 @@ Setup \begin_layout Standard \family typewriter -headercell = {`heart', `scr', `pupil', `mark', `gsr', `eda'}; +headercell = {`heart', + `scr', + `pupil', + `mark', + `gsr', + `eda'}; \end_layout \begin_layout Subparagraph @@ -9711,7 +10442,8 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, `pupil') +pspm_find_channel(headercell, + `pupil') \end_layout \end_inset @@ -9744,7 +10476,8 @@ pspm_find_channel(headercell, `pupil') \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, `resp') +pspm_find_channel(headercell, + `resp') \end_layout \end_inset @@ -9779,7 +10512,8 @@ ID:no_matching_channels \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, `scr') +pspm_find_channel(headercell, + `scr') \end_layout \end_inset @@ -9814,7 +10548,10 @@ ID:multiple_matching_channels \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, {`mark', `str', `bla'}) +pspm_find_channel(headercell, + {`mark', + `str', + `bla'}) \end_layout \end_inset @@ -9847,7 +10584,10 @@ pspm_find_channel(headercell, {`mark', `str', `bla'}) \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, {`call', `str', `me'}) +pspm_find_channel(headercell, + {`call', + `str', + `me'}) \end_layout \end_inset @@ -9869,7 +10609,8 @@ pspm_find_channel(headercell, {`call', `str', `me'}) \begin_layout Plain Layout \family typewriter -no matching channel, but no warning +no matching channel, + but no warning \end_layout \end_inset @@ -9882,7 +10623,10 @@ no matching channel, but no warning \begin_layout Plain Layout \family typewriter -pspm_find_channel(headercell, {`scr', `gsr', `eda'}) +pspm_find_channel(headercell, + {`scr', + `gsr', + `eda'}) \end_layout \end_inset @@ -9904,7 +10648,8 @@ pspm_find_channel(headercell, {`scr', `gsr', `eda'}) \begin_layout Plain Layout \family typewriter -multiple matching channels, but no warning +multiple matching channels, + but no warning \end_layout \end_inset @@ -9942,7 +10687,8 @@ Format \begin_layout Standard \family typewriter -[sts, out] = pspm_extract_segments(varargin) +[sts, + out] = pspm_extract_segments(varargin) \end_layout \begin_layout Subsubsection @@ -9951,13 +10697,15 @@ Setup \begin_layout Standard This test class is parameterised. - For manual mode tests, the test data is generated by the function itself - and when needed, files will be written to + For manual mode tests, + the test data is generated by the function itself and when needed, + files will be written to \family typewriter testdatafile.mat \family default . - For auto mode tests, the test data must be in + For auto mode tests, + the test data must be in \family typewriter ImportTestData/fitted_models \family default @@ -9969,8 +10717,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data should be passed to - +These are parameters which define what kind of data should be passed to \family typewriter pspm_extract_segments \family default @@ -9987,8 +10734,8 @@ nan_output NaN \family default ratios of the trials for each condition. - If so, we values can be printed on the screen (on MATLAB command window) - or written to a created file. + If so, + we values can be printed on the screen (on MATLAB command window) or written to a created file. \end_layout \begin_layout Description @@ -10034,7 +10781,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -10538,8 +11286,7 @@ pspm_extract_segments ImportTestData/fitted_models \family default and compares the results to manually calculated results. - In order to get meaningful condition statistic information this test function - assigns the same trial name to certain groups of trials. + In order to get meaningful condition statistic information this test function assigns the same trial name to certain groups of trials. \end_layout \begin_layout Subparagraph @@ -10547,8 +11294,8 @@ Note \end_layout \begin_layout Standard -Since in DCM case onsets are calculated using trial start and end seconds - of DCM trials, there is no second/marker distinction in DCM test. +Since in DCM case onsets are calculated using trial start and end seconds of DCM trials, + there is no second/marker distinction in DCM test. \end_layout \begin_layout Subparagraph @@ -10588,7 +11335,9 @@ Format \begin_layout Standard \family typewriter -[sts, infos] = pspm_find_sounds(file, options) +[sts, + infos] = pspm_find_sounds(file, + options) \end_layout \begin_layout Subsubsection @@ -10597,8 +11346,8 @@ Setup \begin_layout Standard This test class is parameterised. - The test data is generated by the function itself and when needed, files - will be written to + The test data is generated by the function itself and when needed, + files will be written to \family typewriter testdatafile.mat \family default @@ -10610,8 +11359,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data should be passed to - pspm_find_sounds and which options should be set. +These are parameters which define what kind of data should be passed to pspm_find_sounds and which options should be set. \begin_inset Newline newline \end_inset @@ -10667,8 +11415,7 @@ Max delay \begin_inset Text \begin_layout Plain Layout -Varies the max delay option and defines how far away a marker at most can - be. +Varies the max delay option and defines how far away a marker at most can be. \end_layout \end_inset @@ -10690,8 +11437,7 @@ Min delay \begin_inset Text \begin_layout Plain Layout -Varies the min delay option and defines how far away a marker at least should - be. +Varies the min delay option and defines how far away a marker at least should be. \end_layout \end_inset @@ -10736,8 +11482,7 @@ Resample \begin_inset Text \begin_layout Plain Layout -Defines whether the function should resample (and interpolate) the data - to a higher sample rate in order to get more exact marker findings. +Defines whether the function should resample (and interpolate) the data to a higher sample rate in order to get more exact marker findings. \end_layout \end_inset @@ -10759,8 +11504,7 @@ Channel action \begin_inset Text \begin_layout Plain Layout -Defines whether a newly created marker channel should replace the existing - marker channel or should be added as a new marker channel. +Defines whether a newly created marker channel should replace the existing marker channel or should be added as a new marker channel. \end_layout \end_inset @@ -10796,7 +11540,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -10912,7 +11657,8 @@ ID:no_sound_chan \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid values for positive integer fields] +pspm_find_sounds(fn, + o) [invalid values for positive integer fields] \end_layout \end_inset @@ -10936,7 +11682,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid values for positive numeric fields] +pspm_find_sounds(fn, + o) [invalid values for positive numeric fields] \end_layout \end_inset @@ -10960,7 +11707,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid values for logic fields] +pspm_find_sounds(fn, + o) [invalid values for logic fields] \end_layout \end_inset @@ -10984,7 +11732,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid channel ids for channel fields] +pspm_find_sounds(fn, + o) [invalid channel ids for channel fields] \end_layout \end_inset @@ -11008,7 +11757,8 @@ ID:out_of_range \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [enabled diagnostics without a marker channel] +pspm_find_sounds(fn, + o) [enabled diagnostics without a marker channel] \end_layout \end_inset @@ -11032,7 +11782,8 @@ ID:no_marker_chan \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid values for channelaction] +pspm_find_sounds(fn, + o) [invalid values for channelaction] \end_layout \end_inset @@ -11056,7 +11807,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [invalid values for roi] +pspm_find_sounds(fn, + o) [invalid values for roi] \end_layout \end_inset @@ -11080,7 +11832,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_sounds(fn, o) [maxdelay < mindelay] +pspm_find_sounds(fn, + o) [maxdelay < mindelay] \end_layout \end_inset @@ -11115,7 +11868,11 @@ Function name \begin_layout Standard \family typewriter -test_add_channel(this, channeloutput, max_delay, resample, channelaction) +test_add_channel(this, + channeloutput, + max_delay, + resample, + channelaction) \end_layout \begin_layout Subparagraph @@ -11124,13 +11881,16 @@ Description \begin_layout Standard Test add channel with different options. - Diagnostics is always enabled, Channel output, Max delay, Resample and - Channel action are varied. + Diagnostics is always enabled, + Channel output, + Max delay, + Resample and Channel action are varied. Once \family typewriter pspm_find_sounds \family default - is complete, the function tests if the returned data has the expected format. + is complete, + the function tests if the returned data has the expected format. \end_layout \begin_layout Subparagraph @@ -11146,7 +11906,8 @@ snd \family typewriter marker \family default -; and count amount of reference markers +; + and count amount of reference markers \end_layout \begin_layout Enumerate @@ -11228,8 +11989,7 @@ Test if function finds the function finds all markers in the whole file \end_layout \begin_layout Enumerate -Test if function finds all the markers in the whole file with initial threshold - 1 +Test if function finds all the markers in the whole file with initial threshold 1 \end_layout \begin_layout Enumerate @@ -11247,7 +12007,8 @@ Function name \begin_layout Standard \family typewriter -test_threshold(this, threshold) +test_threshold(this, + threshold) \end_layout \begin_layout Subparagraph @@ -11255,8 +12016,7 @@ Description \end_layout \begin_layout Standard -Vary the threshold option and test whether the functions returnes the expected - data. +Vary the threshold option and test whether the functions returnes the expected data. \end_layout \begin_layout Subparagraph @@ -11316,7 +12076,8 @@ Function name \begin_layout Standard \family typewriter -test_plot(this, threshold) +test_plot(this, + threshold) \end_layout \begin_layout Subparagraph @@ -11324,8 +12085,7 @@ Description \end_layout \begin_layout Standard -Test if the plot functions returne the expected data and runs through without - warning. +Test if the plot functions returne the expected data and runs through without warning. \end_layout \begin_layout Subparagraph @@ -11401,7 +12161,9 @@ Format \begin_layout Standard \family typewriter -[sts, out_file] = pspm_find_valid_fixations(fn, options) +[sts, + out_file] = pspm_find_valid_fixations(fn, + options) \end_layout \begin_layout Subsubsection @@ -11410,8 +12172,8 @@ Setup \begin_layout Standard This test class is parameterised. - The test data is generated by the function itself and when needed, files - will be written to + The test data is generated by the function itself and when needed, + files will be written to \family typewriter testdatafile.mat \family default @@ -11423,8 +12185,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data should be passed to - +These are parameters which define what kind of data should be passed to \family typewriter pspm_find_valid_fixations \family default @@ -11453,7 +12214,8 @@ Distance \begin_inset Text \begin_layout Plain Layout -Used for gaze validation; defines the distance between eyes and screen. +Used for gaze validation; + defines the distance between eyes and screen. \end_layout \end_inset @@ -11475,7 +12237,8 @@ Aspect used \begin_inset Text \begin_layout Plain Layout -Used for gaze validation; defines the aspect ratio set in the software. +Used for gaze validation; + defines the aspect ratio set in the software. \end_layout \end_inset @@ -11497,7 +12260,8 @@ Aspect actual \begin_inset Text \begin_layout Plain Layout -Used for gaze validation; defines the aspect ratio of the hardware. +Used for gaze validation; + defines the aspect ratio of the hardware. \end_layout \end_inset @@ -11519,7 +12283,8 @@ Screen size \begin_inset Text \begin_layout Plain Layout -Used for gaze validation; defines the size of the screen in inches. +Used for gaze validation; + defines the size of the screen in inches. \end_layout \end_inset @@ -11541,8 +12306,7 @@ Eyes \begin_inset Text \begin_layout Plain Layout -Is used for data generation and tells the function for which eyes data should - be generated. +Is used for data generation and tells the function for which eyes data should be generated. \end_layout \end_inset @@ -11664,8 +12428,7 @@ Missing \begin_inset Text \begin_layout Plain Layout -Defines whether to create a channel which holds information about which - positions have been set to +Defines whether to create a channel which holds information about which positions have been set to \family typewriter NaN \family default @@ -11749,7 +12512,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -11841,7 +12605,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.validate_fixations] +pspm_find_valid_fixations(fn, + options) [invalid options.validate_fixations] \end_layout \end_inset @@ -11865,7 +12630,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.box_degree] +pspm_find_valid_fixations(fn, + options) [invalid options.box_degree] \end_layout \end_inset @@ -11889,7 +12655,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.screen_settings] +pspm_find_valid_fixations(fn, + options) [invalid options.screen_settings] \end_layout \end_inset @@ -11913,8 +12680,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [missing fields for options.screen_setting -s] +pspm_find_valid_fixations(fn, + options) [missing fields for options.screen_settings] \end_layout \end_inset @@ -11938,7 +12705,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.aspect_actual] +pspm_find_valid_fixations(fn, + options) [invalid options.aspect_actual] \end_layout \end_inset @@ -11962,7 +12730,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.aspect_used] +pspm_find_valid_fixations(fn, + options) [invalid options.aspect_used] \end_layout \end_inset @@ -11986,7 +12755,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.bitmap] +pspm_find_valid_fixations(fn, + options) [invalid options.bitmap] \end_layout \end_inset @@ -12010,7 +12780,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.display_size] +pspm_find_valid_fixations(fn, + options) [invalid options.display_size] \end_layout \end_inset @@ -12034,7 +12805,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.display_size] +pspm_find_valid_fixations(fn, + options) [invalid options.display_size] \end_layout \end_inset @@ -12058,7 +12830,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.fixation_point] +pspm_find_valid_fixations(fn, + options) [invalid options.fixation_point] \end_layout \end_inset @@ -12082,7 +12855,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.channel_action] +pspm_find_valid_fixations(fn, + options) [invalid options.channel_action] \end_layout \end_inset @@ -12106,7 +12880,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.newfile] +pspm_find_valid_fixations(fn, + options) [invalid options.newfile] \end_layout \end_inset @@ -12130,7 +12905,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.overwrite] +pspm_find_valid_fixations(fn, + options) [invalid options.overwrite] \end_layout \end_inset @@ -12154,7 +12930,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.interpolate] +pspm_find_valid_fixations(fn, + options) [invalid options.interpolate] \end_layout \end_inset @@ -12178,7 +12955,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.missing] +pspm_find_valid_fixations(fn, + options) [invalid options.missing] \end_layout \end_inset @@ -12202,7 +12980,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid eyes] +pspm_find_valid_fixations(fn, + options) [invalid eyes] \end_layout \end_inset @@ -12226,7 +13005,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_find_valid_fixations(fn, options) [invalid options.channels] +pspm_find_valid_fixations(fn, + options) [invalid options.channels] \end_layout \end_inset @@ -12261,7 +13041,8 @@ Function name \begin_layout Standard \family typewriter -test_work_chans(this, work_chans) +test_work_chans(this, + work_chans) \end_layout \begin_layout Subparagraph @@ -12369,7 +13150,8 @@ Function name \begin_layout Standard \family typewriter -test_work_eye(this, work_eye) +test_work_eye(this, + work_eye) \end_layout \begin_layout Subparagraph @@ -12453,8 +13235,7 @@ sts==1 \end_layout \begin_layout Enumerate -Test if specified eyes have been processed accordingly and test if not specified - eyes have ignored. +Test if specified eyes have been processed accordingly and test if not specified eyes have ignored. \end_layout \begin_layout Paragraph @@ -12468,7 +13249,8 @@ Function name \begin_layout Standard \family typewriter -test_missing(this, missing) +test_missing(this, + missing) \end_layout \begin_layout Subparagraph @@ -12476,8 +13258,7 @@ Description \end_layout \begin_layout Standard -Test whether for each a a new missing channel is created if missing is specified - as true. +Test whether for each a a new missing channel is created if missing is specified as true. \end_layout \begin_layout Subparagraph @@ -12563,7 +13344,8 @@ Depending on the status of \family typewriter `missing' \family default -, test if there are any missing channels or if there is no missing channel +, + test if there are any missing channels or if there is no missing channel \end_layout \begin_layout Paragraph @@ -12577,7 +13359,8 @@ Function name \begin_layout Standard \family typewriter -test_interpolate(this, interpolate) +test_interpolate(this, + interpolate) \end_layout \begin_layout Subparagraph @@ -12687,7 +13470,8 @@ Function name \begin_layout Standard \family typewriter -test_overwrite(this, overwrite) +test_overwrite(this, + overwrite) \end_layout \begin_layout Subparagraph @@ -12695,7 +13479,8 @@ Description \end_layout \begin_layout Standard -Test if files are overwritten, if specified with +Test if files are overwritten, + if specified with \family typewriter `overwrite' \family default @@ -12781,7 +13566,8 @@ sts==1 \end_layout \begin_layout Enumerate -Test if file has been overwritten or not (tests, if there are any new channels). +Test if file has been overwritten or not (tests, + if there are any new channels). \end_layout \begin_layout Paragraph @@ -12795,7 +13581,8 @@ Function name \begin_layout Standard \family typewriter -test_channel_action(this, channel_action) +test_channel_action(this, + channel_action) \end_layout \begin_layout Subparagraph @@ -12879,8 +13666,8 @@ sts==1 \end_layout \begin_layout Enumerate -Test if channels have been added or replaced (tests, if there are any new - channels). +Test if channels have been added or replaced (tests, + if there are any new channels). \end_layout \begin_layout Paragraph @@ -12894,7 +13681,8 @@ Function name \begin_layout Standard \family typewriter -test_newfile(this, newfile) +test_newfile(this, + newfile) \end_layout \begin_layout Subparagraph @@ -12979,7 +13767,8 @@ if \family typewriter newfile \family default - is disabled, set + is disabled, + set \family typewriter options.newfile \family default @@ -13000,8 +13789,7 @@ sts==1 \end_layout \begin_layout Enumerate -Test if returned outputfile equals the specified newfile or not (depending - on the value of +Test if returned outputfile equals the specified newfile or not (depending on the value of \family typewriter `newfile' \family default @@ -13019,7 +13807,11 @@ Function name \begin_layout Standard \family typewriter -test_gaze_validation(this, distance, screen_size, aspect_actual, aspect_used, +test_gaze_validation(this, + distance, + screen_size, + aspect_actual, + aspect_used, eyes) \end_layout @@ -13071,13 +13863,12 @@ missing = 1 \end_deeper \begin_layout Enumerate -depending on the specified degree, test whether function runs through without - warnings or not +depending on the specified degree, + test whether function runs through without warnings or not \end_layout \begin_layout Enumerate -load outputfile and test if (according to degree expectation) gaze validation - has been done or not +load outputfile and test if (according to degree expectation) gaze validation has been done or not \end_layout \end_deeper @@ -13092,7 +13883,10 @@ Function name \begin_layout Standard \family typewriter -test_bitmap_validation(this, distance, resolution, eyes) +test_bitmap_validation(this, + distance, + resolution, + eyes) \end_layout \begin_layout Subparagraph @@ -13129,13 +13923,12 @@ missing 1 \end_deeper \begin_layout Enumerate -Depending on the specified number of valid fixations in the bitmap, test - whether function runs through without warnings or not. +Depending on the specified number of valid fixations in the bitmap, + test whether function runs through without warnings or not. \end_layout \begin_layout Enumerate -Load outputfile and test if (according to bitmap expectation) bitmap validation - has been done or not. +Load outputfile and test if (according to bitmap expectation) bitmap validation has been done or not. \end_layout \end_deeper @@ -13166,7 +13959,8 @@ Function \family typewriter pspm_gaze_pp \family default - preprocesses gaze signals, gaze + preprocesses gaze signals, + gaze \family typewriter x \family default @@ -13378,7 +14172,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_ecg(import) +[sts, + data] = pspm_get_ecg(import) \end_layout \begin_layout Subsubsection @@ -13494,7 +14289,8 @@ Function \begin_layout Standard \family typewriter -[sts, import] = pspm_get_events(import) +[sts, + import] = pspm_get_events(import) \end_layout \begin_layout Subsubsection @@ -13520,7 +14316,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the field +Checks for warnings, + if the field \family typewriter ‘.markers' \family default @@ -13647,8 +14444,7 @@ sts==1 \end_layout \begin_layout Enumerate -Test if the length of the output data is equal to the length of the input - data. +Test if the length of the output data is equal to the length of the input data. \end_layout \begin_layout Paragraph @@ -13707,8 +14503,7 @@ Test if the length of the field \end_layout \begin_layout Enumerate -Test if the length of the output data is equal to the expected number of - pulses in the input data. +Test if the length of the output data is equal to the expected number of pulses in the input data. \end_layout \begin_layout Standard @@ -13759,7 +14554,8 @@ check with \end_deeper \begin_layout Enumerate -Additional test for setting (b): Test if +Additional test for setting (b): + Test if \family typewriter data offset \family default @@ -13767,8 +14563,8 @@ data offset \end_layout \begin_layout Enumerate -Additional test for setting (c) and (d): Test if positions returned by output - data correspond to flank changes in the input data. +Additional test for setting (c) and (d): + Test if positions returned by output data correspond to flank changes in the input data. \end_layout \begin_layout Enumerate @@ -13800,7 +14596,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_eyelink(import) +[sts, + data] = pspm_get_eyelink(import) \end_layout \begin_layout Subsubsection @@ -13818,7 +14615,8 @@ Function \begin_layout Standard \family typewriter -[import_struct, channel typles] = set_import_values(this) +[import_struct, + channel typles] = set_import_values(this) \end_layout \begin_layout Subparagraph @@ -13826,8 +14624,8 @@ Description \end_layout \begin_layout Standard -Helperfunction, which creates an import data set and the expected channel - data set +Helperfunction, + which creates an import data set and the expected channel data set \end_layout \begin_layout Paragraph @@ -13841,7 +14639,10 @@ Function name \begin_layout Standard \family typewriter -verify_basic_data_structure(this, data, sourceinfo, channel_types) +verify_basic_data_structure(this, + data, + sourceinfo, + channel_types) \end_layout \begin_layout Subparagraph @@ -13849,8 +14650,7 @@ Description \end_layout \begin_layout Standard -Tests if the returned data structure is valid and match a given expected - pattern. +Tests if the returned data structure is valid and match a given expected pattern. \end_layout \begin_layout Subparagraph @@ -13932,8 +14732,7 @@ Description \end_layout \begin_layout Standard -Test if the returned data structure fits into the pattern of a multi session - data set. +Test if the returned data structure fits into the pattern of a multi session data set. \end_layout \begin_layout Subparagraph @@ -13975,8 +14774,7 @@ Description \end_layout \begin_layout Standard -Test if the returned data structure fits into the pattern of a two eyes - data set. +Test if the returned data structure fits into the pattern of a two eyes data set. \end_layout \begin_layout Subparagraph @@ -14018,8 +14816,7 @@ Description \end_layout \begin_layout Standard -Test if the returned data structure fits into the pattern of a one eye data - set. +Test if the returned data structure fits into the pattern of a one eye data set. \end_layout \begin_layout Subparagraph @@ -14027,8 +14824,7 @@ Tests \end_layout \begin_layout Enumerate -Create an import data set and the expected channel data set an pass it to - +Create an import data set and the expected channel data set an pass it to \family typewriter `verify_basic_data_structure()' \family default @@ -14052,8 +14848,7 @@ Description \end_layout \begin_layout Standard -Test if the returned data structure fits into the pattern of a two eyes - data with +Test if the returned data structure fits into the pattern of a two eyes data with \family typewriter eyelink_trackdist \family default @@ -14109,7 +14904,8 @@ Format \begin_layout Standard \family typewriter -[sts, data] = pspm_get_hb(import) +[sts, + data] = pspm_get_hb(import) \end_layout \begin_layout Subsubsection @@ -14213,7 +15009,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_hr(import) +[sts, + data] = pspm_get_hr(import) \end_layout \begin_layout Subsubsection @@ -14319,7 +15116,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_marker(import) +[sts, + data] = pspm_get_marker(import) \end_layout \begin_layout Subsubsection @@ -14429,7 +15227,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_pupil(import) +[sts, + data] = pspm_get_pupil(import) \end_layout \begin_layout Subsubsection @@ -14535,7 +15334,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_resp(import) +[sts, + data] = pspm_get_resp(import) \end_layout \begin_layout Subsubsection @@ -14641,7 +15441,8 @@ Function \begin_layout Standard \family typewriter -[sts, data] = pspm_get_scr(import) +[sts, + data] = pspm_get_scr(import) \end_layout \begin_layout Subsubsection @@ -14650,11 +15451,10 @@ Testcases \begin_layout Standard There are three test functions. - One for the case that no transfer parameters are defined, one for the case - that the transfer parameters are defined in a struct and one for the case - that they are defined in a .mat file. - They are all performing the following tests, plus eventually some individual - tests. + One for the case that no transfer parameters are defined, + one for the case that the transfer parameters are defined in a struct and one for the case that they are defined in a .mat file. + They are all performing the following tests, + plus eventually some individual tests. \end_layout \begin_layout Subparagraph @@ -14746,8 +15546,8 @@ Description \end_layout \begin_layout Standard -Test if all fields are returned correctly, if no transfer parameters are - defined. +Test if all fields are returned correctly, + if no transfer parameters are defined. \end_layout \begin_layout Subparagraph @@ -14777,8 +15577,8 @@ Description \end_layout \begin_layout Standard -Test if all fields are returned correctly, if the transfer parameters are - defined in a struct. +Test if all fields are returned correctly, + if the transfer parameters are defined in a struct. \end_layout \begin_layout Subparagraph @@ -14825,8 +15625,8 @@ Description \end_layout \begin_layout Standard -Test if all fields are returned correctly, if the transfer parameters are - defined in a +Test if all fields are returned correctly, + if the transfer parameters are defined in a \family typewriter .mat \family default @@ -14867,25 +15667,35 @@ Functions \begin_layout Itemize \family typewriter -[sts, multi] = pspm_get_timing(`onsets', intiming, timeunits) +[sts, + multi] = pspm_get_timing(`onsets', + intiming, + timeunits) \end_layout \begin_layout Itemize \family typewriter -[sts, events] = pspm_get_timing(`markervalues', markerinfo, names) +[sts, + events] = pspm_get_timing(`markervalues', + markerinfo, + names) \end_layout \begin_layout Itemize \family typewriter -[sts, epochs] = pspm_get_timing(`epochs', epochs) +[sts, + epochs] = pspm_get_timing(`epochs', + epochs) \end_layout \begin_layout Itemize \family typewriter -[sts, events] = pspm_get_timing(`events', events) +[sts, + events] = pspm_get_timing(`events', + events) \end_layout \begin_layout Subsubsection @@ -14911,7 +15721,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -14983,7 +15794,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_get_timing(`onsets', `str') [no timeunits var] +pspm_get_timing(`onsets', + `str') [no timeunits var] \end_layout \end_inset @@ -15031,8 +15843,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_get_timing(`onsets', intiming, `samples') [two sessions with nonmatching - number of conditions] +pspm_get_timing(`onsets', + intiming, + `samples') [two sessions with nonmatching number of conditions] \end_layout \end_inset @@ -15056,8 +15869,9 @@ ID:number_of_elements_dont_match \begin_layout Plain Layout \family typewriter -pspm_get_timing(`onsets', intiming, `samples') [two sessions with nonmatching - condition names] +pspm_get_timing(`onsets', + intiming, + `samples') [two sessions with nonmatching condition names] \end_layout \end_inset @@ -15081,8 +15895,9 @@ ID:event_names_dont_match \begin_layout Plain Layout \family typewriter -pspm_get_timing(`onsets', intiming, `samples') [intiming.onsets{1} is no - numeric vector] +pspm_get_timing(`onsets', + intiming, + `samples') [intiming.onsets{1} is no numeric vector] \end_layout \end_inset @@ -15106,7 +15921,9 @@ ID:no_numeric_vector \begin_layout Plain Layout \family typewriter -pspm_get_timing(`epochs', fn_mat, `samples') [epochs is not an integer array] +pspm_get_timing(`epochs', + fn_mat, + `samples') [epochs is not an integer array] \end_layout \end_inset @@ -15130,8 +15947,8 @@ ID:no_integers \begin_layout Plain Layout \family typewriter -pspm_get_timing(`markervalues', markerinfo) [no markervalue and no name - ] +pspm_get_timing(`markervalues', + markerinfo) [no markervalue and no name ] \end_layout \end_inset @@ -15155,8 +15972,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_get_timing(`markervalues', markerinfo, markervalue, names) [markervalue - is not of numeric type nor a cell array] +pspm_get_timing(`markervalues', + markerinfo, + markervalue, + names) [markervalue is not of numeric type nor a cell array] \end_layout \end_inset @@ -15180,8 +15999,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_get_timing(`markervalues', markerinfo, markervalue, names) [markervalue - and names are not of the same length] +pspm_get_timing(`markervalues', + markerinfo, + markervalue, + names) [markervalue and names are not of the same length] \end_layout \end_inset @@ -15238,7 +16059,9 @@ Function \begin_layout Standard \family typewriter -[sts, epochs] = pspm_get_timing(`epochs', epochs) +[sts, + epochs] = pspm_get_timing(`epochs', + epochs) \end_layout \begin_layout Paragraph @@ -15254,9 +16077,12 @@ Input \family typewriter mat \family default - file with variable: + file with variable: + \family typewriter -epochs = [1 4; 2 5; 3 6] +epochs = [1 4; + 2 5; + 3 6] \end_layout \begin_layout Standard @@ -15281,9 +16107,11 @@ Input \family typewriter mat \family default - file with variable: + file with variable: + \family typewriter -onsets{1} = [1 2 3]'; onsets{2} = [4 5 6]' +onsets{1} = [1 2 3]'; + onsets{2} = [4 5 6]' \family default ; \end_layout @@ -15295,7 +16123,8 @@ sts==1 \family default and if the return value is equal \family typewriter -[onsets{1}, onsets{2}] +[onsets{1}, + onsets{2}] \family default . @@ -15310,9 +16139,12 @@ Input \end_layout \begin_layout Standard -textfile with variable: +textfile with variable: + \family typewriter -epochs = [1 4; 2 5; 3 6] +epochs = [1 4; + 2 5; + 3 6] \end_layout \begin_layout Standard @@ -15333,9 +16165,12 @@ Input \end_layout \begin_layout Standard -matrix: +matrix: + \family typewriter -epochs = [1 4; 2 5; 3 6] +epochs = [1 4; + 2 5; + 3 6] \end_layout \begin_layout Standard @@ -15380,7 +16215,10 @@ Function \begin_layout Standard \family typewriter -[sts, multi] = pspm_get_timing(`onsets', intiming, timeunits) +[sts, + multi] = pspm_get_timing(`onsets', + intiming, + timeunits) \end_layout \begin_layout Paragraph @@ -15402,37 +16240,45 @@ A \begin_layout Itemize \family typewriter -names = {`name1', `name2'}; +names = {`name1', + `name2'}; \end_layout \begin_layout Itemize \family typewriter -onsets = {[1 2], [3 4]}; +onsets = {[1 2], + [3 4]}; \end_layout \begin_layout Itemize \family typewriter -pmod.name = {`name3', `name4'}; +pmod.name = {`name3', + `name4'}; \end_layout \begin_layout Itemize \family typewriter -pmod.param = {[2 3], [4 5]}; +pmod.param = {[2 3], + [4 5]}; \end_layout \begin_layout Itemize \family typewriter -pmod.poly = {2, 2}; +pmod.poly = {2, + 2}; \end_layout \begin_layout Itemize \family typewriter -save(fn_mat, `names', `onsets', `pmod'); +save(fn_mat, + `names', + `onsets', + `pmod'); \end_layout \begin_layout Subparagraph @@ -15442,7 +16288,10 @@ Function call \begin_layout Standard \family typewriter -[sts, outtiming] = pspm_get_timing(`onsets', fn_mat, `samples'); +[sts, + outtiming] = pspm_get_timing(`onsets', + fn_mat, + `samples'); \end_layout \begin_layout Subparagraph @@ -15454,13 +16303,17 @@ Check if \family typewriter sts==1 \family default -, if onsets and names are unchanged and if +, + if onsets and names are unchanged and if \end_layout \begin_layout Standard \family typewriter -outtiming.pmod.param == {[2 3], [4 9], [4 5], [16 25]} +outtiming.pmod.param == {[2 3], + [4 9], + [4 5], + [16 25]} \end_layout \begin_layout Paragraph @@ -15482,31 +16335,38 @@ A \begin_layout Itemize \family typewriter -names = {`name1', `name2'}; +names = {`name1', + `name2'}; \end_layout \begin_layout Itemize \family typewriter -onsets = {[1 2 3], [3 4 5]}; durations = {[3 4 5]', [5 6 7]'}; +onsets = {[1 2 3], + [3 4 5]}; + durations = {[3 4 5]', + [5 6 7]'}; \end_layout \begin_layout Itemize \family typewriter -pmod.name = {`name3', `name4'}; +pmod.name = {`name3', + `name4'}; \end_layout \begin_layout Itemize \family typewriter -pmod.param = {[2 3 4], [4 5 6]}; +pmod.param = {[2 3 4], + [4 5 6]}; \end_layout \begin_layout Itemize \family typewriter -pmod.poly = {2, 1}; +pmod.poly = {2, + 1}; \end_layout \begin_layout Subparagraph @@ -15516,7 +16376,10 @@ Function call \begin_layout Standard \family typewriter -[sts, outtiming] = pspm_get_timing(`onsets', fn_mat, `samples'); +[sts, + outtiming] = pspm_get_timing(`onsets', + fn_mat, + `samples'); \end_layout \begin_layout Subparagraph @@ -15528,9 +16391,13 @@ Check if \family typewriter sts==1 \family default -, if onsets, names and durations are unchanged and if +, + if onsets, + names and durations are unchanged and if \family typewriter -outtiming.pmod.param == {[2 3 4], [4 9 16], [4 5 6]} +outtiming.pmod.param == {[2 3 4], + [4 9 16], + [4 5 6]} \family default . \end_layout @@ -15568,12 +16435,13 @@ Function \begin_layout Standard \family typewriter -[sts, epochs] = pspm_get_timing(`events', events) +[sts, + epochs] = pspm_get_timing(`events', + events) \end_layout \begin_layout Standard -Check the function if input is a one element cell array and a multiple element - cell array. +Check the function if input is a one element cell array and a multiple element cell array. \end_layout \begin_layout Standard @@ -15581,8 +16449,7 @@ Check for warnings ( \family typewriter ID:invalid_vector_size \family default -) if elements have more than two columns and if not all elements have the - same number of rows. +) if elements have more than two columns and if not all elements have the same number of rows. \end_layout \begin_layout Subsection @@ -15599,7 +16466,8 @@ The datatype import functions are all tested in a similar way. \family typewriter ‘pspm_get_superclass' \family default -, from which they inherit the main test function +, + from which they inherit the main test function \family typewriter ‘valid_datafile' \family default @@ -15608,12 +16476,12 @@ The datatype import functions are all tested in a similar way. \family typewriter ‘fhandle' \family default -, which is a function handle to the specific import function. +, + which is a function handle to the specific import function. \end_layout \begin_layout Standard -The tests are performed with the sampledata files that are listed in the - SampleDataMasterList.docx file (as at 18.11.2013). +The tests are performed with the sampledata files that are listed in the SampleDataMasterList.docx file (as at 18.11.2013). \end_layout \begin_layout Subparagraph @@ -15739,7 +16607,10 @@ Function \begin_layout Standard \family typewriter -[sts, import, sourceinfo] = pspm_get_(datafile, import) +[sts, + import, + sourceinfo] = pspm_get_(datafile, + import) \end_layout \begin_layout Subsubsection @@ -15755,8 +16626,7 @@ Define testcases \end_layout \begin_layout Standard -In this method the testcases are defined and the testdata is generated (if - needed). +In this method the testcases are defined and the testdata is generated (if needed). Each testcase is a cell in the cellarray \family typewriter ‘testcases' @@ -15770,7 +16640,8 @@ In this method the testcases are defined and the testdata is generated (if \family typewriter .pth \family default -: the path to the samplefile +: + the path to the samplefile \end_layout \begin_layout Itemize @@ -15778,7 +16649,8 @@ In this method the testcases are defined and the testdata is generated (if \family typewriter .import \family default -: the input variable +: + the input variable \end_layout \begin_layout Standard @@ -15814,7 +16686,8 @@ Description \end_layout \begin_layout Standard -The main test function, for tests with valid inputdata. +The main test function, + for tests with valid inputdata. It tests all testcases equally. \end_layout @@ -15831,7 +16704,8 @@ sts==1 \end_layout \begin_layout Enumerate -If the datatype supports blocks, test if the number of blocks is correct. +If the datatype supports blocks, + test if the number of blocks is correct. \end_layout \begin_layout Enumerate @@ -15847,7 +16721,8 @@ Test if each importjob has a field \family typewriter ‘data' \family default -, that is a numeric vector. +, + that is a numeric vector. \end_layout \begin_layout Enumerate @@ -15855,7 +16730,8 @@ Test if each importjob has a field \family typewriter ‘sr' \family default -, that is a number. +, + that is a number. \end_layout \begin_layout Enumerate @@ -15922,7 +16798,8 @@ Description \end_layout \begin_layout Standard -The main test function, for tests with invalid inputdata. +The main test function, + for tests with invalid inputdata. \end_layout \begin_layout Subparagraph @@ -15930,8 +16807,9 @@ Tests \end_layout \begin_layout Standard -If the datatype supports multiple channels: Check for warning when trying - to import a channel, that is not contained in the file ( +If the datatype supports multiple channels: + Check for warning when trying to import a channel, + that is not contained in the file ( \family typewriter `ID:channel_not_contained_in_file' \family default @@ -15976,7 +16854,10 @@ Function \begin_layout Standard \family typewriter -[tss, import, sourceinfo] = pspm_get_acq(datafile, import) +[tss, + import, + sourceinfo] = pspm_get_acq(datafile, + import) \end_layout \begin_layout Subsubsection @@ -16070,21 +16951,21 @@ Function \begin_layout Standard \family typewriter -glm = pspm_glm(model, options) +glm = pspm_glm(model, + options) \end_layout \begin_layout Standard There are seven testcase functions. One invalid input arguments test and test 1 to 6. Tests 1 to 5 are of the same kind. - There are one or multiple testcases per test function, have a look at the - testcase description for more information. + There are one or multiple testcases per test function, + have a look at the testcase description for more information. In these tests only Kronecker delta functions are used as basis functions, - furthermore all conditions, pmods and nuisance regressors are pairwise - orthogonal. + furthermore all conditions, + pmods and nuisance regressors are pairwise orthogonal. The data is also not down sampled and not filtered. - With these limitations it's easy to calculate the data vectors and the - expected stats. + With these limitations it's easy to calculate the data vectors and the expected stats. For each testcase it is then tested: \end_layout @@ -16117,11 +16998,11 @@ glm.stats \end_layout \begin_layout Standard -In test 6 the default basis functions are used, and not all conditions and - pmods are orthogonal. +In test 6 the default basis functions are used, + and not all conditions and pmods are orthogonal. The data is down sampled and low and high pass filtered. - In exchange the stats are not tested for correct values, just for the correct - number of elements. + In exchange the stats are not tested for correct values, + just for the correct number of elements. The properties \family typewriter `shiftbf' @@ -16130,10 +17011,9 @@ In test 6 the default basis functions are used, and not all conditions and \family typewriter `norm' \family default - are TestParameters, which means that this testclass is parameterised. - All functions implmementing these parameters (Test 1 to Test 5) are called - several times with all the different values and combinations of the mentioned - parameters. + are TestParameters, + which means that this testclass is parameterised. + All functions implmementing these parameters (Test 1 to Test 5) are called several times with all the different values and combinations of the mentioned parameters. \end_layout \begin_layout Subsubsection @@ -16159,7 +17039,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -16563,8 +17444,7 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_glm(model) with R variable in the nuisance file that has not the same - length as the datafile +pspm_glm(model) with R variable in the nuisance file that has not the same length as the datafile \end_layout \end_inset @@ -16599,7 +17479,8 @@ Format \begin_layout Standard \family typewriter -test1(this, shiftbf) +test1(this, + shiftbf) \end_layout \begin_layout Subparagraph @@ -16607,7 +17488,9 @@ Description \end_layout \begin_layout Standard -Basic test with one basis function, one session, no nuisance regressors, +Basic test with one basis function, + one session, + no nuisance regressors, no missings and one condition. Timeunits are seconds. \end_layout @@ -16639,7 +17522,8 @@ Format \begin_layout Standard \family typewriter -test2(this, shiftbf) +test2(this, + shiftbf) \end_layout \begin_layout Subparagraph @@ -16647,8 +17531,10 @@ Description \end_layout \begin_layout Standard -Test with one basis function, one session, no nuisance regressors, no missings - and two conditions. +Test with one basis function, + one session, + no nuisance regressors, + no missings and two conditions. Timeunits are seconds. \end_layout @@ -16661,11 +17547,17 @@ no pmods \end_layout \begin_layout Enumerate -first condition: no pmods; second condition: one pmod +first condition: + no pmods; + second condition: + one pmod \end_layout \begin_layout Enumerate -first condition: one pmod; second condition: two pmods +first condition: + one pmod; + second condition: + two pmods \end_layout \begin_layout Paragraph @@ -16677,7 +17569,8 @@ Format \end_layout \begin_layout Standard -test3(this, shiftbf) +test3(this, + shiftbf) \end_layout \begin_layout Subparagraph @@ -16685,8 +17578,12 @@ Description \end_layout \begin_layout Standard -Test with one basis function, one session, two nuisance regressors (1Hz - cosinus, 1Hz sinus), no missings, one condition and no pmods. +Test with one basis function, + one session, + two nuisance regressors (1Hz cosinus, + 1Hz sinus), + no missings, + one condition and no pmods. Timeunits are seconds. \end_layout @@ -16710,7 +17607,8 @@ Format \begin_layout Standard \family typewriter -test4(this, shiftbf) +test4(this, + shiftbf) \end_layout \begin_layout Subparagraph @@ -16718,8 +17616,10 @@ Description \end_layout \begin_layout Standard -Test with one basis function, two sessions, no nuisance regressors, no missings - and one condition. +Test with one basis function, + two sessions, + no nuisance regressors, + no missings and one condition. \end_layout \begin_layout Subparagraph @@ -16749,7 +17649,8 @@ Format \begin_layout Standard \family typewriter -test5(this, shiftbf) +test5(this, + shiftbf) \end_layout \begin_layout Subparagraph @@ -16757,8 +17658,9 @@ Description \end_layout \begin_layout Standard -Test with two basis functions, one session, no nuisance regressors and one - condition. +Test with two basis functions, + one session, + no nuisance regressors and one condition. Timeunits are seconds. \end_layout @@ -16801,18 +17703,21 @@ Testcase \end_layout \begin_layout Standard -Default basis functions, no nuisance regressors, no missings, two sessions - and two conditions. +Default basis functions, + no nuisance regressors, + no missings, + two sessions and two conditions. Timeunits are seconds. \end_layout \begin_layout Itemize -first condition: two pmods (with pmod(1).poly{1} = 2 and pmod(1).poly{2} = - 3) +first condition: + two pmods (with pmod(1).poly{1} = 2 and pmod(1).poly{2} = 3) \end_layout \begin_layout Itemize -second condition: no pmods +second condition: + no pmods \end_layout \begin_layout Paragraph @@ -16824,7 +17729,9 @@ Format \end_layout \begin_layout Standard -test_extract_missing(this, cutoff, nan_percent) +test_extract_missing(this, + cutoff, + nan_percent) \end_layout \begin_layout Subparagraph @@ -16832,8 +17739,10 @@ Description \end_layout \begin_layout Standard -Test with one basis function, one session, no nuisance regressors, no missings - and three conditions. +Test with one basis function, + one session, + no nuisance regressors, + no missings and three conditions. Timeunits are seconds. \end_layout @@ -16926,7 +17835,11 @@ Function \begin_layout Standard \family typewriter -[sts, infos] = pspm_hb2hp(fn, sr, chan, options) +[sts, + infos] = pspm_hb2hp(fn, + sr, + chan, + options) \end_layout \begin_layout Subsubsection @@ -16952,7 +17865,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -17140,7 +18054,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_hb2hp(files{2}, 100) [not enough points for interp1] +pspm_hb2hp(files{2}, + 100) [not enough points for interp1] \end_layout \end_inset @@ -17213,7 +18128,10 @@ Function \begin_layout Standard \family typewriter -outfile = pspm_import(datafile, datatype, import, options) +outfile = pspm_import(datafile, + datatype, + import, + options) \end_layout \begin_layout Subsubsection @@ -17239,7 +18157,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -17302,7 +18221,8 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_import(datafile, datatype) [no import variable] +pspm_import(datafile, + datatype) [no import variable] \end_layout \end_inset @@ -17335,7 +18255,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_import(datafile, datatype, ‘foo') [no cell/struct import var.] +pspm_import(datafile, + datatype, + ‘foo') [no cell/struct import var.] \end_layout \end_inset @@ -17368,7 +18290,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_import(datafile, ‘foo', import) [invalid channeltype] +pspm_import(datafile, + ‘foo', + import) [invalid channeltype] \end_layout \end_inset @@ -17401,7 +18325,9 @@ ID:invalid_channeltype \begin_layout Plain Layout \family typewriter -pspm_import(5, datatype, import) [no char filename] +pspm_import(5, + datatype, + import) [no char filename] \end_layout \end_inset @@ -17444,7 +18370,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the structure of the import variable is invalid. +Checks for warnings, + if the structure of the import variable is invalid. \end_layout \begin_layout Standard @@ -17505,7 +18432,8 @@ Expected warning \begin_inset Text \begin_layout Plain Layout -Multiple channel, though not supported +Multiple channel, + though not supported \end_layout \end_inset @@ -17563,7 +18491,8 @@ ID:invalid_import_struct \begin_inset Text \begin_layout Plain Layout -No sr given, though autosr is not supported +No sr given, + though autosr is not supported \end_layout \end_inset @@ -17633,15 +18562,14 @@ Description \end_layout \begin_layout Standard -Checks the function, if datafile is a string (import of one datafile) and - all inputs are correct. +Checks the function, + if datafile is a string (import of one datafile) and all inputs are correct. The outfile is checked with the \family typewriter pspm_load_data \family default function. - The tests are performed with a spike samplefile and a labchartmat_in samplefile - (to check the handling of blocks). + The tests are performed with a spike samplefile and a labchartmat_in samplefile (to check the handling of blocks). \end_layout @@ -17664,8 +18592,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if datafile is a cell array of strings (import of multiple - datafiles) and all inputs are correct. +Checks the function, + if datafile is a cell array of strings (import of multiple datafiles) and all inputs are correct. The outfiles are tested with the \family typewriter pspm_load_data @@ -17699,7 +18627,9 @@ Function \begin_layout Standard \family typewriter -[sts, outdata] = pspm_interpolate(indata, options) +[sts, + outdata] = pspm_interpolate(indata, + options) \end_layout \begin_layout Subsubsection @@ -17708,8 +18638,8 @@ Setup \begin_layout Standard This test class is parameterised. - The test data is generated by the function itself and when needed, files - will be written to + The test data is generated by the function itself and when needed, + files will be written to \family typewriter datafile.mat \family default @@ -17721,8 +18651,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data should be passed to - +These are parameters which define what kind of data should be passed to \family typewriter pspm_interpolate \family default @@ -17835,10 +18764,8 @@ Chans \begin_inset Text \begin_layout Plain Layout -If datatype is not inline this specifies how many and which type of data - channels the generated data should have. - In a second field it also defines which of these channels should be interpolate -d (this will be passed later in options.channels). +If datatype is not inline this specifies how many and which type of data channels the generated data should have. + In a second field it also defines which of these channels should be interpolated (this will be passed later in options.channels). \end_layout \end_inset @@ -17907,8 +18834,8 @@ The offset is `extrap' \family default is not defined. - This is needed because if there is no data at the end or beginning of the - data, the function is unable to interpolate (unless extrapolation is activated). + This is needed because if there is no data at the end or beginning of the data, + the function is unable to interpolate (unless extrapolation is activated). \end_layout \end_inset @@ -17974,8 +18901,7 @@ Newfile \begin_inset Text \begin_layout Plain Layout -True or false and tells the function to either create a file or add the - data as new channel. +True or false and tells the function to either create a file or add the data as new channel. \end_layout \end_inset @@ -17997,8 +18923,7 @@ Overwrite \begin_inset Text \begin_layout Plain Layout -True or false and tells the function to either overwrite an existing file - or not. +True or false and tells the function to either overwrite an existing file or not. \end_layout \end_inset @@ -18020,8 +18945,7 @@ Replace channel \begin_inset Text \begin_layout Plain Layout -True or false and tells the function to either replace the given channels - with the interpolated data or to add the interpolated data as new channel. +True or false and tells the function to either replace the given channels with the interpolated data or to add the interpolated data as new channel. \end_layout \end_inset @@ -18057,7 +18981,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -18153,7 +19078,9 @@ ID:missing_data \begin_layout Plain Layout \family typewriter -pspm_interpolate({{}}) [data is not char, struct, numeric] +pspm_interpolate({{}}) [data is not char, + struct, + numeric] \end_layout \end_inset @@ -18285,8 +19212,8 @@ ID:nonexistent_file \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.channels is larger than valid_data -] +pspm_interpolate(valid_data, + options) [options.channels is larger than valid_data] \end_layout \end_inset @@ -18319,7 +19246,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.channels is not numeric] +pspm_interpolate(valid_data, + options) [options.channels is not numeric] \end_layout \end_inset @@ -18352,7 +19280,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.method is invalid] +pspm_interpolate(valid_data, + options) [options.method is invalid] \end_layout \end_inset @@ -18385,7 +19314,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.newfile is invalid] +pspm_interpolate(valid_data, + options) [options.newfile is invalid] \end_layout \end_inset @@ -18418,7 +19348,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.extrapolate is invalid] +pspm_interpolate(valid_data, + options) [options.extrapolate is invalid] \end_layout \end_inset @@ -18451,7 +19382,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.overwrite is invalid] +pspm_interpolate(valid_data, + options) [options.overwrite is invalid] \end_layout \end_inset @@ -18484,7 +19416,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(valid_data, options) [options.replace_channels is invalid] +pspm_interpolate(valid_data, + options) [options.replace_channels is invalid] \end_layout \end_inset @@ -18517,7 +19450,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_interpolate(invalid_data, options) [try to interpolate an events channel] +pspm_interpolate(invalid_data, + options) [try to interpolate an events channel] \end_layout \end_inset @@ -18550,8 +19484,7 @@ ID:invalid_channeltype \begin_layout Plain Layout \family typewriter -pspm_interpolate(invalid_data) [try to interpolate with nan from beginning - and without extrapolation] +pspm_interpolate(invalid_data) [try to interpolate with nan from beginning and without extrapolation] \end_layout \end_inset @@ -18584,8 +19517,8 @@ ID:option_disabled \begin_layout Plain Layout \family typewriter -pspm_interpolate(invalid_data, options) [try to interpolate with nan from - beginning and with extrapolation] +pspm_interpolate(invalid_data, + options) [try to interpolate with nan from beginning and with extrapolation] \end_layout \end_inset @@ -18618,8 +19551,7 @@ ID:out_of_range \begin_layout Plain Layout \family typewriter -pspm_interpolate(invalid_data) [try to interpolate with nan from end and - without extrapolation] +pspm_interpolate(invalid_data) [try to interpolate with nan from end and without extrapolation] \end_layout \end_inset @@ -18652,8 +19584,8 @@ ID:option_disabled \begin_layout Plain Layout \family typewriter -pspm_interpolate(invalid_data, options) [try to interpolate with nan from - end and with extrapolation] +pspm_interpolate(invalid_data, + options) [try to interpolate with nan from end and with extrapolation] \end_layout \end_inset @@ -18688,7 +19620,10 @@ Function name \begin_layout Standard \family typewriter -test_datatypes(this, datatype, amount, chans) +test_datatypes(this, + datatype, + amount, + chans) \end_layout \begin_layout Subparagraph @@ -18696,7 +19631,9 @@ Description \end_layout \begin_layout Standard -Tries to interpolate with different datatypes, amount of data, channels. +Tries to interpolate with different datatypes, + amount of data, + channels. \end_layout \begin_layout Subparagraph @@ -18704,7 +19641,11 @@ Steps \end_layout \begin_layout Enumerate -Generate data with datatype, amount, `center', chans, false +Generate data with datatype, + amount, + `center', + chans, + false \end_layout \begin_layout Enumerate @@ -18748,7 +19689,10 @@ Function name \begin_layout Standard \family typewriter -test_interpolation_variations(this, interp_method, extrap, nan_method) +test_interpolation_variations(this, + interp_method, + extrap, + nan_method) \end_layout \begin_layout Subparagraph @@ -18756,8 +19700,7 @@ Description \end_layout \begin_layout Standard -Tries to interpolate with different interpolation methods while varying - +Tries to interpolate with different interpolation methods while varying \family typewriter options.extrapolate \family default @@ -18775,7 +19718,12 @@ Tests \begin_layout Enumerate Generate data with \family typewriter -`inline', 1, nan_method, {{`scr'}, []}, extrap +`inline', + 1, + nan_method, + {{`scr'}, + []}, + extrap \end_layout \begin_layout Enumerate @@ -18922,7 +19870,8 @@ Function name \begin_layout Standard \family typewriter -test_write(this, newfile) +test_write(this, + newfile) \end_layout \begin_layout Subparagraph @@ -18930,8 +19879,7 @@ Description \end_layout \begin_layout Standard -Vary the option newfile and test whether new file is created correctly or - data is correctly added to a new channel. +Vary the option newfile and test whether new file is created correctly or data is correctly added to a new channel. \end_layout \begin_layout Subparagraph @@ -18943,19 +19891,26 @@ Generate data with \family typewriter `file' \family default -, +, + \family typewriter 2 \family default -, +, + \family typewriter `center' \family default -, +, + \family typewriter -{{`scr', `scr', `scr'}, [1,3]} +{{`scr', + `scr', + `scr'}, + [1,3]} \family default -, +, + \family typewriter false \end_layout @@ -19041,7 +19996,8 @@ Function name \begin_layout Standard \family typewriter -test_overwrite(this, overwrite) +test_overwrite(this, + overwrite) \end_layout \begin_layout Subparagraph @@ -19061,19 +20017,26 @@ Generate data with \family typewriter `file' \family default -, +, + \family typewriter 2 \family default -, +, + \family typewriter `center' \family default -, +, + \family typewriter -{{`scr', `scr', `scr'}, [1,2,3]} +{{`scr', + `scr', + `scr'}, + [1,2,3]} \family default -, +, + \family typewriter false \end_layout @@ -19107,7 +20070,8 @@ Function name \begin_layout Standard \family typewriter -test_replace_channel(this, replace_channels) +test_replace_channel(this, + replace_channels) \end_layout \begin_layout Subparagraph @@ -19131,19 +20095,26 @@ Generate data with \family typewriter `file' \family default -, +, + \family typewriter 2 \family default -, +, + \family typewriter `center' \family default -, +, + \family typewriter -{{`scr', `scr', `scr'}, [1,2,3]} +{{`scr', + `scr', + `scr'}, + [1,2,3]} \family default -, false +, + false \end_layout \begin_layout Enumerate @@ -19181,8 +20152,7 @@ According to \family typewriter replace_channel \family default - test whether returned channel ids correspond to replaced channels or correspond - to added channels. + test whether returned channel ids correspond to replaced channels or correspond to added channels. \end_layout \begin_layout Subsubsection @@ -19194,12 +20164,10 @@ Generate data \end_layout \begin_layout Standard -Has all of the Test parameters as parameter implemented and accordingly - generates the data. +Has all of the Test parameters as parameter implemented and accordingly generates the data. It calls put nan to insert NaN values into the data. The generated data is returned as data to the calling function. - Also all return values are stored in the property testdata (for cleanup - data). + Also all return values are stored in the property testdata (for cleanup data). \end_layout \begin_layout Subsubsection* @@ -19207,8 +20175,7 @@ Cleanup data \end_layout \begin_layout Standard -Sits in MethodTeardown and is called once the test class has finished all - tests. +Sits in MethodTeardown and is called once the test class has finished all tests. It then removes all the datafiles which can be found in the property `testdata'. \end_layout @@ -19219,9 +20186,9 @@ Verify NaN free \begin_layout Standard Helper function to verify whether the data is NaN free or not. It copes with two states. - Either a channel should have been interpolated, then it shouldn't contain - any NaN values or a channel should not have been interpolated, then the - channel should still contain NaN values. + Either a channel should have been interpolated, + then it shouldn't contain any NaN values or a channel should not have been interpolated, + then the channel should still contain NaN values. \end_layout \begin_layout Subsection @@ -19249,7 +20216,12 @@ Function \begin_layout Standard \family typewriter -[sts, data, mdltype] = pspm_load1(fn, action, savedata, options) +[sts, + data, + mdltype] = pspm_load1(fn, + action, + savedata, + options) \end_layout \begin_layout Subsubsection @@ -19266,8 +20238,7 @@ fn pspm_load1_test.generate_testdata(this) \family default . - The function is part of the test object and generates models for all of - the available model types (defined in + The function is part of the test object and generates models for all of the available model types (defined in \family typewriter settings.first \family default @@ -19277,7 +20248,8 @@ settings.first pspm_testdata_gen \family default . - Two files belong to each model: + Two files belong to each model: + \family typewriter model_.mat (fn) \family default @@ -19286,9 +20258,9 @@ model_.mat (fn) dummy_.mat (dfn) \family default . - The model file on the one hand is the actual model file while on the other - hand, the dummy file is a copy of the model file, used by the test to manipulat -e the test data. + The model file on the one hand is the actual model file while on the other hand, + the dummy file is a copy of the model file, + used by the test to manipulate the test data. \end_layout \begin_layout Paragraph @@ -19328,7 +20300,16 @@ model.timing{1}.names = {`a';'b';'c'}; \begin_layout Standard \family typewriter -model.timing{1}.onsets = {[10, 20, 30], [15, 25, 35], [18, 28, 38]}; +model.timing{1}.onsets = {[10, + 20, + 30], + [15, + 25, + 35], + [18, + 28, + 38]}; + \end_layout \begin_layout Paragraph @@ -19338,7 +20319,9 @@ Generated DCM & SF model \begin_layout Standard \family typewriter -model.timing{1} = [10,20; 23,38; 40,70;]; +model.timing{1} = [10,20; + 23,38; + 40,70;]; \end_layout \begin_layout Standard @@ -19376,7 +20359,8 @@ Description \end_layout \begin_layout Standard -Tries to pass invalid data structures, and tests for certain warnings. +Tries to pass invalid data structures, + and tests for certain warnings. Applys to all available modeltypes. \end_layout @@ -19582,7 +20566,8 @@ Description \end_layout \begin_layout Standard -Tries to pass invalid data structures, and tests for certain warnings. +Tries to pass invalid data structures, + and tests for certain warnings. Model specific. \end_layout @@ -19899,7 +20884,10 @@ Expected warning \begin_layout Plain Layout \family typewriter -options.zscored = 1 & pspm_load1(dfn, `none', {}, options) +options.zscored = 1 & pspm_load1(dfn, + `none', + {}, + options) \end_layout \end_inset @@ -19923,7 +20911,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -options.zscored = 1 & pspm_load1(dfn, `cond', {}, options) +options.zscored = 1 & pspm_load1(dfn, + `cond', + {}, + options) \end_layout \end_inset @@ -19947,7 +20938,10 @@ options.zscored = 1 & pspm_load1(dfn, `cond', {}, options) \begin_layout Plain Layout \family typewriter -options.zscored = 1 & pspm_load1(dfn, `stats', {}, options) +options.zscored = 1 & pspm_load1(dfn, + `stats', + {}, + options) \end_layout \end_inset @@ -20016,7 +21010,10 @@ Expected warning \begin_layout Plain Layout \family typewriter -options.zscored = 1 & pspm_load1(dfn, `cond', {}, options) +options.zscored = 1 & pspm_load1(dfn, + `cond', + {}, + options) \end_layout \end_inset @@ -20280,7 +21277,8 @@ Test for all modeltypes if action `savecon' \family default matches the expected behaviour. - Generates a number, passes it within the + Generates a number, + passes it within the \family typewriter `savecon' \family default @@ -20483,8 +21481,7 @@ Description \end_layout \begin_layout Standard -Test for all modeltypes if options passed with options structure cause the - expected behaviour. +Test for all modeltypes if options passed with options structure cause the expected behaviour. Does also work with a randomly generated number in \family typewriter .test @@ -20590,7 +21587,8 @@ Returned data is different when callng with \family typewriter zscroed = 1 & action = `cond' \family default - (should not zscore, when not specified) + (should not zscore, + when not specified) \end_layout \end_deeper @@ -20656,7 +21654,11 @@ Function \begin_layout Standard \family typewriter -[sts, infos, data, filestruct] = pspm_load_data(fn, chan) +[sts, + infos, + data, + filestruct] = pspm_load_data(fn, + chan) \end_layout \begin_layout Subsubsection @@ -20664,8 +21666,8 @@ Setup \end_layout \begin_layout Standard -If not otherwise declared, the input variable fn is referring to a datafile - which was generated with +If not otherwise declared, + the input variable fn is referring to a datafile which was generated with \family typewriter pspm_testdata_gen \family default @@ -20699,7 +21701,8 @@ data{4}.chantype `hb'; \begin_layout Description \family typewriter -data{5}.chantype `marker'; +data{5}.chantype `marker'; + \end_layout \begin_layout Description @@ -20746,7 +21749,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -20910,7 +21914,8 @@ Negative channel number \begin_layout Plain Layout \family typewriter -fn, -1 +fn, + -1 \end_layout \end_inset @@ -20952,7 +21957,8 @@ No allowed ch type \begin_layout Plain Layout \family typewriter -fn, `foobar' +fn, + `foobar' \end_layout \end_inset @@ -20994,7 +22000,8 @@ Missing field in foo struct \begin_layout Plain Layout \family typewriter -fn, foo +fn, + foo \end_layout \end_inset @@ -21036,7 +22043,8 @@ Invalid channel option \begin_layout Plain Layout \family typewriter -fn, {1} +fn, + {1} \end_layout \end_inset @@ -21120,7 +22128,8 @@ Nonexisting channel \begin_layout Plain Layout \family typewriter -fn, 250 +fn, + 250 \end_layout \end_inset @@ -21163,7 +22172,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the datafile is invalid. +Checks for warnings, + if the datafile is invalid. \end_layout \begin_layout Subparagraph @@ -21686,7 +22696,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if all channels shall be returned ( +Checks the function, + if all channels shall be returned ( \family typewriter chan = 0 \family default @@ -21713,7 +22724,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if all channels shall be returned ( +Checks the function, + if all channels shall be returned ( \family typewriter chan = 0 \family default @@ -21740,7 +22752,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if only one channel shall be returned ( +Checks the function, + if only one channel shall be returned ( \family typewriter chan = 2 \family default @@ -21767,7 +22780,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if multiple channels shall be returned ( +Checks the function, + if multiple channels shall be returned ( \family typewriter chan = [3 5] \family default @@ -21794,7 +22808,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if only the scr channels shall be returned. +Checks the function, + if only the scr channels shall be returned. \end_layout @@ -21817,7 +22832,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if only the event channels shall be returned. +Checks the function, + if only the event channels shall be returned. \end_layout @@ -21840,7 +22856,8 @@ Description \end_layout \begin_layout Standard -Checks the function, if data is to be saved ( +Checks the function, + if data is to be saved ( \family typewriter chan struct \family default @@ -21873,11 +22890,17 @@ Format \begin_layout Standard \family typewriter -newfile = pspm_pp(`median', datafile, n, channelnumber) +newfile = pspm_pp(`median', + datafile, + n, + channelnumber) \family default or \family typewriter -newfile = pspm_pp(`butter', datafile, freq, channelnumber) +newfile = pspm_pp(`butter', + datafile, + freq, + channelnumber) \end_layout \begin_layout Subsubsection @@ -21903,7 +22926,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -21995,7 +23019,8 @@ No frequency \begin_layout Plain Layout \family typewriter -`butter', `file' +`butter', + `file' \end_layout \end_inset @@ -22037,7 +23062,9 @@ No valid first argument \begin_layout Plain Layout \family typewriter -`foo', `file', 100 +`foo', + `file', + 100 \end_layout \end_inset @@ -22081,7 +23108,9 @@ Freq below \begin_layout Plain Layout \family typewriter -`butter', `file', 19 +`butter', + `file', + 19 \end_layout \end_inset @@ -22140,11 +23169,13 @@ Testfile with \family typewriter scr \family default -, +, + \family typewriter hb \family default -, +, + \family typewriter scr \family default @@ -22158,7 +23189,11 @@ Tests \begin_layout Enumerate Filter one channel \family typewriter -[Input: newfile = pspm_pp(`median', testfile, 50, 3)] +[Input: + newfile = pspm_pp(`median', + testfile, + 50, + 3)] \end_layout \begin_deeper @@ -22168,7 +23203,8 @@ i. \family typewriter sts == 1 \family default -, when data is loaded with +, + when data is loaded with \family typewriter pspm_load_data \family default @@ -22185,7 +23221,10 @@ ii. \begin_layout Enumerate Filter multiple channel \family typewriter -[Input: newfile = pspm_pp(`median', testfile, 50)] +[Input: + newfile = pspm_pp(`median', + testfile, + 50)] \end_layout \begin_deeper @@ -22195,7 +23234,8 @@ i. \family typewriter sts == 1 \family default -, when data is loaded with +, + when data is loaded with \family typewriter pspm_load_data \family default @@ -22240,11 +23280,13 @@ Testfile with 3 channels ( \family typewriter scr \family default -, +, + \family typewriter hb \family default -, +, + \family typewriter scr \family default @@ -22258,7 +23300,11 @@ Tests \begin_layout Enumerate Filter one channel \family typewriter -[Input: newfile = pspm_pp(`butter', testfile, 40, 3)] +[Input: + newfile = pspm_pp(`butter', + testfile, + 40, + 3)] \end_layout \begin_deeper @@ -22267,6 +23313,7 @@ i. Check if \family typewriter sts == 1, + \family default when data is loaded with \family typewriter @@ -22285,7 +23332,10 @@ ii. \begin_layout Enumerate Filter multiple channel \family typewriter -[Input: newfile = pspm_pp(`butter', testfile, 40)] +[Input: + newfile = pspm_pp(`butter', + testfile, + 40)] \end_layout \begin_deeper @@ -22295,7 +23345,8 @@ i. \family typewriter sts == 1 \family default -, when data is loaded with +, + when data is loaded with \family typewriter pspm_load_data \family default @@ -22334,7 +23385,10 @@ Function \begin_layout Standard \family typewriter -[sts, outdata, newsr] = pspm_prepdata(data, filt) +[sts, + outdata, + newsr] = pspm_prepdata(data, + filt) \family default \end_layout @@ -22362,7 +23416,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -22403,7 +23458,8 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_prepdata([1 NaN 3], filt) [NaN values in data] +pspm_prepdata([1 NaN 3], + filt) [NaN values in data] \end_layout \end_inset @@ -22451,7 +23507,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_prepdata(data, filt) [filt has no hporder field] +pspm_prepdata(data, + filt) [filt has no hporder field] \end_layout \end_inset @@ -22475,7 +23532,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_prepdata(`foo', filt) [no numeric data] +pspm_prepdata(`foo', + filt) [no numeric data] \end_layout \end_inset @@ -22499,7 +23557,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_prepdata(data, filt) [with lpfreq = `foo' (not valid)] +pspm_prepdata(data, + filt) [with lpfreq = `foo' (not valid)] \end_layout \end_inset @@ -22800,7 +23859,9 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_prepdata(data, filt) [filt.sr = 100; filt.lpfreq = 60] +pspm_prepdata(data, + filt) [filt.sr = 100; + filt.lpfreq = 60] \end_layout \end_inset @@ -22918,8 +23979,8 @@ Description \end_layout \begin_layout Standard -Checks downsampling functionality, if the ratio between filt.sr and filt.down - is an integer. +Checks downsampling functionality, + if the ratio between filt.sr and filt.down is an integer. \end_layout \begin_layout Subparagraph @@ -23037,7 +24098,10 @@ Function \begin_layout Standard \family typewriter -[sts, out] = pspm_process_illuminance(ldata, sr, options) +[sts, + out] = pspm_process_illuminance(ldata, + sr, + options) \end_layout \begin_layout Subsubsection @@ -23046,8 +24110,8 @@ Setup \begin_layout Standard This test class is parameterised. - The test data is generated by the function itself and when needed, files - will be written to + The test data is generated by the function itself and when needed, + files will be written to \family typewriter datafile.mat \family default @@ -23059,8 +24123,7 @@ Test parameters \end_layout \begin_layout Standard -These are parameters which define what kind of data should be passed to - +These are parameters which define what kind of data should be passed to \family typewriter pspm_process_illuminance \family default @@ -23178,8 +24241,8 @@ mode \uwave off \noun off \color none - Defines the whether the dataset should be written to a file, kept as inline - variable or should be a mix of both. + Defines the whether the dataset should be written to a file, + kept as inline variable or should be a mix of both. Can be either \family typewriter \series default @@ -23206,7 +24269,8 @@ mode \uwave off \noun off \color none -, +, + \family typewriter \series default \shape default @@ -23292,7 +24356,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -23462,7 +24527,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance(1:10, `a') [invalid ssamplerate] +pspm_process_illuminance(1:10, + `a') [invalid ssamplerate] \end_layout \end_inset @@ -23495,7 +24561,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, 1) [cell, no cell] +pspm_process_illuminance({1:10}, + 1) [cell, + no cell] \end_layout \end_inset @@ -23528,7 +24596,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance(1:10, {1}) [no cell, cell] +pspm_process_illuminance(1:10, + {1}) [no cell, + cell] \end_layout \end_inset @@ -23561,7 +24631,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10, 10:10}, {1}) [different sized cells] +pspm_process_illuminance({1:10, + 10:10}, + {1}) [different sized cells] \end_layout \end_inset @@ -23594,7 +24666,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10, `a'},{1,2}) [invalid file] +pspm_process_illuminance({1:10, + `a'},{1,2}) [invalid file] \end_layout \end_inset @@ -23627,7 +24700,10 @@ ID:non_existent_file \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10, 1:10}, {1, `a'}) [invalid samplerate] +pspm_process_illuminance({1:10, + 1:10}, + {1, + `a'}) [invalid samplerate] \end_layout \end_inset @@ -23660,7 +24736,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, `o') [wrong options] +pspm_process_illuminance({1:10}, + {1}, + `o') [wrong options] \end_layout \end_inset @@ -23693,7 +24771,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[wrong transfer settings] +pspm_process_illuminance({1:10}, + {1}, + opt)[wrong transfer settings] \end_layout \end_inset @@ -23726,7 +24806,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[wrong duration] +pspm_process_illuminance({1:10}, + {1}, + opt)[wrong duration] \end_layout \end_inset @@ -23759,7 +24841,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[wrong offset] +pspm_process_illuminance({1:10}, + {1}, + opt)[wrong offset] \end_layout \end_inset @@ -23792,7 +24876,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[wrong outputfile] +pspm_process_illuminance({1:10}, + {1}, + opt)[wrong outputfile] \end_layout \end_inset @@ -23825,7 +24911,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[format of ldata and opt.fn differs] +pspm_process_illuminance({1:10}, + {1}, + opt)[format of ldata and opt.fn differs] \end_layout \end_inset @@ -23858,7 +24946,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_process_illuminance({1:10}, {1}, opt)[opt.overwrite is not boolean] +pspm_process_illuminance({1:10}, + {1}, + opt)[opt.overwrite is not boolean] \end_layout \end_inset @@ -23893,7 +24983,11 @@ Function name \begin_layout Standard \family typewriter -test_options(this, sr, dur, bf_dur, bf_offset) +test_options(this, + sr, + dur, + bf_dur, + bf_offset) \end_layout \begin_layout Subparagraph @@ -23901,8 +24995,7 @@ Description \end_layout \begin_layout Standard -Tries out different combination options to process the generated illuminance - data. +Tries out different combination options to process the generated illuminance data. \end_layout \begin_layout Subparagraph @@ -23984,7 +25077,9 @@ Function name \begin_layout Standard \family typewriter -test_multi(this, n_times, mode) +test_multi(this, + n_times, + mode) \end_layout \begin_layout Subparagraph @@ -24012,11 +25107,13 @@ Generate data with \family typewriter sr \family default -), 100 ( +), + 100 ( \family typewriter dur \family default -), +), + \family typewriter n_times \family default @@ -24024,7 +25121,8 @@ n_times \family typewriter amount \family default -), mode +), + mode \end_layout \begin_layout Enumerate @@ -24046,7 +25144,8 @@ For \family typewriter n_times == 1 \family default -, test if out has +, + test if out has \family typewriter 10×100 \family default @@ -24062,7 +25161,8 @@ n_times ~= 1 \family default -, test if output has same size as input +, + test if output has same size as input \end_layout \begin_layout Paragraph @@ -24076,7 +25176,8 @@ Function name \begin_layout Standard \family typewriter -test_overwrite(this, overwrite) +test_overwrite(this, + overwrite) \end_layout \begin_layout Subparagraph @@ -24100,7 +25201,8 @@ Generate data with \family typewriter sr \family default -), +), + \family typewriter 100 \family default @@ -24108,7 +25210,8 @@ sr \family typewriter dur \family default -), +), + \family typewriter 1 \family default @@ -24116,7 +25219,8 @@ dur \family typewriter amount \family default -), +), + \family typewriter `file' \end_layout @@ -24148,14 +25252,12 @@ Generate lx \end_layout \begin_layout Standard -Has some of the Test parameters as parameter implemented and accordingly - generates the +Has some of the Test parameters as parameter implemented and accordingly generates the \family typewriter lx \family default data. - According to the calling arguments the output is a cell of files and data - vectors. + According to the calling arguments the output is a cell of files and data vectors. All generated files will be stored in the property \family typewriter `datafiles' @@ -24169,8 +25271,7 @@ Cleanup \end_layout \begin_layout Standard -Located in MethodTeardown and is called once the test class has finished - all tests. +Located in MethodTeardown and is called once the test class has finished all tests. It then removes all the datafiles which can be found in the property \family typewriter `datafiles' @@ -24203,7 +25304,10 @@ Function \begin_layout Standard \family typewriter -[sts, wavedata] = pspm_pulse_convert(pulsedata, resamplingrate, samplingrate) +[sts, + wavedata] = pspm_pulse_convert(pulsedata, + resamplingrate, + samplingrate) \end_layout \begin_layout Subsubsection @@ -24327,7 +25431,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_pulse_convert(10^-3 * (1:10000)', 10000) +pspm_pulse_convert(10^-3 * (1:10000)', + 10000) \end_layout \end_inset @@ -24370,7 +25475,8 @@ Description \end_layout \begin_layout Standard -Pass generated, valid data and test if function issues no warning. +Pass generated, + valid data and test if function issues no warning. \end_layout \begin_layout Subparagraph @@ -24410,7 +25516,8 @@ Function \begin_layout Standard \family typewriter -out_newfilename = pspm_ren(filename, newfilename) +out_newfilename = pspm_ren(filename, + newfilename) \end_layout \begin_layout Subsubsection @@ -24436,7 +25543,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -24510,7 +25618,11 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_ren({`fn1', `fn2'}, {`rfn1', `rfn2', `rfn3'}) [non same size cell arrays] +pspm_ren({`fn1', + `fn2'}, + {`rfn1', + `rfn2', + `rfn3'}) [non same size cell arrays] \end_layout \end_inset @@ -24668,7 +25780,10 @@ Function \begin_layout Standard \family typewriter -sts = pspm_resp_pp(fn, sr, chan, options) +sts = pspm_resp_pp(fn, + sr, + chan, + options) \end_layout \begin_layout Subsubsection @@ -24694,14 +25809,13 @@ Description \end_layout \begin_layout Standard -In r660, there was a bug found in +In r660, + there was a bug found in \family typewriter pspm_resp_pp \family default - that caused it to crash with index out of bounds error on inputs containing - some edgecase. - This test specifically checks whether the fixed version returns the same - results as the version before the bugfix on data that didn't cause a crash. + that caused it to crash with index out of bounds error on inputs containing some edgecase. + This test specifically checks whether the fixed version returns the same results as the version before the bugfix on data that didn't cause a crash. \end_layout \begin_layout Subparagraph @@ -24785,7 +25899,9 @@ Format \begin_layout Standard \family typewriter -newdatafile = pspm_split_sessions(datafile, markerchannel, options) +newdatafile = pspm_split_sessions(datafile, + markerchannel, + options) \end_layout \begin_layout Subsubsection @@ -24818,8 +25934,10 @@ MAXSN==10 \family typewriter BRK2NORM==3 \family default - (default values), the datafiles should be split into 3 files. - If different values are being used, update the property + (default values), + the datafiles should be split into 3 files. + If different values are being used, + update the property \family typewriter ‘expected_number_of_files' \family default @@ -24850,7 +25968,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -24948,7 +26067,8 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_split_sessions (‘fn', ‘foo') [no numeric marker channel no.] +pspm_split_sessions (‘fn', + ‘foo') [no numeric marker channel no.] \end_layout \end_inset @@ -25016,7 +26136,8 @@ Check if \family typewriter sts == 1 \family default -, when data is loaded with +, + when data is loaded with \family typewriter pspm_load_data \family default @@ -25089,8 +26210,7 @@ For both datafiles the same tests as in the one_datafile \family default function are performed individually. - Additionally it is tested if the number of input files does match the number - of output files. + Additionally it is tested if the number of input files does match the number of output files. \end_layout @@ -25123,7 +26243,11 @@ Function \begin_layout Standard \family typewriter -newdatafile = pspm_trim(datafile, from, to, reference, options) +newdatafile = pspm_trim(datafile, + from, + to, + reference, + options) \end_layout \begin_layout Subsubsection @@ -25131,8 +26255,8 @@ Setup \end_layout \begin_layout Standard -If not otherwise declared, the input variable fn is referring to a datafile - which was generated with +If not otherwise declared, + the input variable fn is referring to a datafile which was generated with \family typewriter pspm_testdata_gen \family default @@ -25213,7 +26337,8 @@ Description \end_layout \begin_layout Standard -Checks for warnings, if the input arguments are invalid. +Checks for warnings, + if the input arguments are invalid. \end_layout \begin_layout Subparagraph @@ -25263,7 +26388,10 @@ Expected warning \begin_layout Plain Layout \family typewriter -pspm_trim(testCase.fn, [1 2], 5, `marker') [invalid from parameter] +pspm_trim(testCase.fn, + [1 2], + 5, + `marker') [invalid from parameter] \end_layout \end_inset @@ -25287,7 +26415,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(testCase.fn, 0, `bla', `marker') [invalid to parameter] +pspm_trim(testCase.fn, + 0, + `bla', + `marker') [invalid to parameter] \end_layout \end_inset @@ -25311,7 +26442,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(testCase.fn, 0, `[]', `marker') [invalid to parameter] +pspm_trim(testCase.fn, + 0, + `[]', + `marker') [invalid to parameter] \end_layout \end_inset @@ -25335,7 +26469,9 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(fn, 0, 5) [no reference] +pspm_trim(fn, + 0, + 5) [no reference] \end_layout \end_inset @@ -25359,7 +26495,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(fn, 0, 5, 6) [no char or 2-element numeric reference] +pspm_trim(fn, + 0, + 5, + 6) [no char or 2-element numeric reference] \end_layout \end_inset @@ -25383,7 +26522,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(fn, 0, 5, ‘bla') [invalid char reference] +pspm_trim(fn, + 0, + 5, + ‘bla') [invalid char reference] \end_layout \end_inset @@ -25407,7 +26549,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(fn, 0, 5, [-1 5]) [invalid numeric start reference] +pspm_trim(fn, + 0, + 5, + [-1 5]) [invalid numeric start reference] \end_layout \end_inset @@ -25431,7 +26576,10 @@ ID:invalid_input \begin_layout Plain Layout \family typewriter -pspm_trim(fn, 0, 5, [5 4]) [invalid numeric start/end reference] +pspm_trim(fn, + 0, + 5, + [5 4]) [invalid numeric start/end reference] \end_layout \end_inset @@ -25490,7 +26638,8 @@ reference = `marker' \family typewriter markertest_k \family default -, where the testcases are defined. +, + where the testcases are defined. \end_layout @@ -25526,7 +26675,8 @@ Expected warning \begin_layout Itemize \family typewriter -ID: marker_out_of_range +ID: + marker_out_of_range \end_layout \end_deeper @@ -25540,7 +26690,10 @@ Input \begin_layout Itemize \family typewriter -pspm_trim(fn, -20, 20, `marker') +pspm_trim(fn, + -20, + 20, + `marker') \end_layout \end_deeper @@ -25558,7 +26711,8 @@ Description \begin_layout Itemize from and to are set so that the trimming points are exactly \family typewriter -(0, duration) +(0, + duration) \family default . Hence the data should not be trimmed. @@ -25587,7 +26741,10 @@ to duration - marker(end) \begin_layout Itemize then \family typewriter -pspm_trim(fn, from, to, `marker') +pspm_trim(fn, + from, + to, + `marker') \end_layout \end_deeper @@ -25617,7 +26774,10 @@ Input \begin_layout Itemize \family typewriter -pspm_trim(fn, 1, -2, `marker') +pspm_trim(fn, + 1, + -2, + `marker') \end_layout \end_deeper @@ -25656,7 +26816,8 @@ reference = ‘file' \family typewriter filetest_k \family default -, where the testcases are defined. +, + where the testcases are defined. \end_layout @@ -25700,7 +26861,8 @@ Expected warning \begin_layout Itemize \family typewriter -ID: marker_out_of_range +ID: + marker_out_of_range \end_layout \end_deeper @@ -25714,7 +26876,10 @@ Input \begin_layout Itemize \family typewriter -pspm_trim(fn, -12.5, 50, `marker') +pspm_trim(fn, + -12.5, + 50, + `marker') \end_layout \end_deeper @@ -25740,7 +26905,8 @@ to \family default are set so that the trimming points are exactly \family typewriter -(0, duration) +(0, + duration) \family default . Hence the data should not be trimmed. @@ -25757,7 +26923,10 @@ Input \begin_layout Itemize \family typewriter -pspm_trim(fn, 0 , duration, `marker') +pspm_trim(fn, + 0 , + duration, + `marker') \end_layout \end_deeper @@ -25783,7 +26952,8 @@ to \family default are set so that the trimming points in the range \family typewriter -[0, duration] +[0, + duration] \family default . \end_layout @@ -25799,7 +26969,9 @@ Input \begin_layout Itemize \family typewriter -pspm_trim(fn,2.1, duration – 2.5, `marker') +pspm_trim(fn,2.1, + duration – 2.5, + `marker') \end_layout \end_deeper @@ -25835,7 +27007,8 @@ reference = [a b] \family default ( \family typewriter -a, b +a, + b \family default are two integers with \family typewriter @@ -25846,7 +27019,8 @@ a +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Standard +To insert a hyperlink to a website, + please use the following sentence. +\end_layout + +\begin_layout Standard +\begin_inset listings +inline false +status open + +\begin_layout Plain Layout + +[retrodictive validity](https://doi.org/10.1038/s41562-020-00976-8) +\end_layout + +\end_inset + + +\end_layout + +\begin_layout Subsubsection +Table of content generation +\end_layout + +\begin_layout Standard +Please use the file +\begin_inset Quotes eld +\end_inset + +toc-date.html +\begin_inset Quotes erd +\end_inset + + to control the generation of table of content. + Currently, + please go to line 69–70, + where the list of items shown in the table of content is listed here. + Items will not be displayed unless they are specified here, + thus please always keep this file updated. +\end_layout + +\begin_layout Standard +\begin_inset Graphics + filename /Users/teddy/Desktop/Screenshot 2025-02-07 at 03.32.35.png + width 95text% + +\end_inset + + \end_layout \begin_layout Section diff --git a/doc/PsPM_Developers_Guide.pdf b/doc/PsPM_Developers_Guide.pdf index ce37d76a4..617a42ceb 100644 Binary files a/doc/PsPM_Developers_Guide.pdf and b/doc/PsPM_Developers_Guide.pdf differ diff --git a/doc/PsPM_Manual.lyx b/doc/PsPM_Manual.lyx index 157c42b2d..f448dd2c5 100644 --- a/doc/PsPM_Manual.lyx +++ b/doc/PsPM_Manual.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 620 \begin_document \begin_header \save_transient_properties true @@ -27,11 +27,11 @@ eqs-within-sections figs-within-sections customHeadersFooters \end_modules -\maintain_unincluded_children false +\maintain_unincluded_children no \language english \language_package default -\inputencoding auto -\fontencoding global +\inputencoding auto-legacy +\fontencoding auto \font_roman "default" "default" \font_sans "default" "default" \font_typewriter "default" "default" @@ -39,7 +39,9 @@ customHeadersFooters \font_default_family default \use_non_tex_fonts false \font_sc false -\font_osf false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false @@ -73,7 +75,9 @@ customHeadersFooters \suppress_date false \justification true \use_refstyle 1 +\use_formatted_ref 0 \use_minted 0 +\use_lineno 0 \index Index \shortcut idx \color #008000 @@ -89,23 +93,29 @@ customHeadersFooters \papercolumns 1 \papersides 1 \paperpagestyle headings +\tablestyle default \listings_params "language=Matlab,float=hbp,basicstyle={\footnotesize\ttfamily},identifierstyle={\color{colIdentifier}},keywordstyle={\color{colKeys}},stringstyle={\color{colString}},commentstyle={\itshape\color{colComments}},columns=fixed,tabsize=2,extendedchars=true,showspaces=false,showstringspaces=false,captionpos=t,backgroundcolor={\color{white}},framexleftmargin=1pt,frame=l" \tracking_changes false \output_changes false +\change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 \end_header \begin_body \begin_layout Title -PsPM: Psychophysiological Modelling +PsPM: + Psychophysiological Modelling \end_layout \begin_layout Standard \align center -Version 6.1.2 +Version 7.0 \end_layout \begin_layout Standard @@ -123,12 +133,19 @@ status open \begin_layout Plain Layout \noindent -If you have comments on or error corrections to this documentation, please - send them to the PsPM team or post them on: +If you have comments on or error corrections to this documentation, + please send them to the PsPM team, + +\family typewriter +pspm@bachlab.org +\family default +, + or post them on: + \begin_inset CommandInset href LatexCommand href -name "bachlab.org/pspm" -target "http://bachlab.org/pspm" +name "Github" +target "https://github.com/bachlab/PsPM/discussions" literal "false" \end_inset @@ -145,10 +162,23 @@ literal "false" \begin_layout Standard \align center -Dominik R Bach, Giuseppe Castegnetti, Laure Ciernik, Samuel Gerster, Saurabh - Khemka, Christoph Korn, Samuel Maxwell, Tobias Moser, Philipp C Paulus, - Ivan Rojkov, Matthias Staib, Yanfang Xia, Eshref Yozdemir, Teddy Zhao and - collaborators +Dominik R Bach, + Giuseppe Castegnetti, + Laure Ciernik, + Samuel Gerster, + Uzay Gökay, + Saurabh Khemka, + Christoph Korn, + Samuel Maxwell, + Tobias Moser, + Philipp C Paulus, + Ivan Rojkov, + Matthias Staib, + Bernhard Agoué von Raußendorf, + Yanfang Xia, + Eshref Yozdemir, + Teddy Zhao, + and collaborators \end_layout \begin_layout Standard @@ -186,26 +216,25 @@ The psychophysiological inverse problem \begin_layout Standard Psychophysiology is concerned with the relationship between the mind (i.e. - psychological processes) and the body (including the nervous). - This relationship is bidirectional: the mind influences the body, but processes - in the body are monitored by the mind via proprioception and interoception. - Knowledge on this bidirectional relationship affords for instance examining - more closely how psychological factors influence health, or how the interceptiv -e abilities of an individual affect his psychological well-being. + psychological processes) and the body (including the nervous system). + This relationship is bidirectional: + the mind influences the body, + and the body is monitored by the mind via proprioception and interoception. \end_layout \begin_layout Standard -However, a very common application of psychophysiological knowledge is to - measure processes in the body (sweating, heart activity, respiration, etc.) - to assess processes in the mind. +A very common application of psychophysiological knowledge is to evaluate processes in the mind by their influence on the body. + For example, + we may observe skin conductance responses in order to infer a person's fear memory. This is an inverse problem. - The researcher is not actually interested whether skin conductance is different - between two conditions (the forward relation). - They are interested, for example, whether a subject successfully learned - an association between a conditioned stimulus (CS) and an electric shock, - and use skin conductance to measure this learning process. - To make this inverse inference, the + We are not actually interested whether skin conductance is different between a CS+ and a CS- (the forward relation). + We are interested, + in this example, + in whether a person successfully learned the association between a conditioned stimulus (CS) and an electric shock, + and we use skin conductance to tap into this latent variable. + To make this inverse inference, + we \begin_inset Quotes eld \end_inset @@ -213,10 +242,11 @@ turn the forward model around \begin_inset Quotes erd \end_inset - - they ask, what has happened in the mind, given what is measured in the - body. - There are several way of doing this, and all require good knowledge of - the forward relationship. + - we ask, + what has happened in the mind, + given what is measured in the body. + There are several way of doing this, + and all require good knowledge of the forward relation. \end_layout @@ -225,16 +255,9 @@ Operational analysis \end_layout \begin_layout Standard -Operational approaches seek to identify data features ( -\begin_inset Quotes eld -\end_inset - -indices -\begin_inset Quotes erd -\end_inset - -) that closely follow a psychological state of interest. - Operational data analysis algorithms extract these data features, to +Operational approaches leverage data features that closely follow a latent variable of interest. + Operational data analysis algorithms extract these data features, + to \begin_inset Quotes eld \end_inset @@ -242,11 +265,13 @@ index \begin_inset Quotes erd \end_inset - central states. - For example, to infer stimulus-evoked sympathetic arousal (SA) from skin - conductance responses (SCR), one may filter the SCR data to reduce observation - noise, define a response window after the stimulus, and define some criteria - do detect peaks within this window. + latent variables. + For example, + to infer fear memory from skin conductance responses (SCR), + one may filter the SCR data to reduce observation noise, + define a response window after the CS, + define some criteria to detect peaks within this window, + and a scoring algorithm to deal with overlapping SCR. The amplitude of such peaks may then be taken as \begin_inset Quotes eld \end_inset @@ -256,11 +281,9 @@ index \end_inset of SA. - The development of such indices is an important application of psychophysiology. - Such indices are usually based on qualitative or semi-quantitative models - of how the index relates to the psychological state of interest. - Model-based analysis has precisely the same goal as operational analysis - - but seeks to make these implict models explicit (i.e. + The development of these indices is an important application of psychophysiology. + Such indices are usually based on qualitative or semi-quantitative models of how the index relates to the latent variable. + Model-based analysis has precisely the same goal as operational analysis - but seeks to make these implicit models explicit (i.e. testable) in mathematical form - see \begin_inset CommandInset citation LatexCommand cite @@ -277,7 +300,7 @@ literal "false" \end_inset - for a review. + for reviews. \end_layout \begin_layout Subsection @@ -285,16 +308,18 @@ Model-based analysis \end_layout \begin_layout Standard -Model-based approaches start with explicit, mathematical models that formulate - how observed data are generated by psychological processes. - For example, a model may formulate the relation between sympathetic arousal - (SA) and skin conductance responses (SCR), +Model-based approaches start with explicit, + mathematical models that formulate how observed data are generated by psychological processes. + For example, + a model may formulate the relation between fear-conditioned sympathetic arousal (SA) and skin conductance responses (SCR), + \begin_inset Formula $SA\mapsto SCR$ \end_inset -, in mathematical form. - This kind of model is often termed a "forward model": it predicts a data - time series (SCR) from a known psychological process (SA). +, + in mathematical form. + This kind of model is often termed a "forward model": + it predicts a data time series (SCR) from a known psychological process (SA). Another term for this kind of model is \begin_inset Quotes eld \end_inset @@ -303,98 +328,139 @@ generative \begin_inset Quotes erd \end_inset -, because it describes how a psychological process generates the data. - When we analyse experimental data, we are faced with the opposite situation: - we know the observed data data but not the central process, and seek to - infer the central process from the data. - In order to do so, one has to turn the forward model backwards, to arrive - at the relation +, + because it describes how a latent variable generates the data. + When we analyse experimental data, + we are faced with the opposite situation: + we know the observed data data but not the latent variable, + and seek to infer the latent variable from the data. + In order to do so, + we have to turn the forward model backwards, + to arrive at the relation \begin_inset Formula $SA\mapsfrom SCR$ \end_inset . - In statistics, this process is often termed "model inversion". - It provides the most likely estimates of the central process, given the - observed data and the model. - Both conventional and model-based analysis aim to infer central process - from observed data. - The difference is that model-based methods use a stringent mathematical - language and probabilistic model inversion to do so. - Note that probabilistic models acknowledge the existence of noise in the - data, and they do not seek to explain this noise with variation in psychologica -l states. - Hence, the criterion for the quality of a model-based method is not how - well the model -\begin_inset Quotes eld -\end_inset - -fits the data -\begin_inset Quotes erd -\end_inset - -, but how well it can recover the psychological variables of interest. - In other words, the model should be able to fit the data but at the same - time to ignore noise in the data. + In statistics, + this process is often termed "model inversion". + It provides the most likely estimate of the latent variable, + given the observed data and the model. + \end_layout \begin_layout Section Method comparison \end_layout +\begin_layout Subsection +General +\end_layout + \begin_layout Standard -How can we infer that one method of inferring a central state is better - than another? Each method returns indices or estimates of the psychological - state, but which ones are more precise? Psychological variables cannot - be measured directly, so how can we compare our estimates to ground truth? - The solution we propose is to experimentally create psychological states - that are known. - We can then evaluate how well a method recovers these known states. - In the simple example of fear conditioning, we could compute a paired t-test - on the CS+/CS- difference in the estimates and look at the t-value. - the method that yields the highest t-value is most precise. - But is it also significantly more precise than another method? This can - be assessed with a formal model comparison. - +How can we evaluate whether one method of inferring a latent variable is better than another, + when the true values of the latent variable are unknown? + Classical validity theory provides us with metrics such as reliability or convergent/discriminant validity, + but these require stable between-person variance in the latent variable to be meaningful +\begin_inset CommandInset citation +LatexCommand cite +key "Bach:2024aa" +literal "false" + +\end_inset + +, + a condition which is frequently not met for those latent variables that can be inferred from psychophysiological measurements (such as fear memory). + Furthermore, + convergent validity frequently does not tell us which of a set of somewhat related measurement methods is more or less valid (such as two slightly different SCR scoring methods). \end_layout \begin_layout Standard -In our example, we can try to predict CS identity (CS+/CS-) from the model - estimates. - This means we quantify evidence for a model in which individual participants' - CS+ and CS- estimates are drawn from two distributions with different means, - rather than the same mean. - In other words, we are using a regression model that seeks to predict the - known psychological state (dependent variable) from the estimated psychological - state (independent variable). - Note that this is different from a more convential regression or ANOVA - model in which the data are the dependent variable and experimental conditions - are the independent variable. - This difference is important. - In our approach, when comparing different methods, the dependent variable - (the true state) will be the same, and the independent variable (the state - estimates) will differ. - This means that the total sum of squares (TSS) in the model will be constant. - Thus, we can use the residual sum of squares (RSS) to compute model evidence - and compare models - i.e. - compare evidence for the statement that the method's estimates of the psycholog -ical state predict the true psychological state. - We have termed this +The solution we propose is to experimentally induce known values of the latent variable, + and evaluate how well a method recovers these known states +\begin_inset CommandInset citation +LatexCommand cite +key "Bach:2020aa" +literal "false" + +\end_inset + +. + We term this approach +\begin_inset Quotes erd +\end_inset + +experiment-based calibration +\begin_inset Quotes erd +\end_inset + +, + and the correlation between measured and intended scores \begin_inset Quotes eld \end_inset -predictive validity +retrodictive validity \begin_inset Quotes erd \end_inset + +\begin_inset CommandInset citation +LatexCommand cite +key "Bach:2020ab" +literal "false" + +\end_inset + . - Note that the model is not predictive in time - we are not trying to predict - unknown data values. - We are trying to predict true psychological state from the estimated state. + One can show that measurement methods with higher retrodictive validity have lower measurement error. + Thus, + retrodictive validity is the metric that we seek to maximise with PsPM. +\end_layout + +\begin_layout Standard +In the example of fear conditioning, + we could express retrodictive validity simply as effect size of the CS+/CS- difference in the estimates; + the method with higher effect sizes will have lower measurement error. + Since we are assessing this in finite samples, + a frequent follow-up question is whether one method is +\begin_inset Quotes eld +\end_inset + +decisively +\begin_inset Quotes erd +\end_inset + + more valid than another. + This can be assessed with a formal model comparison. + +\end_layout + +\begin_layout Subsection +Implementation +\end_layout + +\begin_layout Standard +In our example, + we can try to predict CS identity (CS+/CS-) from the model estimates. + This means we quantify evidence for a model in which individual participants' CS+ and CS- estimates are drawn from two distributions with different means, + rather than the same mean. + In other words, + we are using a regression model that seeks to predict the known latent variable (i.e. + the experimental conditions) as dependent variable from the estimated latent variable. + Note that this is different from a more conventional regression or ANOVA model in which the data are the dependent variable and experimental conditions are the independent variable. + This difference is important. + In our approach, + the dependent variable (the true state) will always be the same, + and the independent variable (the estimate of the latent variable) will differ between methods. + This means that the total sum of squares (TSS) in the model will be constant. + Thus, + we can use the residual sum of squares (RSS) to compute model evidence and compare models - i.e. + compare evidence for the statement that the method's estimates of the psychological state predict the true psychological state. + \end_layout \begin_layout Standard -To quantify model evidence, PsPM uses the following approximation to Akaike - Information Criterion (AIC) +To quantify model evidence, + we often use the following approximation to Akaike Information Criterion (AIC) \begin_inset CommandInset citation LatexCommand cite key "Burnham:2004" @@ -421,11 +487,13 @@ where \begin_inset Formula $n$ \end_inset - is the number of data points in the predictive model, + is the number of data points in the predictive model, + \begin_inset Formula $L$ \end_inset - is the maximum of the likelihood function, and + is the maximum of the likelihood function, + and \begin_inset Formula $k$ \end_inset @@ -435,24 +503,25 @@ where \end_inset is constant for all methods that are evaluated in a methods comparison. - We only interpret AIC differences, so this complexity term disappears from - methods comparison. - AIC differences divided by 2 can be interpreted as log Bayes Factors (LBF). - In our case this quantifies the relative evidence that one method's estimates - predict the true psychological state, relative to the other method. + We only interpret AIC differences, + so this complexity term disappears from methods comparison. + AIC differences divided by 2 can be interpreted as approximate log Bayes Factors (LBF). + In our case this quantifies the relative evidence that one method's estimates predict the true latent variable, + relative to the other method. An absolute LBF of greater than 3 is usually regarded as decisive. This is because for a classical significance threshold of \begin_inset Formula $\alpha=.05$ \end_inset -, the probability of the data given the null hypothesis is +, + the probability of the data given the null hypothesis is \begin_inset Formula $p<.05$ \end_inset . - Similarly, for an LBF difference larger than 3, the relative probability - that the inferior method predicts the true psychological state given the - data is + Similarly, + for an LBF difference larger than 3, + the relative probability that the inferior method predicts the true psychological state given the data is \begin_inset Formula $p<\exp\left(-3\right)\approx0.05$ \end_inset @@ -469,24 +538,12 @@ literal "true" \end_layout \begin_layout Standard -All methods included in PsPM have empirically been shown to provide better - or equal predictive validity than the best available corresponding conventional - index. - Although in most validation experiments only two conditions need to be - distinguished (a discrimination problem), the goal of PsPM is to provide - minimum-variance estimates of cognitive processes also in situations in - which the cognitive process varies across more than just two levels. - This is why we do not use discrimination methods to evaluate the models. - Also, since most psychophysiological measures are influenced by a variety - of cognitive processes, inference on a specific process unavoidably rests - on a suitable experimental design in which different conditions only differ - on this dimension, and not on other dimensions. -\end_layout - -\begin_layout Standard -Of course, this approach to method comparison can also be used to improve - operational indices, or event to create new indices in a blind classification - approach based on large data sets. +All methods included in PsPM have empirically been shown to provide better or equal retrodictive validity than the best available corresponding conventional index. + Although in most validation experiments only two conditions need to be distinguished (a discrimination problem), + the goal of PsPM is to provide minimum-variance estimates of a latent variable also in situations in which the latent variable varies across more than just two levels. + Of course, + this approach to method comparison can also be used to improve operational indices, + or event to create new indices in a blind classification approach based on large data sets. \end_layout @@ -522,19 +579,20 @@ status open \shape italic Historical remark: + \shape default - Some papers from the PsPM team have used the formula: + Some papers from the PsPM team have used the formula: + \begin_inset Formula $NLL=n\log\left(RSS/n\right)$ \end_inset . - If NLL is read as an arbitrary variable name, this formula is consistent - with the previous paragaphs. - However, note that NLL in this formula is not the negative log likelihood - (as confusingly implied in the papers), but really the AIC without complexity - correction. - The numerical value of the negative log likelihood would in this terminology - be + If NLL is read as an arbitrary variable name, + this formula is consistent with the previous paragraphs. + However, + note that NLL in this formula is not the negative log likelihood (as confusingly implied in the papers), + but really the AIC without complexity correction. + The numerical value of the negative log likelihood would in this terminology be \begin_inset Formula $NLL/2$ \end_inset @@ -555,17 +613,22 @@ General \end_layout \begin_layout Standard -All model in PsPM split the relation between mind and body into two models, +All models in PsPM split the relation between mind and body into two models, a peripheral and a neural model. - The peripheral model describes how a neural impulse is converted to a measurabl -e signal. - The neural model describes the relation between the psychological process - and the neural input into the peripheral system. + The peripheral model describes how a neural impulse is converted to a measurable signal. + The neural model describes the relation between the latent variable and the neural input into the peripheral system. This distinction is historically based on SCR models. - The neural signal that elicits SCR can be measured by intraneural recordings, + The neural signal that elicits SCR can be measured by intraneural recordings +\begin_inset CommandInset citation +LatexCommand cite +key "Gerster:2017aa" +literal "false" + +\end_inset + +, and its properties are in principle known. - Hence it appeared plausible for various research groups to create a peripheral - model + Hence it appeared plausible for various research groups to create a peripheral model \begin_inset CommandInset citation LatexCommand cite key "Alexander:2005aa,Bach:2009aa,Benedek:2010ab" @@ -573,20 +636,21 @@ literal "true" \end_inset - that takes an arbitrary neural input, and several neural models were then - combined with this peripheral model. - This distinction has later been used for other modalities, too: first because - it appeared simple from a practical standpoint, secondly because it is - often plausible to assume that the peripheral process is not directly influence -d by psychological states, but only via a neural input. - Note, however, that the peripheral/neural distinction in the model implementati -on is not always consistent with biophysical reality and tends to follow - a need for manageable inversion algorithms. - Indeed, some models collapse peripheral and stereotypical neural processes - into the peripheral model. - Examples are the GLMs for fear-conditioned HPR, PSR, and RAR - this is - unlike the non-linear SCR model in which parameters of the neural model - are estimated explicitly. + that takes an arbitrary neural input, + and several neural models were then combined with this peripheral model. + This distinction has later been used for other modalities, + too: + first because it appeared simple from a practical standpoint, + secondly because it is often plausible to assume that the peripheral process is not directly influenced by psychological states, + but only via a neural input. + Note, + however, + that the peripheral/neural distinction in the model implementation is not always consistent with biophysical reality and tends to follow a need for manageable inversion algorithms. + Indeed, + some models collapse peripheral and stereotypical neural processes into the peripheral model. + Examples are the GLMs for fear-conditioned HPR, + PSR, + and RAR - this is unlike the non-linear SCR model in which parameters of the neural model are estimated explicitly. \end_layout \begin_layout Subsection @@ -594,12 +658,13 @@ Peripheral models \end_layout \begin_layout Standard -The peripheral models in PsPM collapse all physiological and biophysical - processes involved in the generation of the measured signal. - For most psychophysiological measures, these processes are not known at - the level of detail required to build true biophysical models from theory. - In fact, biophysical models for the best-investigated modality, SCR, tend - to not fit the observed data very well +The peripheral models in PsPM collapse all physiological and biophysical processes involved in the generation of the measured signal. + For most psychophysiological measures, + these processes are not known at the level of detail required to build true biophysical models from theory. + In fact, + biophysical models for the best-investigated modality, + SCR, + tend to not fit the observed data very well \begin_inset CommandInset citation LatexCommand cite key "Benedek:2010aa,Alexander:2005aa" @@ -608,11 +673,12 @@ literal "true" \end_inset . - This is why PsPM uses purely phenomenological models which regard the periphera -l system as a black box. - By applying controlled inputs into the system, and measuring the output, - one can then approximate the workings of this black box in mathematical - form, without knowing its content. + This is why PsPM uses purely phenomenological models, + which treat the peripheral system as a black box. + By applying controlled inputs into the system, + and measuring the output, + one can then approximate the workings of this black box in mathematical form, + without knowing its content. \end_layout \begin_layout Subsubsection* @@ -620,42 +686,42 @@ LTI systems \end_layout \begin_layout Standard -Crucially, all models in PsPM assume that the peripheral system can be described - by one (or several) linear time invariant (LTI) systems with the defining - properties linearity and time invariance. +Crucially, + all models in PsPM assume that the peripheral system can be described by one (or several) linear time invariant (LTI) systems with the defining properties linearity and time invariance. A LTI system is unambiguously described by its response function (RF). - By linearity, input and output are linearly mapped so the responses to - several inputs can be simply obtained by summing the responses to individual - inputs. - Time invariance means that the output does not explicitly depend on the - time, i.e. - that the shape of the RF is constant over time while the amplitude can - vary. - It is usually also assumed that the RF is constant over individuals, although - this assumption is not necessary in the PsPM framework. + By linearity, + input and output are linearly mapped so the responses to several inputs can be simply obtained by summing the responses to individual inputs. + Time invariance means that the output does not explicitly depend on the time, + i.e. + that the shape of the RF is constant over time while the amplitude can vary. + It is usually also assumed that the RF is constant over individuals, + although this assumption is not necessary in the PsPM framework. \end_layout \begin_layout Standard -In principle, linearity ensures pure summation of two overlapping inputs. - This is not realistic if the system has limited dynamic range and saturates - due to a quick succession of inputs (e. +In principle, + linearity ensures pure summation of two overlapping inputs. + This is not realistic if the system has limited dynamic range and saturates due to a quick succession of inputs (e. g. the heart rate cannot increase indefinitely). - One can formulate limits, for each data modality, within which the model - is a useful approximation to reality. + One can formulate limits, + for each data modality, + within which the model is a useful approximation to reality. \end_layout \begin_layout Standard -For some modalities, the two properties linearity and time invariance can - be explicitly tested by neural recordings (e.g. +For some modalities, + the two properties linearity and time invariance can be explicitly tested by neural recordings (e.g. for SCR). - For other modalities, this is not possible. + For other modalities, + this is not possible. \end_layout \begin_layout Standard -Mathematically, the output +Mathematically, + the output \begin_inset Formula $y\left(t\right)$ \end_inset @@ -711,7 +777,8 @@ status open \begin_layout Plain Layout \shape italic - Note: + Note: + \shape default Convolution is more generally defined by integration over \begin_inset Formula $\mathbb{R}$ @@ -722,16 +789,18 @@ Convolution is more generally defined by integration over \begin_inset Formula $\mathbb{R}^{+}$ \end_inset - (or alternatively, setting + (or alternatively, + setting \begin_inset Formula $h\left(t\right)=0,\;t<0$ \end_inset -) ensures the causal structure of the model - only past inputs can have - an effect only into the future, not future inputs into the past. - It also reflects the implementation via Matlab's vector convolution function, - +) ensures the causal structure of the model - only past inputs can have an effect only into the future, + not future inputs into the past. + It also reflects the implementation via Matlab's vector convolution function ( \family typewriter -conv.m +conv +\family default +) in PsPM. \end_layout \end_inset @@ -743,12 +812,12 @@ conv.m \begin_inset VSpace defskip \end_inset -In many cases, the peripheral system is not exactly LTI but can be approximated - by the combination of several LTI systems. - The common case is the inclusion of RF derivatives to account for between-subje -ct variability in RF shape and latency, and a special case the combination - of a dilation and a constriction RF in pupil size modelling. - In our terminology, the RF then has +In many cases, + the peripheral system is not exactly LTI but can be approximated by the combination of several LTI systems. + The common case is the inclusion of RF derivatives to account for between-subject variability in RF shape and latency, + and a special case the combination of a dilation and a constriction RF in pupil size modelling. + In our terminology, + the RF then has \begin_inset Formula $k$ \end_inset @@ -760,7 +829,8 @@ components \begin_inset Quotes erd \end_inset -: +: + \begin_inset Formula $h\left(t\right)=h_{1..k}\left(t\right)$ \end_inset @@ -769,24 +839,23 @@ components \end_layout \begin_layout Standard -In such cases, the amplitude estimates for several response functions need - to be combined. - In PsPM, this is usually (unless indicated otherwise) done by multiplying - each component of the RF with its amplitude estimate, and adding them. - The peak of highest absolute amplitude is then identified, and its signed - amplitude extracted as estimate of neural input amplitude. +In such cases, + the amplitude estimates for several response functions need to be combined. + In PsPM, + this is usually (unless indicated otherwise) done by multiplying each component of the RF with its amplitude estimate, + and adding them. + The peak of highest absolute amplitude is then identified, + and its signed amplitude extracted as estimate of neural input amplitude. \end_layout \begin_layout Standard -Signal frequencies in the data that are not present in the RF do not contribute - to the model inversion and can be filtered out. - If the true RF were known, the matched filter theorem provides a way of - theoretically deriving a filter that maximises the signal-to-noise ratio - for the model inversion. - In most cases, the true RF is not precisely known, and also varies between - individuals. - This is why PsPM seeks to empirically determine the filter characteristics - that maximise predictive validity of psychological state estimates. +Signal frequencies in the data that are not present in the RF do not contribute to the model inversion and can be filtered out. + If the true RF were known, + the matched filter theorem provides a way of theoretically deriving a filter that maximises the signal-to-noise ratio for the model inversion. + In most cases, + the true RF is not precisely known, + and also varies between individuals. + This is why PsPM seeks to empirically determine the filter characteristics that maximise retrodictive validity of psychological state estimates. \end_layout \begin_layout Subsection @@ -794,14 +863,15 @@ Neural models \end_layout \begin_layout Standard -The neural model in PsPM describes the form of the neural input that the - peripheral model can take, and thus, the relation between mind and neural - system. - In general, model inversion benefits from constraining the neural model, +The neural model in PsPM describes the form of the neural input that the peripheral model can take, + and thus, + the relation between mind and neural system. + In general, + model inversion benefits from constraining the neural model, i.e. from reducing the number of parameters that have to be estimated. - We have empirically shown for SCR models that in many cases, a strongly - constrained neural model will result in higher predictive validity + We have empirically shown for SCR models that in many cases, + a strongly constrained neural model will result in higher retrodictive validity \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa,Bach:2014aa,Staib:2015aa" @@ -813,8 +883,7 @@ literal "true" \end_layout \begin_layout Standard -Most PsPM models assume an instantaneous (delta) neural input into the periphera -l system at a known time point +Most PsPM models assume an instantaneous (delta) neural input into the peripheral system at a known time point \begin_inset Formula $t_{i}$ \end_inset @@ -829,11 +898,13 @@ u\left(t\right)=\delta\left(t_{i}\right). \end_inset -Only the amplitude of the neural input is then estimated, and is taken as - estimate of the psychological state. +Only the amplitude of the neural input is then estimated, + and is taken as estimate of the psychological state. This renders the model suitable for GLM inversion (see below). - Less constrained models require non-linear inversion methods and can also - deal with variable onset, dispersion, or shape, of the neural input. + Less constrained models require non-linear inversion methods and can also deal with variable onset, + dispersion, + or shape, + of the neural input. \end_layout @@ -846,12 +917,13 @@ Hierarchical summary statistic approach \end_layout \begin_layout Standard -It is common in psychophysiology (and psychology in general) to compute - summary statistics for each cell of the design, and for each subject. +It is common in psychophysiology (and psychology in general) to compute summary statistics for each cell of the design, + and for each participant. These estimates of are then entered into a group-level model. - To implement this approach, PsPM estimates parameters for each participant - separately, either per experimental condition, or per trial with subsequent - averaging within the experimental condition. + To implement this approach, + PsPM estimates parameters for each participant separately, + either per experimental condition, + or per trial. In line with fMRI terminology (and different from many branches of psychology), we use the terms \begin_inset Quotes eld @@ -877,8 +949,9 @@ Multi-level modelling \end_layout \begin_layout Standard -Multi-level models, also termed linear mixed effects model (LME) or random-effec -t models, are becoming increasingly popular in psychology +Multi-level models, + also termed linear mixed effects model (LME) or random-effect models, + are becoming increasingly popular in psychology \color black \begin_inset CommandInset citation @@ -889,13 +962,13 @@ literal "true" \end_inset . - The idea is to take variance between trials into account: a summary statistic - that is computed from individual data points with high variance is less - precise that a statistic from low-variance data, and such information is - lost when summarising within each condition. - PsPM offers the possibility to compute trial-by-trial estimates (by modelling - each trial as a separate condition in GLM, or by default in DCM for SCR). - This approach has been used for SCR, PSR and SEBR + The idea is to take variance between trials into account: + a summary statistic that is computed from individual data points with high variance is less precise that a statistic from low-variance data, + and such information is lost when averaging within each condition. + PsPM offers the possibility to compute trial-by-trial estimates (by modelling each trial as a separate condition in GLM, + or by default in DCM for SCR). + This approach has been used for SCR, + PSR and SEBR \begin_inset CommandInset citation LatexCommand cite key "Bach:2017aa" @@ -903,7 +976,8 @@ literal "true" \end_inset -, see also +, + see also \begin_inset CommandInset citation LatexCommand cite key "Homan:2017aa" @@ -920,28 +994,31 @@ literal "false" \end_inset . - For GLM, modelling trial-by-trial amplitudes and averaging within conditions - yields the same result as modelling condition-by-condition amplitudes, - if the design matrix is of full rank and there is only one basis function. - With more than one basis function, the results will deviate for the second - and further basis functions in the basis set, because the orthogonalisation - with the basis set is not a linear operation. + For GLM, + modelling trial-by-trial amplitudes and averaging within conditions yields the same result as modelling condition-by-condition amplitudes, + if the design matrix is of full rank and if there is only one basis function. + With more than one basis function, + the results will deviate for the second and further basis functions in the basis set, + because the orthogonalisation with the basis set is a nonlinear operation. \end_layout \begin_layout Standard -In theory it would also be possible to account for variability within the - time series, i.e. - between data points, not only between trials. - Such approaches are implemented for fMRI, but they are not trivial. - First, model inversion is much slower by the inclusion of many subjects. - Secondly, in the time-series data analysed in PsPM, errors are usually - not independent. - This is usually not a problem for parameter estimation but impacts on the - effective degrees of freedom and thus renders statistical tests in these - models invalid, and this would apply to multi-level models, too. - fMRI softwares solve this problem by estimating an auto-regression model - on the first level but this is usually done on data from many data channels/vox -els, and this is not possible for single-channel data in psychophysiology. +In theory it would also be possible to account for variability within the time series, + i.e. + between data points, + not only between trials. + Such approaches are implemented for fMRI, + but they are not trivial. + First, + model inversion is much slower by the inclusion of many subjects. + Secondly, + in the time-series data analysed in PsPM, + errors are usually not independent. + This is usually not a problem for parameter estimation but impacts on the effective degrees of freedom and thus renders statistical tests in these models invalid, + and this would apply to multi-level models, + too. + fMRI softwares solve this problem by estimating an auto-regression model on the first level but this is usually done on data from many data channels/voxels, + and this is not possible for single-channel data in psychophysiology. This is why PsPM does not offer statistical tests on the time-series level. For the trial-wise or condition-wise summary statistic approach in PsPM, the dependencies between data points on the first level are unproblematic. @@ -953,13 +1030,13 @@ Probabilistic model inversion \begin_layout Standard All peripheral and neural models in PsPM are approximations to reality. - It is hence assumed that there is measurement error (imprecision of the - peripheral model) + It is hence assumed that there is measurement error (imprecision of the peripheral model) \begin_inset Formula $\varepsilon$ \end_inset - in the data, and that the neural input is not truthfully described by the - neural model such that it contains latent error, + in the data, + and that the neural input is not truthfully described by the neural model such that it contains latent error, + \begin_inset Formula $\omega$ \end_inset @@ -972,8 +1049,8 @@ All peripheral and neural models in PsPM are approximations to reality. \begin_inset Formula $\omega$ \end_inset - is theoretically interesting and often physiologically plausible, the model - inversion methods collapse these two sources of error: + is theoretically interesting and often physiologically plausible, + the model inversion methods collapse these two sources of error: \end_layout \begin_layout Standard @@ -1021,8 +1098,8 @@ name "subsec:General-linear-convolution" \end_layout \begin_layout Standard -Under the assumption of delta neural model, we can harness GLM to estimate - the neural input amplitude. +Under the assumption of a delta neural model, + we can harness GLM to estimate the neural input amplitude. A GLM can be written as \end_layout @@ -1034,11 +1111,13 @@ Y=Xβ+\epsilon. \end_inset -Here, +Here, + \begin_inset Formula $Y$ \end_inset - is the vector of observations (time series data), + is the vector of observations (time series data), + \begin_inset Formula $β$ \end_inset @@ -1051,8 +1130,7 @@ Here, \begin_inset Formula $X$ \end_inset - is design matrix in which each column is obtained by convolving impulse - functions at known time points (e.g. + is design matrix in which each column is obtained by convolving impulse functions at known time points (e.g. event onsets for one condition) with each component of the RF. Each column takes the form: \end_layout @@ -1077,28 +1155,31 @@ where \begin_inset Formula $i$ \end_inset -, and +, + and \begin_inset Formula $j$ \end_inset is the index of the RF component. - Finally, + Finally, + \begin_inset Formula $X$ \end_inset also contains a column for the intercept. It is possible to concatenate data from different experimental sessions, and an intercept is modelled for each session. - The maximum-likelihood amplitude estimates are then computed using the - Moore-Penrose pseudoinverse + The maximum-likelihood amplitude estimates are then computed using the Moore-Penrose pseudoinverse \begin_inset Formula $X^{+}$ \end_inset -, implemented in the Matlab function +, + implemented in the Matlab function \family typewriter -pinv.m +pinv \family default -: +: + \begin_inset Formula \[ \hat{β}=X^{+}Y. @@ -1122,8 +1203,7 @@ Non-linear model inversion \end_layout \begin_layout Standard -Models in which timing and/or dispersion of the neural input need to be - estimated require non-linear model inversion. +Models in which timing and/or dispersion of the neural input need to be estimated require non-linear model inversion. PsPM contains several efficient non-linear model inversion methods: \end_layout @@ -1137,14 +1217,13 @@ literal "true" \end_inset for dynamic systems. - This can be applied either to an entire data set, or on a trial-by-trial - basis, and requires the peripheral system to be written in the form of - an ordinary differential equation (ODE). + This can be applied either to an entire data set, + or on a trial-by-trial basis, + and requires the peripheral system to be written in the form of an ordinary differential equation (ODE). \end_layout \begin_layout Itemize -a Matching Pursuit algorithm that provides a fast approximation to the VB - inversion for some models +a Matching Pursuit algorithm that provides a fast approximation to the VB inversion for some models \end_layout \begin_layout Section @@ -1156,8 +1235,7 @@ General \end_layout \begin_layout Standard -SCR arise from opening of sweat glands and are elicited via the sympathetic - nervous system with negligible parasympathetic transmission (see +SCR arise from opening of sweat glands and are elicited via the sympathetic nervous system with negligible parasympathetic transmission (see \begin_inset CommandInset citation LatexCommand cite key "boucsein:2012" @@ -1176,17 +1254,16 @@ sudomotor nerve (SN) fibres and can be measured by intraneural recordings. SN fibres are slow C-fibres. - From their end terminal, the neurotransmitter Acetylcholine diffuses through - the skin to reach sweat glands, a process on the time scale of up to a - second. + From their end terminal, + the neurotransmitter Acetylcholine diffuses through the skin to reach sweat glands, + a process on the time scale of up to a second. \end_layout \begin_layout Standard -The frequency and amplitude of SCR is mainly influenced by psychological - arousal. - Because not all forms of psychological arousal may influence SCR in the - same way, we term the relevant psychological state +The frequency and amplitude of SCR is mainly influenced by psychological arousal. + Because not all forms of psychological arousal may influence SCR in the same way, + we term the relevant psychological state \begin_inset Quotes eld \end_inset @@ -1195,7 +1272,8 @@ sympathetic arousal \end_inset (SA). - Hence, the PsPM model is + Hence, + the PsPM model is \begin_inset Formula $SA\mapsto SN\mapsto SCR$ \end_inset @@ -1211,25 +1289,27 @@ Model evaluation \end_layout \begin_layout Standard -The peripheral LTI model can be evaluated explicitly (by intraneural recordings - or stimulation) and implicitly (by assessing properties of the model +The peripheral LTI model can be evaluated explicitly (by intraneural recordings or stimulation) and implicitly (by assessing properties of the model \begin_inset Formula $SA\mapsto SN\mapsto SCR$ \end_inset -, an approach that collapses LTI violations with imprecision in the neural - model). +, + an approach that collapses LTI violations with imprecision in the neural model). \end_layout \begin_layout Paragraph* -Time invariance: the system's response does not explicitly depend on time, - or in other words, a given input always produces the same output. +Time invariance: + the system's response does not explicitly depend on time, + or in other words, + a given input always produces the same output. \end_layout \begin_layout Itemize -Direct evidence: The amplitude of individual SN bursts is linearly related - to the amplitude of ensuing SCR, with a considerable scatter +Direct evidence: + The amplitude of individual SN bursts is linearly related to the amplitude of ensuing SCR, + with a considerable scatter \begin_inset CommandInset citation LatexCommand cite key "Bini:1980aa" @@ -1237,8 +1317,11 @@ literal "true" \end_inset -; to the maximal rate of sweat expulsion; and, somewhat more weakly, to - the integrated sweat production during the skin response +; + to the maximal rate of sweat expulsion; + and, + somewhat more weakly, + to the integrated sweat production during the skin response \begin_inset CommandInset citation LatexCommand cite key "Sugenoya:1990aa" @@ -1247,8 +1330,9 @@ literal "true" \end_inset . - After initial dishabituation, constant SN stimulation leads to SCR, with - constant amplitude and latency + After initial dishabituation, + constant SN stimulation leads to SCR, + with constant amplitude and latency \begin_inset CommandInset citation LatexCommand cite key "Kunimoto:1991aa" @@ -1265,10 +1349,10 @@ literal "true" \end_inset -, although this could be due to variation in elicited neural responses that - were not measured downstream. - In summary, these findings are consistent with (but do not prove or disprove) - the time invariance principle. +, + although this could be due to variation in elicited neural responses that were not measured downstream. + In summary, + these findings are consistent with (but do not prove or disprove) the time invariance principle. \begin_inset CommandInset citation LatexCommand cite @@ -1279,8 +1363,7 @@ literal "true" re-analysed data \color black -from an experiment in which brachial sudomotor neves were regularly stimulated - under thoracic block and SCR recorded +from an experiment in which brachial sudomotor neves were regularly stimulated under thoracic block and SCR recorded \color inherit \begin_inset CommandInset citation @@ -1293,17 +1376,19 @@ literal "true" \color black . - They found that for stimulation rates below 0.6 s (1 stimulus every 1.7 s) - around 95% of variance could be explained by an LTI model. + They found that for stimulation rates below 0.6 s (1 stimulus every 1.7 s) around 95% of variance could be explained by an LTI model. \end_layout \begin_layout Itemize -Indirect evidence: We have shown that for short events (< 1 s duration) - that are separated by at least 30 s, more than 60% of the variance in (high - pass filtered) SCR can be explained under an LTI model, for aversive white - noise bursts, aversive electric stimulation, aversive pictures, auditory - oddballs, and a visual detection task +Indirect evidence: + We have shown that for short events (< 1 s duration) that are separated by at least 30 s, + more than 60% of the variance in (high pass filtered) SCR can be explained under an LTI model, + for aversive white noise bursts, + aversive electric stimulation, + aversive pictures, + auditory oddballs, + and a visual detection task \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ad" @@ -1313,24 +1398,26 @@ literal "true" . Is this residual variance (40%) due to violations of the LTI assumptions? - We have shown that in the absence of any event for 60 s, signal variance - amounts to more than 60% of total variance during stimulus presentation. - That is to say, by introducing events, residual baseline variance is reduced - by 20%. - This suggests that residual variance is not caused by violations of the - time invariance assumption but variation of the neural input (for example, - spontaneous fluctuations), and observation error. + We have shown that in the absence of any event for 60 s, + signal variance amounts to more than 60% of total variance during stimulus presentation. + That is to say, + by introducing events, + residual baseline variance is reduced by 20%. + This suggests that residual variance is not caused by violations of the time invariance assumption but variation of the neural input (for example, + spontaneous fluctuations), + and observation error. \end_layout \begin_layout Paragraph -Linearity: the system's response does not depend on previous inputs. +Linearity: + the system's response does not depend on previous inputs. \end_layout \begin_layout Itemize -Direct evidence: Latency of sweat expulsion is slightly shortened when sweat - expulsion rate is very high (i. +Direct evidence: + Latency of sweat expulsion is slightly shortened when sweat expulsion rate is very high (i. e. for very strong SN bursts) but not when SN firing is frequent \begin_inset CommandInset citation @@ -1342,8 +1429,7 @@ literal "true" . SCR to individual SN stimulations depend linearly on skin conductance level, - and are slightly suppressed upon repetition of the stimulation after 1 - s + and are slightly suppressed upon repetition of the stimulation after 1 s \begin_inset CommandInset citation LatexCommand cite key "Kunimoto:1992ab" @@ -1367,8 +1453,7 @@ literal "true" \color inherit re-analysed data \color black -from an experiment in which brachial sudomotor neves were regularly stimulated - under thoracic block and SCR recorded +from an experiment in which brachial sudomotor neves were regularly stimulated under thoracic block and SCR recorded \color inherit \begin_inset CommandInset citation @@ -1382,28 +1467,29 @@ literal "true" \color black . They found that for stimulation rates above 0.6 s (1 stimulus every 1.7 s), - the response function looked very different from lower frequencies, suggesting - non-linearities at that stimulation frequency. + the response function looked very different from lower frequencies, + suggesting non-linearities at that stimulation frequency. They did not quantitatively characterise these non-linearities. \end_layout \begin_layout Itemize -Indirect evidence: The linearity principle amounts to saying that SCR are - not influenced by the (preceding) baseline signal. - We tested this assumption by presenting two subsequent aversive white noise - bursts with an inter stimulus interval (ISI) of either 2 s, 5.5 s, or 9 - s, such that the baseline signal at these three time points differed markedly. - Violations of the linearity principle in the peripheral system would imply - that the amplitude of the subsequent response is dependent on the baseline - signal, and thereby, upon the ISI. +Indirect evidence: + The linearity principle amounts to saying that SCR are not influenced by the (preceding) baseline signal. + We tested this assumption by presenting two subsequent aversive white noise bursts with an inter stimulus interval (ISI) of either 2 s, + 5.5 s, + or 9 s, + such that the baseline signal at these three time points differed markedly. + Violations of the linearity principle in the peripheral system would imply that the amplitude of the subsequent response is dependent on the baseline signal, + and thereby, + upon the ISI. The second response was always smaller than the first. - However, this was not dependent on the ISI, and hence not on the baseline - signal. - We interpret this effect as central repetition suppression (of the neural - inputs into the peripheral system) and conclude that linearity is appropriate - for the peripheral system. - In other words, the peripheral response to one input is not modulated or - affected by the response to another, even when they overlap in time + However, + this was not dependent on the ISI, + and hence not on the baseline signal. + We interpret this effect as central repetition suppression (of the neural inputs into the peripheral system) and conclude that linearity is appropriate for the peripheral system. + In other words, + the peripheral response to one input is not modulated or affected by the response to another, + even when they overlap in time \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ad" @@ -1421,12 +1507,10 @@ Model limits \end_layout \begin_layout Standard -Both properties appear good approximations to reality as long as the time - interval between two SN firing bursts is not very short (< 2 s) or when - the SN firing burst is not extremely strong. - It would be possible to model non-linearities in a linear model, using - Volterra kernels, as in the analysis of functional magnetic resonance images - in the software SPM +Both properties appear good approximations to reality as long as the time interval between two SN firing bursts is not very short (< 2 s) or when the SN firing burst is not extremely strong. + It would be possible to model non-linearities in a linear model, + using Volterra kernels, + as in the analysis of functional magnetic resonance images in the software SPM \begin_inset CommandInset citation LatexCommand cite key "Friston:1998aa,Friston:2000aa" @@ -1444,26 +1528,22 @@ Skin Conductance Response Function (SCRF) \end_layout \begin_layout Standard -The peripheral model in its general form does not specify a particular form - of the SCRF. +The peripheral model in its general form does not specify a particular form of the SCRF. There are three principled ways of defining a SCRF in PsPM: \end_layout \begin_layout Enumerate Individual response function. - The most precise option is to measure the SCRF for each individual by providing - brief inputs into the peripheral system and measuring the response. + The most precise option is to measure the SCRF for each individual by providing brief inputs into the peripheral system and measuring the response. PsPM allows specifying individual response functions. The benefit of this approach has not been empirically tested. \end_layout \begin_layout Enumerate Canonical response function. - The most parsimonious method is to use a so-called canonical SCRF which - is assumed to be constant across individuals. - We have previously shown that a canonical SCRF can explain on average 50% - of the variance in individual SCR elicited by various stimuli, while individual - SCRFs explain about on average 75% of the variance + The most parsimonious method is to use a so-called canonical SCRF which is assumed to be constant across individuals. + We have previously shown that a canonical SCRF can explain on average 50% of the variance in individual SCR elicited by various stimuli, + while individual SCRFs explain about on average 75% of the variance \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ad" @@ -1472,8 +1552,9 @@ literal "true" \end_inset . - Using a canonical SCRF, linear and non-linear models show a good predictive - validity, superior to peak-scoring methods + Using a canonical SCRF, + linear and non-linear models show a good retrodictive validity, + superior to peak-scoring methods \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa,Staib:2015aa" @@ -1486,22 +1567,20 @@ literal "true" \begin_layout Enumerate Constrained response function. - One can estimate an SCRF from the data of an actual experiment and use - this for analysis. - It is usually necessary to constrain the shape of the SCRF to make the - model estimable. - PsPM provides two options for this: + One can estimate an SCRF from the data of an actual experiment and use this for analysis. + It is usually necessary to constrain the shape of the SCRF to make the model estimable. + PsPM provides two options for this: + \end_layout \begin_layout Itemize -In GLM, one can estimate parameters of the (orthogonalised) time derivative - of the SCRF. - In order to combine this with the canonical SCRF, the response can afterwards - be reconstructed for each experimental condition, and the peak amplitude - taken as estimate of SA. - This approach has higher predictive validity than using the canonical SCRF - alone, or using a less constrained SCRF (canonical with time and dispersion - derivative) +In GLM, + one can estimate parameters of the (orthogonalised) time derivative of the SCRF. + In order to combine this with the canonical SCRF, + the response can afterwards be reconstructed for each experimental condition, + and the peak amplitude taken as estimate of SA. + This approach has higher retrodictive validity than using the canonical SCRF alone, + or using a less constrained SCRF (canonical with time and dispersion derivative) \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa" @@ -1513,13 +1592,13 @@ literal "true" \end_layout \begin_layout Itemize -In the non-linear model for event-related SCR, one can use the combined - data from all evoked responses from one individual to estimate an SCRF. +In the non-linear model for event-related SCR, + one can use the combined data from all evoked responses from one individual to estimate an SCRF. This approach only considers data within the inter-trial interval. - In a validation experiments study with ITI of 7-11 s, this had lower predictive - validity than using the canonical SCRF, and we would not recommend it unless - the ITI is longer than 20 s, so that the SCRF tail can be unambigouosly - estimated + In a validation experiments study with ITI of 7-11 s, + this had lower retrodictive validity than using the canonical SCRF, + and we would not recommend it unless the ITI is longer than 20 s, + so that the SCRF tail can be unambigouosly estimated \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -1535,13 +1614,12 @@ Canonical Skin Conductance Response Function \end_layout \begin_layout Standard -The canonical SCRF that is currently implemented was derived from a large - dataset of 1278 SCRs from 64 individuals subjected to different experimental - manipulations (white noise 85 dB and 95 dB, painful electric stimulation, - aversive IAPS pictures, detection of auditory oddballs, detection of a - visual target in a stimulus stream). - We extracted and mean-centred the 30 s following each stimulus onset and - performed a principal component analysis. +The canonical SCRF that is currently implemented was derived from a large dataset of 1278 SCRs from 64 individuals subjected to different experimental manipulations (white noise 85 dB and 95 dB, + painful electric stimulation, + aversive IAPS pictures, + detection of auditory oddballs, + detection of a visual target in a stimulus stream). + We extracted and mean-centred the 30 s following each stimulus onset and performed a principal component analysis. The first principal component served as empirical SCRF \begin_inset CommandInset citation LatexCommand cite @@ -1558,11 +1636,11 @@ Formulation for linear models \end_layout \begin_layout Standard -The first PCA component of the empirical SCRF was approximated was fitted - by a Gaussian smoothed bi-exponential function (also named bi-exponentially - modified Gaussian function), and this provided better fit than other function - categories, in particular Gaussian smoothed monoexponential function, exponenti -al-Gaussian hybrid function, or smoothed sigmoid-exponential function. +The first PCA component of the empirical SCRF was approximated was fitted by a Gaussian smoothed bi-exponential function (also named bi-exponentially modified Gaussian function), + and this provided better fit than other function categories, + in particular Gaussian smoothed monoexponential function, + exponential-Gaussian hybrid function, + or smoothed sigmoid-exponential function. The function is thus defined as \end_layout @@ -1600,15 +1678,18 @@ E_{i}\left(t\right)=e^{-\lambda_{i}t}, \end_layout \begin_layout Standard -with estimated parameters: +with estimated parameters: + \begin_inset Formula $\hat{t}_{0}=3.0745$ \end_inset - seconds for peak latency; + seconds for peak latency; + \begin_inset Formula $\hat{\sigma}=0.7013$ \end_inset - for definition of the rise time; + for definition of the rise time; + \begin_inset Formula $\hat{\lambda}_{1}=0.3176$ \end_inset @@ -1617,10 +1698,8 @@ with estimated parameters: \end_inset to define the two decay components. - This function is normalised to its maximum such that an infinitely short - SN impulse with unit amplitude elicits an SCR with unit amplitude. - This renders parameter estimates from linear models easily interpretable - in relation to conventional (peak-scoring) analysis. + This function is normalised to its maximum such that an infinitely short SN impulse with unit amplitude elicits an SCR with unit amplitude. + This renders parameter estimates from linear models easily interpretable in relation to conventional (peak-scoring) analysis. \begin_inset VSpace defskip \end_inset @@ -1653,6 +1732,7 @@ status open \shape italic Historical remarks: + \shape default \end_layout @@ -1666,24 +1746,24 @@ literal "true" \end_inset - contains a typographic error in the definition of the canonical response - function, in particular in the integration limits of eq. + contains a typographic error in the definition of the canonical response function, + in particular in the integration limits of eq. ( \begin_inset CommandInset ref LatexCommand ref reference "eq:SCRFcan" +nolink "false" \end_inset ). - However, in all versions of the software (PsPM 1.0-now) the canonical SCRF - was constructed using the Matlab function + However, + in all versions of the software (PsPM 1.0-now) the canonical SCRF was constructed using the Matlab function \family typewriter conv() \family default which defines vector convolution analogous to the integral defined above. - This implementation has not changed since the initial formulation of the - model. + This implementation has not changed since the initial formulation of the model. \end_layout \begin_layout Plain Layout @@ -1695,7 +1775,8 @@ literal "true" \end_inset - used a Gaussian-smoothed Gamma distribution, based on a smaller dataset. + used a Gaussian-smoothed Gamma distribution, + based on a smaller dataset. In the extended data set published in \begin_inset CommandInset citation LatexCommand cite @@ -1704,7 +1785,8 @@ literal "true" \end_inset -, the polynomial part of the Gamma distribution was estimated to be one, +, + the polynomial part of the Gamma distribution was estimated to be one, resulting in a Gaussian smoothed exponential function. \end_layout @@ -1721,9 +1803,7 @@ Formulation for non-linear models \end_layout \begin_layout Standard -An alternative formulation is provided for non-linear models which require - a definition of the SCRF in the form of an inhomogeneous ordinary differential - equation (ODE). +An alternative formulation is provided for non-linear models which require a definition of the SCRF in the form of an inhomogeneous ordinary differential equation (ODE). We use an third-order linear ODE to describe the data \begin_inset Formula $y\left(t\right)$ \end_inset @@ -1743,28 +1823,29 @@ An alternative formulation is provided for non-linear models which require \end_layout \begin_layout Standard -where dot notation is used for time derivatives, and this formulation embeds - convolution of the SCRF with the SN time series. - Parameters were estimated from the empirical SCRF by using a Gaussian bump - as canonical SN input (see section on SN below) as +where dot notation is used for time derivatives, + and this formulation embeds convolution of the SCRF with the SN time series. + Parameters were estimated from the empirical SCRF by using a Gaussian bump as canonical SN input (see section on SN below) as \begin_inset Formula $\hat{\vartheta}_{1}=1.342052$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{2}=1.411425$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{3}=0.122505$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{4}=1.533879$ \end_inset . - Amplitude of the response function is rescaled such that a canonical Gaussian - bump SN impulse with unit amplitude elicits an SCR with unit amplitude. + Amplitude of the response function is rescaled such that a canonical Gaussian bump SN impulse with unit amplitude elicits an SCR with unit amplitude. \end_layout \begin_layout Paragraph* @@ -1772,9 +1853,8 @@ Formulation for spontaneous fluctuations \end_layout \begin_layout Standard -For modelling spontaneous fluctuations (SF), a different database was used - that contained 1153 semi-automatically detected SF from 40 male participants - +For modelling spontaneous fluctuations (SF), + a different database was used that contained 1153 semi-automatically detected SF from 40 male participants \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ac" @@ -1782,10 +1862,9 @@ literal "true" \end_inset - The first PCA component was taken as empirical SCRF which has slightly - different shape than the empirical SCRF for evoked responses. - A number of reasons may account for this difference, from participant selection - over data pre-conditioning to differences in the canonical SN input. + The first PCA component was taken as empirical SCRF which has slightly different shape than the empirical SCRF for evoked responses. + A number of reasons may account for this difference, + from participant selection over data pre-conditioning to differences in the canonical SN input. In the absence of further knowledge about the reason for this difference, we propose to use this empirical response function for SF. We estimated the ODE parameters (eq. @@ -1793,28 +1872,32 @@ literal "true" \begin_inset CommandInset ref LatexCommand ref reference "eq:ODE" +nolink "false" \end_inset -): +): + \begin_inset Formula $\hat{\vartheta}_{\text{1}}=2.1594$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{2}=3.9210$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{3}=0.9235$ \end_inset -, +, + \begin_inset Formula $\hat{\vartheta}_{4}=1.533879$ \end_inset seconds. - Amplitude of the response function is rescaled such that a canonical Gaussian - bump SN impulse with unit amplitude elicits an SF with unit amplitude. + Amplitude of the response function is rescaled such that a canonical Gaussian bump SN impulse with unit amplitude elicits an SF with unit amplitude. \begin_inset VSpace defskip \end_inset @@ -1843,28 +1926,34 @@ status open \begin_layout Plain Layout \shape italic -Note: +Note: + \shape default -In the Matlab implementation, the third order ODE is converted to a 3-dimensiona -l system of first-order ODEs. - In that process, the order of the parameters +In the Matlab implementation, + the third order ODE is converted to a 3-dimensional system of first-order ODEs. + In that process, + the order of the parameters \begin_inset Formula $\vartheta_{1..3}$ \end_inset - is reversed, and they are renamed. + is reversed, + and they are renamed. With substitutions \begin_inset Formula $y_{1}=y$ \end_inset -, +, + \begin_inset Formula $y_{2}=\dot{y}$ \end_inset -, +, + \begin_inset Formula $y_{3}=\ddot{y}$ \end_inset -, the ODE becomes: +, + the ODE becomes: \end_layout \begin_layout Plain Layout @@ -1916,11 +2005,10 @@ literal "true" \color inherit -recorded from C-fibres in the superficial branch of the common peroneal - nerve proximal to the ankle, while participants heard loud sounds, or responsed - to oddball sounds. - They found that the average SN response was well described by a Gaussian - bump with 0.25 - 0.30 s standard deviation. +recorded from C-fibres in the superficial branch of the common peroneal nerve proximal to the ankle, + while participants heard loud sounds, + or responsed to oddball sounds. + They found that the average SN response was well described by a Gaussian bump with 0.25 - 0.30 s standard deviation. PsPM models SN bursts as a Gaussian bump with 0.30 s standard deviation. \end_layout @@ -1929,8 +2017,7 @@ General Linear Model (GLM) for evoked SA \end_layout \begin_layout Standard -This model was developed for experiments in which short experimental events - with evoke SA with amplitude +This model was developed for experiments in which short experimental events with evoke SA with amplitude \begin_inset Formula $a$ \end_inset @@ -1943,7 +2030,8 @@ This model was developed for experiments in which short experimental events \begin_inset Formula $t_{o_{i}}$ \end_inset -, we assume +, + we assume \begin_inset Formula $u_{i}\left(t\right)=a_{i}\delta\left(t_{o_{i}}\right)$ \end_inset @@ -1952,6 +2040,7 @@ This model was developed for experiments in which short experimental events \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" +nolink "false" \end_inset @@ -1976,8 +2065,7 @@ literal "true" \begin_inset Formula $a$ \end_inset - causes a Gaussian bump-like SN firing burst after some delay and with a - specified dispersion. + causes a Gaussian bump-like SN firing burst after some delay and with a specified dispersion. For each experimental event: \end_layout @@ -1993,8 +2081,8 @@ u_{exp}\left(t\right)=a\exp\frac{-\left(t-\mu\right)^{2}}{2\sigma^{2}}+\omega,\: \end_layout \begin_layout Standard -For situations in which short external stimuli elicit SA, this model uses - a canonical central burst latency of zero and dispersion of +For situations in which short external stimuli elicit SA, + this model uses a canonical central burst latency of zero and dispersion of \begin_inset Formula $\sigma_{e}=0.3$ \end_inset @@ -2007,13 +2095,16 @@ fixed response \end_inset ). - For situations in which central processes translate SA into SN with unknown - parameters, latency and dispersion are estimated from the data, alongside - the SA amplitude, using the following constraints: + For situations in which central processes translate SA into SN with unknown parameters, + latency and dispersion are estimated from the data, + alongside the SA amplitude, + using the following constraints: + \begin_inset Formula $\sigma_{min}=0.1$ \end_inset -, +, + \begin_inset Formula $\sigma_{max}=0.5\mu_{max}$ \end_inset @@ -2033,8 +2124,7 @@ flexible response \end_layout \begin_layout Standard -The full model also accounts for spontaneous fluctuations (next subsection) - and baseline changes between trials and can be written as: +The full model also accounts for spontaneous fluctuations (next subsection) and baseline changes between trials and can be written as: \end_layout \begin_layout Standard @@ -2054,6 +2144,7 @@ The SCR components are defined by eq. \begin_inset CommandInset ref LatexCommand ref reference "eq:ODE" +nolink "false" \end_inset @@ -2062,11 +2153,10 @@ reference "eq:ODE" \end_inset . - Specifically, the experimental SCR component models evoked and event-related - responses, and the SF component models spontaneous fluctuations between - trials (part of the latent error). - The SCL term is an explicitly modelled error term that absorbs baseline - fluctuations and is defined as + Specifically, + the experimental SCR component models evoked and event-related responses, + and the SF component models spontaneous fluctuations between trials (part of the latent error). + The SCL term is an explicitly modelled error term that absorbs baseline fluctuations and is defined as \end_layout \begin_layout Standard @@ -2085,21 +2175,25 @@ where dispersion is set to \begin_inset Formula $\sigma_{0}=1.0$ \end_inset - seconds, and + seconds, + and \begin_inset Formula $\mu$ \end_inset is estimated from the data. - By default, PsPM automatically mdoels SN bursts that occur more than 5 - s after the previous trial, and more than 2 s before the next trial. - These limits ensure that the modelled SCL and SF do not absorb variance - caused by the experiment. + By default, + PsPM automatically mdoels SN bursts that occur more than 5 s after the previous trial, + and more than 2 s before the next trial. + These limits ensure that the modelled SCL and SF do not absorb variance caused by the experiment. The use of different limits has not empirically been tested. \end_layout \begin_layout Standard -In this model, the parameter space is too large to invert it at once. - Inversion is done in a trial-by-trial approach: a number of trials, +In this model, + the parameter space is too large to invert it at once. + Inversion is done in a trial-by-trial approach: + a number of trials, + \begin_inset Formula $T_{1..n}$ \end_inset @@ -2108,7 +2202,8 @@ In this model, the parameter space is too large to invert it at once. \begin_inset Formula $T_{1}$ \end_inset - are extracted, and the parameter estimates for + are extracted, + and the parameter estimates for \begin_inset Formula $T_{2..n}$ \end_inset @@ -2116,19 +2211,17 @@ In this model, the parameter space is too large to invert it at once. \begin_inset Formula $T_{2..n+1}$ \end_inset - where the estimated hidden state values at the start of trial 2 are taken - as starting values of the hidden states + where the estimated hidden state values at the start of trial 2 are taken as starting values of the hidden states \begin_inset Formula $x$ \end_inset . This is continued until all trials have been estimated. - This scheme ensures that inversion is kept tractable, and at the same time - overlapping responses are taken into account. - It also means that estimation errors accumulate over trials which is why - part of the latent error is explicitly modelled as SF and SCL. - At an inter trial interval of around 10 seconds, inverting 2 or 3 trials - at the same time yields comparable predictive validity + This scheme ensures that inversion is kept tractable, + and at the same time overlapping responses are taken into account. + It also means that estimation errors accumulate over trials which is why part of the latent error is explicitly modelled as SF and SCL. + At an inter trial interval of around 10 seconds, + inverting 2 or 3 trials at the same time yields comparable retrodictive validity \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2141,14 +2234,14 @@ literal "true" \end_layout \begin_layout Subsubsection -Non-linear model for tonic SA (spontaneous fluctuations, SF) +Non-linear model for tonic SA (spontaneous fluctuations, + SF) \end_layout \begin_layout Standard Spontaneous SN bursts cause spontaneous fluctuations (SF) in skin conductance. The number of spontaneous SN bursts is thought to depend on SA. - Each spontaneous SN burst is modelled as a Gaussian bump with unknown timing - and amplitude and fixed dispersion. + Each spontaneous SN burst is modelled as a Gaussian bump with unknown timing and amplitude and fixed dispersion. For each spontaneous SF burst: \end_layout @@ -2178,8 +2271,8 @@ literal "true" \end_inset . - Because the number of SN bursts is difficult to estimate directly, the - SF model inversion uses a fixed rate of SN bursts (set to + Because the number of SN bursts is difficult to estimate directly, + the SF model inversion uses a fixed rate of SN bursts (set to \begin_inset Formula $f=0.5$ \end_inset @@ -2193,8 +2286,7 @@ true \end_inset SN bursts from noise. - An amplitude threshold of 0.1 µS rendered the predictive highest validity - in a validation paper + An amplitude threshold of 0.1 µS rendered the predictive highest validity in a validation paper \begin_inset CommandInset citation LatexCommand cite key "Bach:2011a" @@ -2203,8 +2295,7 @@ literal "true" \end_inset . - The results from this paper have been replicated in an unpublished re-analysis - using AIC as objective function in a manner similar to + The results from this paper have been replicated in an unpublished re-analysis using AIC as objective function in a manner similar to \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa" @@ -2221,18 +2312,20 @@ literal "true" \end_inset -, the optimal threshold was between 0.15 - 0.20 µS. +, + the optimal threshold was between 0.15 - 0.20 µS. Further systematic research is needed to fine tune the optimal threshold. \end_layout \begin_layout Standard -Furthermore, PsPM uses a Matching Pursuit (MP) algorithm as fast (< 1 s - per minute of data) approximation to the DCM inversion (ca. +Furthermore, + PsPM uses a Matching Pursuit (MP) algorithm as fast (< 1 s per minute of data) approximation to the DCM inversion (ca. 1 min. per minute of data). - Using simulated data, this method was less precise, but empirically it - was comparable to DCM results in three different data sets + Using simulated data, + this method was less precise, + but empirically it was comparable to DCM results in three different data sets \begin_inset CommandInset citation LatexCommand cite key "Bach:2015aa" @@ -2253,12 +2346,10 @@ Filtering \end_layout \begin_layout Standard -Skin conductance signals return to a baseline after an SCR, but this baseline - can change over time within a large dynamic range. - Such fluctuations of the skin conductance level need to be filtered out - to make the data accessible to an LTI model. - A unidirectional 1st order Butterworth high pass filter with cut off frequency - 0.05 Hz was optimal for GLM +Skin conductance signals return to a baseline after an SCR, + but this baseline can change over time within a large dynamic range. + Such fluctuations of the skin conductance level need to be filtered out to make the data accessible to an LTI model. + A unidirectional 1st order Butterworth high pass filter with cut off frequency 0.05 Hz was optimal for GLM \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa" @@ -2267,11 +2358,9 @@ literal "true" \end_inset . - The design matrix of the GLM is filtered with the same frequency to account - for distortions of response shape. - For the non-linear model (DCM) for event-related responses, an optimal - filter frequency was found at 0.0159 Hz when using a canonical SCRF and - inversion of 2 trials at the same time + The design matrix of the GLM is filtered with the same frequency to account for distortions of response shape. + For the non-linear model (DCM) for event-related responses, + an optimal filter frequency was found at 0.0159 Hz when using a canonical SCRF and inversion of 2 trials at the same time \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2281,9 +2370,8 @@ literal "true" . Filter characteristics of SF models have not been investigated. - In order to reduce computation load, data are resampled to 10 Hz sampling - rate for all data analyses which requires a low-pass filter cut off frequency - of 5 Hz. + In order to reduce computation load, + data are resampled to 10 Hz sampling rate for all data analyses which requires a low-pass filter cut off frequency of 5 Hz. \begin_inset VSpace defskip \end_inset @@ -2314,14 +2402,14 @@ status open \shape italic Historical remark: + \shape default - The SCRF was developed using a high pass filter with cut off frequency - of 0.0159 Hz as commonly employed in conventional analysis (bidirectional - for phasic responses, unidirectional for spontaneous fluctuations). - However, this turned out to not be the optimal filter for GLM in follow-up - analyses of optimal data conditioning. - Note that the canonical SCRF was developed from data filtered with the - original settings, and this has not changed since. + The SCRF was developed using a high pass filter with cut off frequency of 0.0159 Hz as commonly employed in conventional analysis (bidirectional for phasic responses, + unidirectional for spontaneous fluctuations). + However, + this turned out to not be the optimal filter for GLM in follow-up analyses of optimal data conditioning. + Note that the canonical SCRF was developed from data filtered with the original settings, + and this has not changed since. \end_layout \end_inset @@ -2341,13 +2429,13 @@ Normalisation \end_layout \begin_layout Standard -For within-subjects analysis, we propose data normalisation after filtering - to remove SCR scaling differences due to peripheral factors such as skin - property. - This increases predictive validity (unpublished analyses). - For methods that yield trial-by-trial estimates, post-hoc normalisation - of amplitude estimates across trials, before averaging within conditions, - yields even better predictive validity +For within-subjects analysis, + we propose data normalisation after filtering to remove SCR scaling differences due to peripheral factors such as skin property. + This increases retrodictive validity (unpublished analyses). + For methods that yield trial-by-trial estimates, + post-hoc normalisation of amplitude estimates across trials, + before averaging within conditions, + yields even better retrodictive validity \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2356,8 +2444,8 @@ literal "true" \end_inset . - For between-subjects analysis, this is not an option as it removes between-subj -ects variance. + For between-subjects analysis, + this is not an option as it removes between-subjects variance. \end_layout @@ -2385,7 +2473,8 @@ where \begin_inset Formula $I$ \end_inset - is a time interval, and + is a time interval, + and \begin_inset Formula $a_{1..n}$ \end_inset @@ -2398,9 +2487,11 @@ where \end_inset is the skin conductance level at rest. - That is, by simply taking the time integral, or area under the curve (AUC), - of the baseline-corrected data, we get a measure of the number x amplitude - of spontaneous SN bursts + That is, + by simply taking the time integral, + or area under the curve (AUC), + of the baseline-corrected data, + we get a measure of the number x amplitude of spontaneous SN bursts \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ac" @@ -2410,9 +2501,9 @@ literal "true" . This measure is implemented in the software as well. - However, we have subsequently shown that the number of spontaneous SN bursts - is a better predictor of tonic SA than AUC, and hence we recommend to use - the non-linear model for tonic SA. + However, + we have subsequently shown that the number of spontaneous SN bursts is a better predictor of tonic SA than AUC, + and hence we recommend to use the non-linear model for tonic SA. \end_layout @@ -2421,8 +2512,7 @@ Comparison with other model-based methods for SCR \end_layout \begin_layout Standard -Several further approaches to model-based analysis of SCR have been introduced - in the literature +Several further approaches to model-based analysis of SCR have been introduced in the literature \begin_inset CommandInset citation LatexCommand cite key "Lim:1997aa,Alexander:2005aa,Benedek:2010ab,Benedek:2010aa,Greco:2014aa" @@ -2430,19 +2520,16 @@ literal "true" \end_inset - - for one of them, the implementation is publicly available in the software - package Ledalab. - In this method, SN is calculated from SCR using a deterministic inverse - filter. - Peaks in the SN time series are then identified and used as operational - index of SA. - In a head-to-head comparison, predictive validity to identify states with - known SA was compared for experiments involving short stimuli and evoked - SA. - PsPM had better predictive validity than Ledalab in 4 out of 5 tested contrasts -, and equal validity in the fifth. - Ledalab did not consistently perform superior to classical peak scoring - analysis + - for one of them, + the implementation is publicly available in the software package Ledalab. + In this method, + SN is calculated from SCR using a deterministic inverse filter. + Peaks in the SN time series are then identified and used as operational index of SA. + In a head-to-head comparison, + retrodictive validity to identify states with known SA was compared for experiments involving short stimuli and evoked SA. + PsPM had better retrodictive validity than Ledalab in 4 out of 5 tested contrasts, + and equal validity in the fifth. + Ledalab did not consistently perform superior to classical peak scoring analysis \begin_inset CommandInset citation LatexCommand cite key "Bach:2014aa" @@ -2458,14 +2545,14 @@ Recommendations \end_layout \begin_layout Itemize -Experimental design: +Experimental design: + \end_layout \begin_deeper \begin_layout Itemize SOA > 2 s between events eliciting SCR. - SCR amplitudes appear to be linear with an SOA of 3.5 s between subsequent - stimuli + SCR amplitudes appear to be linear with an SOA of 3.5 s between subsequent stimuli \begin_inset CommandInset citation LatexCommand cite key "Bach:2010ad" @@ -2505,8 +2592,7 @@ literal "true" \end_layout \begin_layout Itemize -Use default filter frequencies (0.05 - 5 Hz unidirectional filter for GLM - +Use default filter frequencies (0.05 - 5 Hz unidirectional filter for GLM \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa" @@ -2514,7 +2600,8 @@ literal "true" \end_inset -; 0.0159 - 5 Hz bidirectional filter for non-linear model +; + 0.0159 - 5 Hz bidirectional filter for non-linear model \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2523,17 +2610,33 @@ literal "true" \end_inset ). + In case of sparse SCR (e.g. + in paradigms with long ITIs), + the bidirectional filter can distort the signal to an extent that it becomes difficult to model. + In such cases, + it might be preferable to use a unidirectional filter (see e.g. + +\begin_inset CommandInset citation +LatexCommand cite +key "Wehrli:2022aa" +literal "false" + +\end_inset + +) \end_layout \begin_layout Itemize -GLM: include all experimental events that evoke SCR (including block starts, - break messages, etc.). +GLM: + include all experimental events that evoke SCR (including block starts, + break messages, + etc.). \end_layout \begin_layout Itemize -GLM: canonical SCRF with time derivative and reconstruction of amplitudes - is more sensitive than just canonical SCRF, or SCRF plus time and dispersion - derivative +GLM: + canonical SCRF with time derivative and reconstruction of amplitudes is more sensitive than just canonical SCRF, + or SCRF plus time and dispersion derivative \begin_inset CommandInset citation LatexCommand cite key "Bach:2013aa" @@ -2546,8 +2649,8 @@ literal "true" \end_layout \begin_layout Itemize -non-linear model: canonical SCRF is more sensitive than using subject-specific - SCRFs based on short (~ 10 s) ITIs +non-linear model: + canonical SCRF is more sensitive than using subject-specific SCRFs based on short (~ 10 s) ITIs \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2560,8 +2663,9 @@ literal "true" \end_layout \begin_layout Itemize -non-linear model: for fear conditioning paradigms, the best way of modelling - anticipatory SCR is currently under investigation. +non-linear model: + for fear conditioning paradigms, + the best way of modelling anticipatory SCR is currently under investigation. It is possibly suboptimal to model one anticipatory \begin_inset Quotes eld \end_inset @@ -2570,13 +2674,24 @@ flexible \begin_inset Quotes erd \end_inset - response, in particular at longer CS/US SOAs when this flexible response - may absorb SCR elicited by US or US omission. + response, + in particular at longer CS/US SOAs when this flexible response may absorb SCR elicited by US or US omission. + See e.g. + +\begin_inset CommandInset citation +LatexCommand cite +key "Wehrli:2022aa,Xia:2023aa" +literal "false" + +\end_inset + + \end_layout \begin_layout Itemize -GLM and non-linear model: z-normalisation of data is recommended for within-subj -ects designs, and should not be used for between-subjects designs. +GLM and non-linear model: + z-normalisation of data is recommended for within-subjects designs, + and should not be used for between-subjects designs. \end_layout \end_deeper @@ -2586,8 +2701,16 @@ Model inversion: \begin_deeper \begin_layout Itemize -SF model: the VB inversion is theoretically better suited than the MP inversion - when the expected number of SF is > 10/minute. +SF model: + the VB inversion is theoretically better suited than the MP inversion when the expected number of SF is > 10/minute +\begin_inset CommandInset citation +LatexCommand cite +key "Bach:2015ab" +literal "false" + +\end_inset + +. \end_layout \end_deeper @@ -2597,9 +2720,8 @@ Post-processing \begin_deeper \begin_layout Itemize -non-linear model: trial-by-trial normalisation of amplitude estimates before - averaging within conditions can increase sensitivity in within-subjects - designs +non-linear model: + trial-by-trial normalisation of amplitude estimates before averaging within conditions can increase sensitivity in within-subjects designs \begin_inset CommandInset citation LatexCommand cite key "Staib:2015aa" @@ -2612,14 +2734,15 @@ literal "true" \end_deeper \begin_layout Section -Heart Period (HP) Models +Heart Period Response (HPR) Models \end_layout \begin_layout Standard \shape italic contributed by Philipp C. - Paulus and Giuseppe Castegnetti, and edited by Dominik R. + Paulus and Giuseppe Castegnetti, + and edited by Dominik R. Bach \end_layout @@ -2628,14 +2751,15 @@ General \end_layout \begin_layout Standard -Cardiac rhythm is generated locally in the sinoatrial node, but is modulated - by central neural input. - Therefore, heart rhythm can be used to infer psychological states. - To quantify phasic changes in cardiac chronotropy, two measures are common: +Cardiac rhythm is generated locally in the sinoatrial node, + but is modulated by central neural input. + Therefore, + heart rhythm can be used to infer psychological states. + To quantify phasic changes in cardiac chronotropy, + two measures are common: heart rate (beats per minute) or heart period (milliseconds). - Heart period appears to relate to autonomic input linearly, as revealed - in experiments in which autonomic nerves in rodents were electrically stimulate -d with varying frequencies to elicit heart period changes + Heart period appears to relate to autonomic input linearly, + as revealed in experiments in which autonomic nerves in rodents were electrically stimulated with varying frequencies to elicit heart period changes \begin_inset CommandInset citation LatexCommand cite key "Berntson:1995" @@ -2646,16 +2770,17 @@ literal "true" . This is why PsPM models heart period. Heart period information is only available at discrete time points. - To facilitate analysis within the existing algorithms, PsPM assigns each - heart period to its following heartbeat and linearly interpolates this - time series at 10 Hz resolution. + To facilitate analysis within the existing algorithms, + PsPM assigns each heart period to its following heartbeat and linearly interpolates this time series at 10 Hz resolution. \end_layout \begin_layout Standard -For the analysis of event-related, i.e. - phasic cardiac responses, PsPM includes two models: A model for event-related - HPR +For the analysis of event-related, + i.e. + phasic cardiac responses, + PsPM includes two models: + A model for event-related HPR \begin_inset CommandInset citation LatexCommand cite key "Paulus:2016aa" @@ -2663,7 +2788,7 @@ literal "true" \end_inset - and a model for fear-conditioned bradicardia + and a model for fear-conditioned bradycardia \begin_inset CommandInset citation LatexCommand cite key "Castegnetti:2016aa" @@ -2672,30 +2797,31 @@ literal "true" \end_inset . - As in previous models for Skin Conductance Responses (SCR), both models - are optimised with regard to + As in previous models for SCR, + both models are optimised with regard to \shape italic -predictive validity +retrodictive validity \shape default -, i.e. - the ability to separate experimental conditions (e.g., CS+ vs. +, + i.e. + the ability to separate experimental conditions (e.g., + CS+ vs. CS-). \end_layout \begin_layout Standard -Operational analysis has shown that event-related HPR pattern strongly depends - upon properties of the input - i.e. - modality, intensity and presentation duration of the stimulus material. - It follows that both models can only be applied in experiments with similar - conditions, including stimulus presentation times (i.e. +Operational analysis has shown that event-related HPR pattern strongly depends upon properties of the input - i.e. + modality, + intensity and presentation duration of the stimulus material. + It follows that both models can only be applied in experiments with similar conditions, + including stimulus presentation times (i.e. \begin_inset Formula $\leq$ \end_inset 1 s for event-related HPR). - Pharmacological studies have suggested a differential time course of sympatheti -c and parasympathetic nervous input, but it is not yet known how this maps - onto the response components modelled here. + Pharmacological studies have suggested a differential time course of sympathetic and parasympathetic nervous input, + but it is not yet known how this maps onto the response components modelled here. \end_layout \begin_layout Subsection @@ -2703,20 +2829,20 @@ Peripheral and neural model \end_layout \begin_layout Standard -In the absence of information on the timecourse of cardiac information, +In the absence of information on the time course of cardiac information, it is difficult to separate a neural and a peripheral model. - Hence, these two are collapsed for the purpose of quick and simple inversion - with GLM (see + Hence, + these two are collapsed for the purpose of quick and simple inversion with GLM (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" +nolink "false" \end_inset ). - This means that the two implemented models - for evoked HRP and fear-conditione -d HRP - use a different RF, although of course the peripheral system is - the same in both cases. + This means that the implemented models - for evoked HPR and fear-conditioned or reward-conditioned HPR - use a different RF, + although of course the peripheral system is the same in both cases. Castegnetti et al. \begin_inset CommandInset citation @@ -2726,8 +2852,8 @@ literal "true" \end_inset - relate the two models to each other, and derived the neural input producing - fear-conditioned bradycardia (see figure 1 of + relate the two models to each other, + and derived the neural input producing fear-conditioned bradycardia (see figure 1 of \begin_inset CommandInset citation LatexCommand cite key "Castegnetti:2016aa" @@ -2751,13 +2877,14 @@ literal "true" \end_inset - was developed on data from 84 participants that underwent three different - experiments: An experiment using loud white noise sounds ( + was developed on data from 84 participants that underwent three different experiments: + An experiment using loud white noise sounds ( \begin_inset Formula $\sim85dB$ \end_inset -), an experiment using an auditory oddball task, and an experiment using - emotional pictures from the International Affective Picture System (IAPS; +), + an experiment using an auditory oddball task, + and an experiment using emotional pictures from the International Affective Picture System (IAPS; \begin_inset CommandInset citation LatexCommand cite @@ -2767,11 +2894,9 @@ literal "true" \end_inset ). - All stimuli were presented with long ITIs (> 30 s) to allow the cardiac - system to return to baseline after stimulus presentation and avoid overlapping - responses. - The first three principal response components were extracted, and individual - peaks fitted with Gaussian Functions as RF: + All stimuli were presented with long ITIs (> 30 s) to allow the cardiac system to return to baseline after stimulus presentation and avoid overlapping responses. + The first three principal response components were extracted, + and individual peaks fitted with Gaussian Functions as RF: \begin_inset Formula \begin{equation} h\left(y\right)=\frac{1}{\sigma\sqrt{2\pi}}e^{\frac{-(t-\mu)^{2}}{2\sigma^{2}}}\label{eq:Gaussian} @@ -2779,28 +2904,28 @@ h\left(y\right)=\frac{1}{\sigma\sqrt{2\pi}}e^{\frac{-(t-\mu)^{2}}{2\sigma^{2}}}\ \end_inset -To test whether a modeled peak qualified as a RF, we tested whether it explained - interesting variance in the data. +To test whether a modeled peak qualified as a RF, + we tested whether it explained interesting variance in the data. We started with a single RF and included further RFs. - Specifically, we created a first-level GLM for each participant by convolving - the event onsets with the specific subset of RFs, and extracted estimates - of the response amplitudes for each RF and condition from the continuous - heart period data. - In order to qualify as RF, parameter estimates for this RF were either - required to depict a stable response (i.e., acceleration or deceleration) - across all experiments, tested by a one-sample t-test, or to add to the - + Specifically, + we created a first-level GLM for each participant by convolving the event onsets with the specific subset of RFs, + and extracted estimates of the response amplitudes for each RF and condition from the continuous heart period data. + In order to qualify as RF, + parameter estimates for this RF were either required to depict a stable response (i.e., + acceleration or deceleration) across all experiments, + tested by a one-sample t-test, + or to add to the \shape italic -predictive validity +retrodictive validity \shape default of the model. - This second criterion was evaluated by subjecting the parameter estimates - to a between-subject analysis of variance (ANOVA) testing for a main effect - of experimental condition. + This second criterion was evaluated by subjecting the parameter estimates to a between-subject analysis of variance (ANOVA) testing for a main effect of experimental condition. \begin_inset Newline newline \end_inset - Hence, the following steps were taken: + Hence, + the following steps were taken: + \begin_inset Newline newline \end_inset @@ -2814,9 +2939,7 @@ predictive validity Step 1. \series default - Test all potential RFs modeled from PCs individually and retain each single - RF if it depicts a stable acceleration or deceleration across all experiments - or if it allows separation of at least two of the three experiments. + Test all potential RFs modeled from PCs individually and retain each single RF if it depicts a stable acceleration or deceleration across all experiments or if it allows separation of at least two of the three experiments. All potential RFs fulfilled one of these criteria. \begin_inset Newline newline @@ -2832,12 +2955,11 @@ Step 1. Step 2. \series default - Take the chronologically first RF from Step 1 and combine it with the chronolog -ically second RF from Step 1, or with any other RF that overlaps with this - second RF. - Orthogonalize each set in temporal order, using a Gram-Schmidt algorithm. - Retain the best set if additional RFs allow the separation of the three - experiments. + Take the chronologically first RF from Step 1 and combine it with the chronologically second RF from Step 1, + or with any other RF that overlaps with this second RF. + Orthogonalize each set in temporal order, + using a Gram-Schmidt algorithm. + Retain the best set if additional RFs allow the separation of the three experiments. \begin_inset Newline newline \end_inset @@ -2852,10 +2974,11 @@ ically second RF from Step 1, or with any other RF that overlaps with this Step 3-5. \series default - Take the current set, and add the chronologically next untested RF from - Step 1, or any other RF that overlaps in time with this second RF. - Repeat the strategy of Step 2, and retain the best set if additional RFs - allow the separation of the three experiments. + Take the current set, + and add the chronologically next untested RF from Step 1, + or any other RF that overlaps in time with this second RF. + Repeat the strategy of Step 2, + and retain the best set if additional RFs allow the separation of the three experiments. \begin_inset Newline newline \end_inset @@ -2865,6 +2988,7 @@ Step 3-5. \begin_inset CommandInset ref LatexCommand ref reference "tab:model_constants_HPR" +nolink "false" \end_inset @@ -2873,8 +2997,7 @@ reference "tab:model_constants_HPR" \begin_inset Newline newline \end_inset - In an independent model-validation experiment with short ISI (10 s) that - used white-noise sounds of varying intensities ( + In an independent model-validation experiment with short ISI (10 s) that used white-noise sounds of varying intensities ( \begin_inset Formula $\sim$ \end_inset @@ -2883,8 +3006,8 @@ reference "tab:model_constants_HPR" \begin_inset Formula $\sim$ \end_inset -65 dB) and both negative and positive pictures from the International Affective - Picture System (IAPS; +65 dB) and both negative and positive pictures from the International Affective Picture System (IAPS; + \begin_inset CommandInset citation LatexCommand cite key "Bradley:2001" @@ -2892,24 +3015,21 @@ literal "true" \end_inset -), the following RFs allowed separation of the different experimental conditions -: +), + the following RFs allowed separation of the different experimental conditions: \begin_inset Newline newline \end_inset - RF1 allowed the discrimination of 85 dB white-noise sounds and IAPS pictures + RF1 allowed the discrimination of 85 dB white-noise sounds and IAPS pictures as well as Positive and Negative IAPS pictures. + RF2 allowed the discrimination of 85 dB and 65 dB white-noise sounds, as well as Positive and Negative IAPS pictures. - RF2 allowed the discrimination of 85 dB and 65 dB white-noise sounds, as - well as Positive and Negative IAPS pictures. RF3 allowed the discrimination of Negative and Positive IAPS pictures. - RF4 did not allow discrimination of any experimental conditions in the - validation experiment, but showed a trend to significance for the discriminatio -n of 85 dB white-noise sounds and IAPS pictures ( + RF4 did not allow discrimination of any experimental conditions in the validation experiment, + but showed a trend to significance for the discrimination of 85 dB white-noise sounds and IAPS pictures ( \begin_inset Formula $p=.051$ \end_inset -) and a trend for discrimination of Positive and Negative IAPS pictures - ( +) and a trend for discrimination of Positive and Negative IAPS pictures ( \begin_inset Formula $p=.068$ \end_inset @@ -2920,6 +3040,7 @@ n of 85 dB white-noise sounds and IAPS pictures ( \noindent \begin_inset Float table placement t +alignment document wide false sideways false status open @@ -3199,7 +3320,8 @@ Note. \begin_inset Formula $\mu=$ \end_inset -mean; +mean; + \begin_inset Formula $\sigma=$ \end_inset @@ -3275,10 +3397,9 @@ name "tab:model_constants_HPR" \end_layout \begin_layout Standard -Because the data are interpolated, apparent responses to stimuli can start - before stimulus presentation. - This is evident in these RFs some of which overlap time point 0 and therefore - start before the actual stimulus. +Because the data are interpolated, + apparent responses to stimuli can start before stimulus presentation. + This is evident in these RFs some of which overlap time point 0 and therefore start before the actual stimulus. In PsPM this phenomenon is automatically accounted for. \end_layout @@ -3289,8 +3410,8 @@ Model for fear-conditioned HPR \begin_layout Standard \color black -For the analysis of fear conditioned HPR, we sought to build a data-driven - RF for discriminating between HPR to CS+ and CS- +For the analysis of fear-conditioned HPR, + we sought to build a data-driven RF for discriminating between HPR to CS+ and CS- \begin_inset CommandInset citation LatexCommand cite key "Castegnetti:2016aa" @@ -3299,17 +3420,14 @@ literal "true" \end_inset . - This model-based analysis was developed on the basis of four independent - data sets, acquired during diverse implementations of a fear conditioning - protocol. - The shape of the response was determined by visually identifying a gamma - distribution as the function that qualitatively best resembled the difference - between grand means. + This model-based analysis was developed on the basis of four independent data sets, + acquired during diverse implementations of a fear conditioning protocol. + The shape of the response was determined by visually identifying a gamma distribution as the function that qualitatively best resembled the difference between grand means. This function \begin_inset Formula -\[ -y=\frac{A}{\Theta^{k}\Gamma(k)}(x-x_{0})^{k-1}e^{-\frac{x-x_{0}}{\Theta}} -\] +\begin{equation} +y=\frac{A}{\theta^{k}\Gamma(k)}(x-x_{0})^{k-1}e^{-\frac{x-x_{0}}{\Theta}}\label{eq:gamma} +\end{equation} \end_inset @@ -3323,7 +3441,39 @@ was fitted it by finding the values of the shape parameter \begin_inset Formula $k$ \end_inset -, the scale parameter Θ, the time onset +, + the scale parameter +\family roman +\series medium +\shape up +\size normal +\emph off +\bar no +\strikeout off +\xout off +\uuline off +\uwave off +\noun off +\color none + +\begin_inset Formula $\theta$ +\end_inset + + +\family default +\series default +\shape default +\size default +\emph default +\bar default +\strikeout default +\xout default +\uuline default +\uwave default +\noun default +\color black +, + the time onset \begin_inset Formula $x_{0}$ \end_inset @@ -3338,23 +3488,27 @@ was fitted it by finding the values of the shape parameter \begin_inset Formula $k=1373$ \end_inset -, -\begin_inset Formula $\Theta=0.0311$ +, + +\begin_inset Formula $\theta=0.0311$ \end_inset -, +, + \begin_inset Formula $x_{0}=-38$ \end_inset -, with +, + with \begin_inset Formula $A$ \end_inset left free to vary during the model inversion. Shifts in the response are modelled by its first time derivative. - The ensuing model-based analysis reliably distinguishes HPR to CS+ and - CS-, and does so significantly better than model-free analogues (e.g., peak - scoring, area under the curve). + The ensuing model-based analysis reliably distinguishes HPR to CS+ and CS-, + and does so significantly better than model-free analogues (e.g., + peak scoring, + area under the curve). \end_layout \begin_layout Subsubsection @@ -3362,15 +3516,16 @@ Adaptation to different SOAs \end_layout \begin_layout Standard -By considering fear conditioning sessions with different SOAs between CS - and US, we investigated how this changes the anticipatory response. - Our analysis suggested that for different SOAs the anticipatory HPR is - time-locked to the US, with no changes in shape. - This can be modelled by time-locking the RF (developed for 3.5 s) to the - US. - In PsPM, the default SOA is 3.5 s, and it can be modified to assume any - positive value. - However, we recommend not using SOAs shorter than 2 s. +By considering fear conditioning sessions with different SOAs between CS and US, + we investigated how this changes the anticipatory response. + Our analysis suggested that for different SOAs the anticipatory HPR is time-locked to the US, + with no changes in shape. + This can be modelled by time-locking the RF (developed for 3.5 s) to the US. + In PsPM, + the default SOA is 3.5 s, + and it can be modified to assume any positive value. + However, + we recommend not using SOAs shorter than 2 s. This procedure has been successfully tested with SOAs of 4 \begin_inset CommandInset citation LatexCommand cite @@ -3390,12 +3545,65 @@ literal "true" . \end_layout +\begin_layout Subsection +Model for reward-conditioned HPR +\end_layout + +\begin_layout Standard +For analysis of reward-conditioned HPR with an SOA of 5 s, + we built a response function on an exploration data set and validated it on a confirmation data set +\begin_inset CommandInset citation +LatexCommand cite +key "xia_liu:2024" +literal "false" + +\end_inset + +. + The RF caputured responses observed during acqusition, + as well as during retention 7 days later. + The RF implemented in PsPM was updated on the combined data set. + Parameters for eq. + ( +\begin_inset CommandInset ref +LatexCommand ref +reference "eq:gamma" +plural "false" +caps "false" +noprefix "false" +nolink "false" + +\end_inset + +) were estimated as +\begin_inset Formula $k=171.6$ +\end_inset + +, + +\begin_inset Formula $\theta=0.1400$ +\end_inset + +, + +\begin_inset Formula $x_{0}=-17.60$ +\end_inset + +, + with +\begin_inset Formula $A$ +\end_inset + + left free to vary during the model inversion. + +\end_layout + \begin_layout Subsection Data Conditioning \end_layout \begin_layout Subsubsection -QRS detection +Heart beat detection \begin_inset CommandInset label LatexCommand label name "subsec:QRS-detection" @@ -3415,57 +3623,39 @@ literal "true" \end_inset QRS detection algorithm. - The algorithm analyses slope, amplitude, and width of QRS complexes. - It uses digital band-pass filters to reduce noise and its thresholds are - periodically adjusted to low values. + The algorithm analyses slope, + amplitude, + and width of QRS complexes. + It uses digital band-pass filters to reduce noise and its thresholds are periodically adjusted to low values. The algorithm works best on data with a time-resolution of 200 Hz. - Data with higher sampling rate will automatically be downsampled to the - optimal time-resolution. - The QRS complex is marked at the rising edge of the integrated waveform - signal that usually corresponds well with the position of the R-spike of - the ECG. + Data with higher sampling rate will automatically be downsampled to the optimal time-resolution. + The QRS complex is marked at the rising edge of the integrated waveform signal that usually corresponds well with the position of the R-spike of the ECG. \begin_inset Newline newline \end_inset - For the offline version of the Pan & Tompkins QRS detection algorithm some - adjustments were made: + For the offline version of the Pan & Tompkins QRS detection algorithm some adjustments were made: + \end_layout \begin_layout Itemize -The originally used cascaded integer filters were replaced by a second order - Butterworth filter that approximates the desired passband from 5 to 15 - Hz better than the original filters. +The originally used cascaded integer filters were replaced by a second order Butterworth filter that approximates the desired passband from 5 to 15 Hz better than the original filters. \end_layout \begin_layout Itemize -To increase detection accuracy heart rate values were restricted to the - interval of 20 bpm (IBI of 3000 ms) to 300 bpm (IBI of 300 ms). +To increase detection accuracy heart rate values were restricted to the interval of 20 bpm (IBI of 3000 ms) to 300 bpm (IBI of 300 ms). \end_layout \begin_layout Itemize -To allow for a manual inspection and possible correction of detection failures - QRS detection procedure also containes a tool to visually inspect the results - of QRS detection (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:ECG-editor" - -\end_inset - -). - In order to manually check only those QRS complexes that are likely to - be wrong, only those IBIs are checked that fall outside a user-defined - range. - To avoid the introduction of bias, the rater should blind to the experimental - conditions during manual correction of the QRS detection. +To allow for a manual inspection and possible correction of detection failures, + the ECG editor allows visually inspecting the results of QRS detection. \end_layout \begin_layout Standard -Depending on the quality of the recordings QRS detection can achieve a very - high accuracy in detecting QRS complexes of up to 99.66% +Depending on the quality of the recordings, + QRS detection can achieve a very high accuracy in detecting QRS complexes of up to 99.66% \begin_inset CommandInset citation LatexCommand cite key "Paulus:2016aa" @@ -3476,11 +3666,10 @@ literal "true" . \end_layout -\begin_layout Paragraph +\begin_layout Standard \series medium -PsPM also offers a QRS detection algorithm for ECG data acquired in MRI - environments. +PsPM also contains a QRS detection algorithm for ECG data acquired in MRI environments. The algorithm is described in \begin_inset CommandInset citation LatexCommand cite @@ -3491,6 +3680,27 @@ literal "false" . The implementation is obtained from the software link given in the paper. + +\series default +To process pulse oxymetry data, + PsPM contains a template matching algorithm +\begin_inset CommandInset citation +LatexCommand cite +key "Castegnetti:2016aa" +literal "true" + +\end_inset + + and an interface to the HeartPy toolbox +\begin_inset CommandInset citation +LatexCommand cite +key "Gent:2019aa" +literal "false" + +\end_inset + +. + \end_layout \begin_layout Subsubsection @@ -3505,23 +3715,19 @@ name "subsec:Interpolation-and-Filtering" \end_layout \begin_layout Standard -To transform the discontinuous heart-beat information into a continous signal - of heart-period, the heart-beat events are interpolated at a fixed sampling - rate of 10 Hz using the built-in function +To transform the discontinuous heart-beat information into a continuous signal of heart-period, + the heart-beat events are interpolated at a fixed sampling rate of 10 Hz using the built-in function \family typewriter pspm_hb2hp \family default . - The interpolation shifts some early evoked responses such that they appear - to start before an event - this is automatically being taken care of by - a response function that starts slightly before an event definition. + The interpolation shifts some early evoked responses such that they appear to start before an event - this is automatically being taken care of by a response function that starts slightly before an event definition. \begin_inset Newline newline \end_inset -Before obtaining parameter estimates for the individual response functions - the interpolated heart beat time-series is filtered with a second-order - Butterworth band-pass filter. - For evoked HPR, PsPM uses a pass band of 0.01-2 Hz +Before obtaining parameter estimates for the individual response functions the interpolated heart beat time-series is filtered with a second-order Butterworth band-pass filter. + For evoked HPR, + PsPM uses a pass band of 0.01-2 Hz \begin_inset CommandInset citation LatexCommand cite key "Paulus:2016aa" @@ -3530,8 +3736,8 @@ literal "true" \end_inset . - For fear-conditioned HPR, PsPM uses a 0.015-0.5 Hz bidirectional 4th order - Butterworth filter (cf. + For fear-conditioned HPR, + PsPM uses a 0.015-0.5 Hz bidirectional 4th order Butterworth filter (cf. \begin_inset CommandInset citation LatexCommand cite @@ -3548,33 +3754,40 @@ Recommendations \end_layout \begin_layout Itemize -Experimental design: +Experimental design: + \end_layout \begin_deeper \begin_layout Itemize -evoked HPR model: use only those RFs that peak within the SOA between subsequent - events that elicit an HPR. +evoked HPR model: + use only those RFs that peak within the SOA between subsequent events that elicit an HPR. A formal test of the linearity assumption has not been done yet. - Therefore, the number of RFs that can be applied depends upon the SOA. + Therefore, + the number of RFs that can be applied depends upon the SOA. \end_layout \begin_layout Itemize -fear-conditioned HPR: use default model for CS/US-SOAs between approximately - 2-8 s. +fear-conditioned HPR: + use default model for CS/US-SOAs between approximately 2-8 s. The model is tested for 3.5 - 6 s. \end_layout -\end_deeper \begin_layout Itemize -Model set up: +reward-conditioned HPR: + use default model for CS-US-SOA of around 5 s. + The model is tested for 5 s. +\end_layout + +\end_deeper +\begin_layout Itemize +Model set up: \end_layout \begin_deeper \begin_layout Itemize -Use default filter frequencies (0.01 - 2 Hz unidirectional 2nd order Butterworth - filter for evoked HPR +Use default filter frequencies (0.01 - 2 Hz unidirectional 2nd order Butterworth filter for evoked HPR \begin_inset CommandInset citation LatexCommand cite key "Paulus:2016aa" @@ -3582,8 +3795,22 @@ literal "true" \end_inset -; 0.015 - 0.5 Hz bidirectional 6th order Butterworth filter for fear-conditioned - HPR +; + 0.015 - 0.5 Hz bidirectional 6th order Butterworth filter for fear- and reward-conditioned HPR +\begin_inset CommandInset citation +LatexCommand cite +key "Castegnetti:2016aa,xia_liu:2024" +literal "true" + +\end_inset + +, + although there is apparently no strong impact of filter frequency. +\end_layout + +\begin_layout Itemize +Fear-conditioned HPR: + using first derivative and reconstructing response amplitude is more sensitive that using just the canonical RF \begin_inset CommandInset citation LatexCommand cite key "Castegnetti:2016aa" @@ -3591,7 +3818,7 @@ literal "true" \end_inset -, although there is apparently no strong impact of filter frequency. +. \end_layout \end_deeper @@ -3620,14 +3847,17 @@ literal "true" \end_inset -: Dilation (mydriasis) results from sympathetic inputs on the M. +: + Dilation (mydriasis) results from sympathetic inputs on the M. dilatator pupillae. Constriction (miosis) results from parasympathetic inputs on the M. sphincter pupillae. Pupil size reacts to changes in illuminance (light falling onto the eye, directly related to the luminance of screen presentations). - It also responds to many cognitive processes including attention, perception, - memory, and emotion (see + It also responds to many cognitive processes including attention, + perception, + memory, + and emotion (see \begin_inset CommandInset citation LatexCommand cite key "Korn:2016a" @@ -3636,9 +3866,8 @@ literal "true" \end_inset for references). - Such cognitive processes are supposed to be relayed via the Edinger-Westphal - nucleus and noradrenergic inputs into the locus coeruleus, among others - + Such cognitive processes are supposed to be relayed via the Edinger-Westphal nucleus and noradrenergic inputs into the locus coeruleus, + among others \begin_inset CommandInset citation LatexCommand cite key "McDougal:2008aa" @@ -3647,15 +3876,12 @@ literal "true" \end_inset . - On the basis of two experiments that elicited (il)luminance changes, we - have developed a model for steady state pupil size and, more importantly, + On the basis of two experiments that elicited (il)luminance changes, + we have developed a model for steady state pupil size and, + more importantly, an model for changes of pupil size that is based on two LTI systems. - These LTI systems can be harnessed to infer the neural input into the pupillary - system that is elicited by cognitive processes (under the assumption of - a common final pathway of (il)luminance-mediated inputs and cognitive inputs). - We have also developed and validated a specific LTI system that allows - distinguishing responses to CS+US- and CS- in fear-conditioning setups - employing different sensory modalities and timings + These LTI systems can be harnessed to infer the neural input into the pupillary system that is elicited by cognitive processes (under the assumption of a common final pathway of (il)luminance-mediated inputs and cognitive inputs). + We have also developed and validated a specific LTI system that allows distinguishing responses to CS+US- and CS- in fear-conditioning setups employing different sensory modalities and timings \begin_inset CommandInset citation LatexCommand cite key "Korn:2017a" @@ -3664,11 +3890,12 @@ literal "true" \end_inset . - In this latter model, neural and peripheral system are collapsed for the - purpose of quick and simple inversion with GLM (see + In this latter model, + neural and peripheral system are collapsed for the purpose of quick and simple inversion with GLM (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" +nolink "false" \end_inset @@ -3682,8 +3909,8 @@ Model for pupil size changes elicited by (il)luminance changes \begin_layout Standard The system controlling pupil size is non-linear. - To be able and use linear methods for analysis, PsPM splits the model into - several parts. + To be able and use linear methods for analysis, + PsPM splits the model into several parts. \end_layout @@ -3700,10 +3927,8 @@ An exponential function is used to relate illuminance (in \begin_inset Formula $\frac{cd}{m^{2}}$ \end_inset -) to steady-state pupil size (in arbitrary units as determined by the Eyelink - system or in mm). - These functions were specified on the basis of the first experiment described - in +) to steady-state pupil size (in arbitrary units as determined by the Eyelink system or in mm). + These functions were specified on the basis of the first experiment described in \begin_inset CommandInset citation LatexCommand cite key "Korn:2016a" @@ -3715,12 +3940,12 @@ literal "true" \begin_inset CommandInset ref LatexCommand ref reference "subsec:Prepare-illuminance-GLM" +nolink "false" \end_inset ). - The functional relationship should cover the (il)luminance range employed - in most cognitive experiments. + The functional relationship should cover the (il)luminance range employed in most cognitive experiments. \begin_inset Formula \[ @@ -3733,7 +3958,8 @@ d\text{(}E_{v}\text{)=}C\text{ +}A\exp(BE_{v}\text{)}. \end_layout \begin_layout Standard -Here, +Here, + \begin_inset Formula $d$ \end_inset @@ -3746,11 +3972,13 @@ Here, \end_inset ). - We obtained the following parameter values: + We obtained the following parameter values: + \begin_inset Formula $A=49.79$ \end_inset -; +; + \begin_inset Formula $B=-0.50$ \end_inset @@ -3758,15 +3986,15 @@ Here, \begin_inset Formula $[\frac{1}{lx}]$ \end_inset -; +; + \begin_inset Formula $C=-1.05$ \end_inset . - Whether the non-linearity occurs in the peripheral or neural system is - currently not known.An extension that is similar to our model within the - (il)luminance range specified in our experiments, but extends across a - wider range, can be found in + Whether the non-linearity occurs in the peripheral or neural system is currently not known.An extension that is similar to our model within the (il)luminance range specified in our experiments, + but extends across a wider range, + can be found in \begin_inset CommandInset citation LatexCommand cite key "Watson:2012aa" @@ -3782,12 +4010,10 @@ Model for pupil dilation/constriction \end_layout \begin_layout Standard -Dilations and constrictions differ in shape, and can thus not be modeled - by a single LTI system (which would assume that positive and negative changes - do not differ in shape but just in sign). - Hence, we identified a combination of two LTI systems that provide a good - approximation of pupil size changes elicited by (il)luminance changes (see - first two experiments in +Dilations and constrictions differ in shape, + and can thus not be modeled by a single LTI system (which would assume that positive and negative changes do not differ in shape but just in sign). + Hence, + we identified a combination of two LTI systems that provide a good approximation of pupil size changes elicited by (il)luminance changes (see first two experiments in \begin_inset CommandInset citation LatexCommand cite key "Korn:2016a" @@ -3796,12 +4022,9 @@ literal "true" \end_inset ). - The first LTI-system describes changes to continuous (il)luminace inputs - and the second LTI-system models the difference between constriction and - dilation. + The first LTI-system describes changes to continuous (il)luminace inputs and the second LTI-system models the difference between constriction and dilation. The second system thus receives a brief input for any increase in (il)luminance. - Both systems are specified by canonical response functions that take the - form of gamma probability density functions. + Both systems are specified by canonical response functions that take the form of gamma probability density functions. \end_layout @@ -3821,23 +4044,28 @@ where \begin_inset Formula $d$ \end_inset - is the z-scored steady-state pupil diameter, + is the z-scored steady-state pupil diameter, + \begin_inset Formula $t$ \end_inset - is time, + is time, + \begin_inset Formula $\varGamma$ \end_inset - is the gamma function, and + is the gamma function, + and \begin_inset Formula $k$ \end_inset -, +, + \begin_inset Formula $\theta$ \end_inset -, +, + \begin_inset Formula $c$ \end_inset @@ -3846,38 +4074,47 @@ and \end_inset are free parameters. - The fitted parameter values were: System 1: + The fitted parameter values were: + System 1: + \begin_inset Formula $k=2.40$ \end_inset -, +, + \begin_inset Formula $\theta=0.29s^{-1}$ \end_inset -, +, + \begin_inset Formula $c=0.77$ \end_inset -; System 2: +; + System 2: + \begin_inset Formula $k=3.24$ \end_inset -, +, + \begin_inset Formula $\theta=0.18s^{-1}$ \end_inset -, +, + \begin_inset Formula $c=0.43$ \end_inset . - Since the latency of the empirical responses was around 200 ms, + Since the latency of the empirical responses was around 200 ms, + \begin_inset Formula $t0$ \end_inset was set to 200 ms prior to fitting. - (We also modelled the first system with a Gaussian smoothed biexponential - function; + (We also modelled the first system with a Gaussian smoothed biexponential function; + \begin_inset Formula $d\text{(}t)=aN(t)*(E_{1}(t)+E_{2}(t));$ \end_inset @@ -3885,7 +4122,8 @@ and \begin_inset Formula $*$ \end_inset - is the convolution operator; + is the convolution operator; + \begin_inset Formula $N(t)$ \end_inset @@ -3905,19 +4143,24 @@ and \begin_inset Formula $E(t)=\exp(-\lambda t)$ \end_inset -; parameter values: +; + parameter values: + \begin_inset Formula $\sigma=0.27$ \end_inset -, +, + \begin_inset Formula $\lambda_{1}=2.04s^{-1}$ \end_inset -, +, + \begin_inset Formula $\lambda_{2}=1.48s^{-1}$ \end_inset -, +, + \begin_inset Formula $a=0.004$ \end_inset @@ -3925,27 +4168,19 @@ and \end_layout \begin_layout Standard -In GLM-based analyses, these systems explain considerable variance in pupil - size time series in two experiments with (il)luminance inputs of long and - short duration (with the second LTI system being particularly relevant - for brief, i.e., sub-second, inputs). - The modeled pupil size time series can be easily specified given a time - series of (il)luminance values (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Prepare-illuminance-GLM" - -\end_inset - -). +In GLM-based analyses, + these systems explain considerable variance in pupil size time series in two experiments with (il)luminance inputs of long and short duration (with the second LTI system being particularly relevant for brief, + i.e., + sub-second, + inputs). + The modeled pupil size time series can be easily specified given a time series of (il)luminance values. These time series can be used as nuisance regressors in GLMs. - Because the end stage of the pupil system does not depend on where the - neural input comes from, the specified canonical response functions can - also be used to estimate the shape (i.e., the temporal characteristics) of - likely inputs into the pupillary systems for cognitive tasks. - We provide examples for this for auditory oddball tasks with three different - timings, for an emotional words task, and for a visual detection task (see - + Because the end stage of the pupil system does not depend on where the neural input comes from, + the specified canonical response functions can also be used to estimate the shape (i.e., + the temporal characteristics) of likely inputs into the pupillary systems for cognitive tasks. + We provide examples for this for auditory oddball tasks with three different timings, + for an emotional words task, + and for a visual detection task (see \begin_inset CommandInset citation LatexCommand cite key "Korn:2016a" @@ -3962,11 +4197,12 @@ Model for pupil size changes elicited by fear conditioning \end_layout \begin_layout Standard -This model collapses peripheral and neural processes into one RF, in order - to use GLM for the inversion. +This model collapses peripheral and neural processes into one RF, + in order to use GLM for the inversion. On the basis of four experiments employing simple and complex auditory, - visual, and somatosensory CS, we have determined a canonical response function - that reliably distinguishes pupil responses to CS+US- and CS- + visual, + and somatosensory CS, + we have determined a canonical response function that reliably distinguishes pupil responses to CS+US- and CS- \begin_inset CommandInset citation LatexCommand cite key "Korn:2017a" @@ -3975,39 +4211,30 @@ literal "true" \end_inset . - Predictive validity exceeds (or is at least equal to) peak scoring and - calculating the area-under-the-curve. - The response function was initially based on a CS to US SOA of 3.5 s but - the same function can be used for an SOA of 6 s. - The overall best performing model did not include the temporal derivative - but this is still accessible in PsPM. - See: -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:GLM-for-fear-conditioned" - -\end_inset - -. - The gamma probability density function followed the same form specified - above with the parameter values -\begin_inset Formula $k=6.03$ + Retrodictive validity exceeds (or is at least equal to) peak scoring and calculating the area-under-the-curve. + The response function was initially based on a CS to US SOA of 3.5 s but the same function can be used for an SOA of 6 s. + The overall best performing model did not include the temporal derivative but this is still accessible in PsPM. + The gamma probability density function followed the same form specified above with the parameter values +\begin_inset Formula $k=5.94$ \end_inset -, -\begin_inset Formula $\theta=0.73s^{-1}$ +, + +\begin_inset Formula $\theta=0.75s^{-1}$ \end_inset -, -\begin_inset Formula $c=1.6$ +, + +\begin_inset Formula $c=1.7$ \end_inset -, -\begin_inset Formula $t0=0.029$ +, + +\begin_inset Formula $t_{0}=0.002$ \end_inset ( -\begin_inset Formula $t0$ +\begin_inset Formula $t_{0}$ \end_inset was fitted for this model). @@ -4018,25 +4245,24 @@ Data preconditioning \end_layout \begin_layout Standard -We provide procedures to import pupil data from Eyelink, SMI and ViewPoint - files, but they can also be imported from other sources via matlab or text - files. +We provide procedures to import pupil data from Eyelink, + SMI and ViewPoint files, + but they can also be imported from other sources via matlab or text files. All PsPM models specify pupil diameter. - Eyelink import automatically converts input into diameter in absolute units - (mm). + Eyelink import automatically converts input into diameter in absolute units (mm). SMI diameter values are returned in pixel values. - ViewPoint diameter values are returned in ratio units as they are given - in the data file. - For other sources it may be necessary to convert the data using the respective - conversion function. - Missing data due to blinks, saccades, or slight head movements can be linearly - interpolated before z-scoring. - These missing data can then be retained, or not, for the GLM. + ViewPoint diameter values are returned in ratio units as they are given in the data file. + For other sources it may be necessary to convert the data using the respective conversion function. + Missing data due to blinks, + saccades, + or slight head movements can be linearly interpolated before z-scoring. + These missing data can then be retained, + or not, + for the GLM. \end_layout \begin_layout Standard -Pupil area appears smaller to the eyetracking camera when the participant - does not maintain fixation. +Pupil area appears smaller to the eyetracking camera when the participant does not maintain fixation. Whether this \begin_inset Quotes eld \end_inset @@ -4046,17 +4272,20 @@ Pupil foreshortening error \end_inset (PFE) influences recordings depends on the eyetracker. - Geometrically, it would be possible to fit the visible pupil shape with - an ellipse and retain the long axis as pupil diameter, which is invariant - to eye movements. - However, apparently many eyetrackers simply report the number of pupil - pixels, ie. + Geometrically, + it would be possible to fit the visible pupil shape with an ellipse and retain the long axis as pupil diameter, + which is invariant to eye movements. + However, + apparently many eyetrackers simply report the number of pupil pixels, + ie. an area measure. - For example, although the Eyelink 1000 eyetracker has the possibility to - choose an ellipsoid model, this is according to the manual (User Manual. - v.1.4.0, p. - 23) only used to determine pupil position, but not pupil area or diameter - ( + For example, + although the Eyelink 1000 eyetracker has the possibility to choose an ellipsoid model, + this is according to the manual (User Manual. + v.1.4.0, + p. + 23) only used to determine pupil position, + but not pupil area or diameter ( \begin_inset Quotes eld \end_inset @@ -4069,23 +4298,16 @@ Measure of Area or Diameter are always based on the Centroid Model \end_layout \begin_layout Standard -To account for loss of fixation, PsPM includes two options: exclude these - time intervals, or correct pupil size with a geometric model. - (1) To detect loss of fixation there is a specific function (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Find-valid-fixations" - -\end_inset - -). - The user has to specify the distance between screen and eye, the screen - size, the position of the fixation point (by default the middle of the - screen is assumed but additionally a time series of fixation points can - be specified), and the threshold for exclusion set in degrees of visual - angle. - (2) PsPM also includes a method to perform pupil foreshortening error (PFE) - correction as described in +To account for loss of fixation, + PsPM includes two options: + exclude these time intervals, + or correct pupil size with a geometric model. + (1) To detect loss of fixation there is a specific function . + The user has to specify the distance between screen and eye, + the screen size, + the position of the fixation point (by default the middle of the screen is assumed but additionally a time series of fixation points can be specified), + and the threshold for exclusion set in degrees of visual angle. + (2) PsPM also includes a method to perform pupil foreshortening error (PFE) correction as described in \begin_inset CommandInset citation LatexCommand cite key "Hayes:2015a" @@ -4095,20 +4317,20 @@ literal "false" . The implementation itself is eyetracker or measurement method independent; - however, we use Eyelink in its name because the method was proposed specificall -y for Eyelink 1000 eyetracker. - To perform PFE correction, PsPM requires extra information about the recording - setup. - Specifically, screen resolution, screen size and the screen-camera-eye - geometry setup must be known. + however, + we use Eyelink in its name because the method was proposed specifically for Eyelink 1000 eyetracker. + To perform PFE correction, + PsPM requires extra information about the recording setup. + Specifically, + screen resolution, + screen size and the screen-camera-eye geometry setup must be known. \end_layout \begin_layout Standard Pupil size obtained using eyetrackers may be contaminated with high noise. - Before using this data in various statistical models, it might be beneficial - to preprocess it in order to increase signal-to-noise ratio. - PsPM offers a pupil size preprocessing utility that is independent of the - eyetracker used. + Before using this data in various statistical models, + it might be beneficial to preprocess it in order to increase signal-to-noise ratio. + PsPM offers a pupil size preprocessing utility that is independent of the eyetracker used. The method is described in \begin_inset CommandInset citation LatexCommand cite @@ -4120,18 +4342,65 @@ literal "false" . We use a modified version of the software published in this paper. All the modifications are documented and the changelog is part of PsPM. - The preprocessing method can be used without any additional information - about the recording setup. - PsPM exposes all the preprocessing parameters used by the underlying software - to the user for finetuning. + The preprocessing method can be used without any additional information about the recording setup. + PsPM exposes all the preprocessing parameters used by the underlying software to the user for finetuning. \end_layout \begin_layout Standard -Finally, we found that filtering provided equal or worse proportions of - explained variance and therefore there is no default filtering although - this may be beneficial for other experimental designs. +Finally, + we found that filtering provided equal or worse proportions of explained variance and therefore there is no default filtering although this may be beneficial for other experimental designs. +\end_layout + +\begin_layout Subsection +Recommendations +\end_layout + +\begin_layout Itemize +Experimental design: + +\end_layout + +\begin_deeper +\begin_layout Itemize +fear-conditioned PSR: + use default model for CS/US-SOAs between approximately 2-8 s. + The model is tested for 3.5 - 6 s. + +\end_layout + +\end_deeper +\begin_layout Itemize +Model set up: +\end_layout + +\begin_deeper +\begin_layout Itemize +fear-conditioned PSR: + use no filter +\begin_inset CommandInset citation +LatexCommand cite +key "Korn:2017a" +literal "true" + +\end_inset + + +\end_layout + +\begin_layout Itemize +fear-conditioned PSR: + use no derivative +\begin_inset CommandInset citation +LatexCommand cite +key "Korn:2017a" +literal "true" + +\end_inset + + \end_layout +\end_deeper \begin_layout Section Respiratory response models \end_layout @@ -4159,13 +4428,13 @@ literal "true" . This may allow inferring psychological states from measured respiration, - although it is not very well know which psychological variables or events - elicit phasic respiratory responses. - PsPM implements four models for respiratory responses, derived from a single - chest belt system. - In principle, this system only allows assessing respiration period, while - for precise quantification of respiratory amplitude, a double-belt system - would be required to measure both thoracic and abdominal compartments + although it is not very well know which psychological variables or events elicit phasic respiratory responses. + PsPM implements four models for respiratory responses, + derived from a single chest belt system. + In principle, + this system only allows assessing respiration period, + while for precise quantification of respiratory amplitude, + a double-belt system would be required to measure both thoracic and abdominal compartments \begin_inset CommandInset citation LatexCommand cite key "Binks:2006aa" @@ -4174,9 +4443,9 @@ literal "true" \end_inset . - However, if the ratio between thoracic and abdominal contribution is relatively - constant within any individual, it may still be possible to approximate - respiratory amplitude up to a linear constant from the single-belt system. + However, + if the ratio between thoracic and abdominal contribution is relatively constant within any individual, + it may still be possible to approximate respiratory amplitude up to a linear constant from the single-belt system. We confirmed in \begin_inset CommandInset citation LatexCommand cite @@ -4185,16 +4454,16 @@ literal "true" \end_inset - that respiration amplitude from a single chest belt system can be usefully - analysed. - PsPM considers the following measures: + that respiration amplitude from a single chest belt system can be usefully analysed. + PsPM considers the following measures: + \end_layout \begin_layout Itemize Respiration period (RP) is the duration of a breathing cycle. - PsPM models RP rather than the more common respiration rate, its inverse, - in analogy to analysis of event-related cardiac responses where heart period - has been shown to linearly relate to autonomic nervous system input + PsPM models RP rather than the more common respiration rate, + its inverse, + in analogy to analysis of event-related cardiac responses where heart period has been shown to linearly relate to autonomic nervous system input \begin_inset CommandInset citation LatexCommand cite key "Berntson:1995" @@ -4206,8 +4475,8 @@ literal "true" \end_layout \begin_layout Itemize -Respiration amplitude (RA) is the amplitude in rib cage excursion on that - cycle, which linearly relates to current tidal volume (VT) +Respiration amplitude (RA) is the amplitude in rib cage excursion on that cycle, + which linearly relates to current tidal volume (VT) \begin_inset CommandInset citation LatexCommand cite key "Binks:2006aa" @@ -4220,17 +4489,20 @@ literal "true" \end_layout \begin_layout Itemize -Respiration flowrate (RFR), RA/RP, which is linearly related to tidal volumetric - flow rate, i.e. +Respiration flowrate (RFR), + RA/RP, + which is linearly related to tidal volumetric flow rate, + i.e. tidal volume per time unit. RFR is computed per cycle with variable duration. - Otherwise it is similar to minute volume, or RLL (respiration line length), + Otherwise it is similar to minute volume, + or RLL (respiration line length), which are computed over fixed intervals rather than respiratory cycles. \end_layout \begin_layout Standard -In these measures, we identified the following pattern of phasic responses - +In these measures, + we identified the following pattern of phasic responses \begin_inset CommandInset citation LatexCommand cite key "Bach:2016aa" @@ -4242,24 +4514,23 @@ literal "true" \end_layout \begin_layout Itemize -Respiratory period responses (RPR) are elicited by various external events - (aversive sounds, electric shocks, picture viewing, visual detection) and - reliably distinguish events from non-events +Respiratory period responses (RPR) are elicited by various external events (aversive sounds, + electric shocks, + picture viewing, + visual detection) and reliably distinguish events from non-events \end_layout \begin_layout Itemize -Respiratory amplitude responses (RAR) are elicited by aversive sounds and - shocks, and by picture viewing. - Response amplitudes are smaller for picture viewing (including aversive - pictures) than aversive sounds. +Respiratory amplitude responses (RAR) are elicited by aversive sounds and shocks, + and by picture viewing. + Response amplitudes are smaller for picture viewing (including aversive pictures) than aversive sounds. RAR are also elicited by fear-conditioned stimuli. \end_layout \begin_layout Itemize -Respiratory flow-rate responses (RFRR) are elicited by aversive sounds and - shocks, and by picture viewing. - Response amplitudes are smaller for picture viewing (including aversive - pictures). +Respiratory flow-rate responses (RFRR) are elicited by aversive sounds and shocks, + and by picture viewing. + Response amplitudes are smaller for picture viewing (including aversive pictures). \end_layout @@ -4268,20 +4539,20 @@ Peripheral and neural model \end_layout \begin_layout Standard -In the absence of information on the timecourse of input into breathing - control, it is difficult to separate a neural and a peripheral model. - Hence, these two are collapsed for the purpose of quick and simple inversion - with GLM (see +In the absence of information on the timecourse of input into breathing control, + it is difficult to separate a neural and a peripheral model. + Hence, + these two are collapsed for the purpose of quick and simple inversion with GLM (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" +nolink "false" \end_inset ). - This means that the two implemented models for RAR - evoked RAR and fear-condit -ioned RAR - use a different RF, although of course the peripheral system - is the same in both cases. + This means that the two implemented models for RAR - evoked RAR and fear-conditioned RAR - use a different RF, + although of course the peripheral system is the same in both cases. \end_layout \begin_layout Subsection @@ -4289,11 +4560,12 @@ Models for evoked respiratory responses \end_layout \begin_layout Standard -These models are based on responses from 46 participants and on the following - task conditions: visual detection, aversive electric shocks, IAPS picture - viewing. - The model was validated on an independent sample of 20 participants and - the following task conditions: aversive and less aversive white noise sounds, +These models are based on responses from 46 participants and on the following task conditions: + visual detection, + aversive electric shocks, + IAPS picture viewing. + The model was validated on an independent sample of 20 participants and the following task conditions: + aversive and less aversive white noise sounds, positive and negative IAPS picture viewing. \end_layout @@ -4318,13 +4590,12 @@ Model constants after filter optimisation are summarised in table \begin_inset CommandInset ref LatexCommand ref reference "tab:model_constants-Resp" +nolink "false" \end_inset . - Later response components that were visually identified in the development - data set did not contribute to detecting overall responses or separating - experimental conditions. + Later response components that were visually identified in the development data set did not contribute to detecting overall responses or separating experimental conditions. Modelling the time derivative of the RF improved the RA and RFR models, but not the RP model \begin_inset CommandInset citation @@ -4341,6 +4612,7 @@ literal "true" \noindent \begin_inset Float table placement t +alignment document wide false sideways false status open @@ -4533,7 +4805,8 @@ Note. \begin_inset Formula $\mu=$ \end_inset - mean; + mean; + \begin_inset Formula $\sigma=$ \end_inset @@ -4613,8 +4886,7 @@ Model for fear-conditioned RAR \end_layout \begin_layout Standard -After showing that RAR may be better suited to distinguish cognitive processes - than respiration period +After showing that RAR may be better suited to distinguish cognitive processes than respiration period \begin_inset CommandInset citation LatexCommand cite key "Bach:2016aa" @@ -4622,8 +4894,8 @@ literal "true" \end_inset -, we investigated whether RAR allow assessment of fear memory in cued fear - conditioning. +, + we investigated whether RAR allow assessment of fear memory in cued fear conditioning. Following the same procedure as in \begin_inset CommandInset citation LatexCommand cite @@ -4632,10 +4904,11 @@ literal "true" \end_inset -, we built the RF from data collected during six experiments, involving - diverse stimuli and two types of breathing belts (bellows and cushion systems). - The ensuing winning model was the combination of an early and a late response - components, modelled by gamma distributions +, + we built the RF from data collected during six experiments, + involving diverse stimuli and two types of breathing belts (bellows and cushion systems). + The ensuing winning model was the combination of an early and a late response components, + modelled by gamma distributions \end_layout \begin_layout Standard @@ -4654,11 +4927,13 @@ with parameters \begin_inset Formula $k_{e}=2.570*10^{7}$ \end_inset -, +, + \begin_inset Formula $\Theta_{e}=3.124*10^{-4}$ \end_inset -, +, + \begin_inset Formula $x_{o,e}=-8.024*10^{3}$ \end_inset @@ -4666,26 +4941,32 @@ with parameters \begin_inset Formula $k_{l}=3.413$ \end_inset -, +, + \begin_inset Formula $\Theta_{l}=1.107$ \end_inset -, +, + \begin_inset Formula $x_{0,l}=7.583$ \end_inset -, respectively. - This method distinguishes RAR to CS+ and CS- better than model-free scoring - of RAR (e.g., peak scoring). - Compared to other measures of fear learning, RAR turn out to perform similar - to SCR, but are less sensitive than HPR. - By comparing CS/US SOAs of 3.5, 4, and 6 s, it is evident that the RAR are - most likely time locked to the US. - In the model, both components of the RF are shifted in time as a function - of the SOA. - To avoid deformation of the early RF due to violations of the linearity - assumptions, however, we recommend to use this method only with experiments - involving SOAs longer than 2.5 s. +, + respectively. + This method distinguishes RAR to CS+ and CS- better than model-free scoring of RAR (e.g., + peak scoring). + Compared to other measures of fear learning, + RAR turn out to perform similar to SCR, + but are less sensitive than HPR. + By comparing CS/US SOAs of 3.5, + 4, + and 6 s, + it is evident that the RAR are most likely time locked to the US. + In the model, + both components of the RF are shifted in time as a function of the SOA. + To avoid deformation of the early RF due to violations of the linearity assumptions, + however, + we recommend to use this method only with experiments involving SOAs longer than 2.5 s. \end_layout \begin_layout Subsection @@ -4708,21 +4989,22 @@ Bellows system \end_layout \begin_layout Standard -Transducer output is filtered offline with an anti-aliasing bidirectional - first-order Butterworth low-pass filter and a cut-offfrequency of 5 Hz. +Transducer output is filtered offline with an anti-aliasing bidirectional first-order Butterworth low-pass filter and a cut-offfrequency of 5 Hz. Data are then downsampled to 10 Hz resolution. - Respiration traces are mean-centred, filtered with a bidirectional Butterworth - band pass filter and cut-off frequencies of 0.01 Hz and 0.6 Hz, and median - filtered over 1 s. + Respiration traces are mean-centred, + filtered with a bidirectional Butterworth band pass filter and cut-off frequencies of 0.01 Hz and 0.6 Hz, + and median filtered over 1 s. A negative zero-crossing is taken as start of inspiration. - After each detected cycle, PsPM imposes a 1 s refractory period, to account - for residual signal noise with might cause several zero-crossings on the - same cycle. - In the validation data set, we compared this method to visual detection - as gold standard and found, for the automated method, a sensitivity of - 99.3%, and a positive predictive value of 99.5%. - For the time difference between visual and automated detection, we found - a median delay of 0.1 s and a standard deviation of 0.1 s + After each detected cycle, + PsPM imposes a 1 s refractory period, + to account for residual signal noise with might cause several zero-crossings on the same cycle. + In the validation data set, + we compared this method to visual detection as gold standard and found, + for the automated method, + a sensitivity of 99.3%, + and a positive predictive value of 99.5%. + For the time difference between visual and automated detection, + we found a median delay of 0.1 s and a standard deviation of 0.1 s \begin_inset CommandInset citation LatexCommand cite key "Bach:2016aa" @@ -4738,13 +5020,14 @@ Cushion system \end_layout \begin_layout Standard -For data obtained from the cushion/belt system, the above algorithm must - be adapted to account for the different response of cushion/belt system - to ventilator activity. - Specifically, we defined the onsets of the inspirations as the minima of - the respiratory trace. - Hence, the algorithm was adapted to extract zero crossings of the derivative - of the time series (i.e., the extrema), from which the positive ones (i.e., +For data obtained from the cushion/belt system, + the above algorithm must be adapted to account for the different response of cushion/belt system to ventilator activity. + Specifically, + we defined the onsets of the inspirations as the minima of the respiratory trace. + Hence, + the algorithm was adapted to extract zero crossings of the derivative of the time series (i.e., + the extrema), + from which the positive ones (i.e., the minima) were set as the start of the inspiration. \end_layout @@ -4760,13 +5043,11 @@ name "subsec:Interpolation-and-Filtering-Resp" \end_layout \begin_layout Standard -To transform the discontinuous RP, RA and RFR information into a continous - signal, they are assigned to the start of the following inspiration cycle - and linearly interpolated with 10 Hz sampling frequency. +To transform the discontinuous RP, + RA and RFR information into a continous signal, + they are assigned to the start of the following inspiration cycle and linearly interpolated with 10 Hz sampling frequency. PsPM also allows writing out the respiration time stamps for quality control. - The interpolation shifts some early evoked responses such that they appear - to start before an event - this is automatically being taken care of by - a response function that starts slightly before an event definition. + The interpolation shifts some early evoked responses such that they appear to start before an event - this is automatically being taken care of by a response function that starts slightly before an event definition. The best filter frequencies in \begin_inset CommandInset citation LatexCommand cite @@ -4775,9 +5056,10 @@ literal "true" \end_inset - were: 0.01-1 Hz for RP, 0.001-1 Hz for evoked RA and RFR. - For fear-conditioned RA a 0.01-2 Hz bidirectional 6th order Butterworth - filter provided the best results (cf. + were: + 0.01-1 Hz for RP, + 0.001-1 Hz for evoked RA and RFR. + For fear-conditioned RA a 0.01-2 Hz bidirectional 6th order Butterworth filter provided the best results (cf. \begin_inset CommandInset citation LatexCommand cite @@ -4794,22 +5076,22 @@ Recommendations \end_layout \begin_layout Itemize -Experimental design: +Experimental design: + \end_layout \begin_deeper \begin_layout Itemize -evoked respiratory response models: make sure the SOA between subsequent - events that elicit an respiratory response is longer than the peak of the - respective RF. +evoked respiratory response models: + make sure the SOA between subsequent events that elicit an respiratory response is longer than the peak of the respective RF. A formal test of the linearity assumption has not been done yet. \end_layout \begin_layout Itemize -fear-conditioned RAR: To avoid deformation of the early RF due to violations - of the linearity assumptions, we recommend to use this method only with - experiments involving SOAs longer than 2.5 s. +fear-conditioned RAR: + To avoid deformation of the early RF due to violations of the linearity assumptions, + we recommend to use this method only with experiments involving SOAs longer than 2.5 s. \end_layout \end_deeper @@ -4819,8 +5101,8 @@ Model set up: \begin_deeper \begin_layout Itemize -Use default filter frequencies (0.01-1 Hz for RP, 0.001-1 Hz for evoked RA - and RFR. +Use default filter frequencies (0.01-1 Hz for RP, + 0.001-1 Hz for evoked RA and RFR. 0.001-2 Hz for fear-conditioned RA.) \end_layout @@ -4834,10 +5116,11 @@ General \end_layout \begin_layout Standard -The startle response is a fast defensive reflex to an unexpected intense - auditory, visual, or haptic stimulus. - Functionally, it appears to protect an organism from an imminent blow to - the head +The startle response is a fast defensive reflex to an unexpected intense auditory, + visual, + or haptic stimulus. + Functionally, + it appears to protect an organism from an imminent blow to the head \begin_inset CommandInset citation LatexCommand cite key "Yeomans:2002aa" @@ -4846,8 +5129,7 @@ literal "true" \end_inset . - The human startle response encompasses a postural change and an eyeblink - response which is easy to measure + The human startle response encompasses a postural change and an eyeblink response which is easy to measure \color magenta \color inherit @@ -4860,11 +5142,10 @@ literal "true" \end_inset . - While the startle response itself is very stereotypical, its amplitude - is susceptible to various physiological and psychological manipulations, - many of which can be summarised in a decision-theoretic model in terms - of optimising the cost of the startle response, and of a putative predator - attack + While the startle response itself is very stereotypical, + its amplitude is susceptible to various physiological and psychological manipulations, + many of which can be summarised in a decision-theoretic model in terms of optimising the cost of the startle response, + and of a putative predator attack \color magenta \color black @@ -4877,9 +5158,9 @@ literal "true" \end_inset . - In this context, the most important phenomenon is fear-potentiated startle, - a stronger startle response during a CS+ than CS- in fear conditioning - + In this context, + the most important phenomenon is fear-potentiated startle, + a stronger startle response during a CS+ than CS- in fear conditioning \begin_inset CommandInset citation LatexCommand cite key "Brown:1951aa" @@ -4895,30 +5176,28 @@ Peripheral and neural model \end_layout \begin_layout Standard -In the absence of information on the millesecond-time course of neural response - in the centres controlling startle, it is difficult to separate a neural - and a peripheral model. - Hence, these two are collapsed for the purpose of quick and simple inversion - with GLM (see +In the absence of information on the millesecond-time course of neural response in the centres controlling startle, + it is difficult to separate a neural and a peripheral model. + Hence, + these two are collapsed for the purpose of quick and simple inversion with GLM (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" +nolink "false" \end_inset ). - Because the startle response is so stereotypical, the same RF is used for - all applications, and the amplitude estimated. - There appears to be some variability in the latency of the startle response - between trials and participants, such that the neural model contains a - (constrained) latency parameter that is estimated from the data. - The startle eye blink response function (SEBRF) is based on data from 19 - participants that heard startle sounds with no other manipulation. - Pre-processing parameters were optimised to distinguish CS+/CS- in a fear - retention task with 20 participants in which startle onsets were recorded - for enhanced temporal precision. - They were then validated on two independent samples of 15 and 14 participants - in a fear retention, and fear acquisition task, respectively. + Because the startle response is so stereotypical, + the same RF is used for all applications, + and the amplitude estimated. + There appears to be some variability in the latency of the startle response between trials and participants, + such that the neural model contains a (constrained) latency parameter that is estimated from the data. + The startle eye blink response function (SEBRF) is based on data from 19 participants that heard startle sounds with no other manipulation. + Pre-processing parameters were optimised to distinguish CS+/CS- in a fear retention task with 20 participants in which startle onsets were recorded for enhanced temporal precision. + They were then validated on two independent samples of 15 and 14 participants in a fear retention, + and fear acquisition task, + respectively. The SEBRF is described as a gamma distribution \end_layout @@ -4940,11 +5219,13 @@ with parameters \begin_inset Formula $k=3.5114$ \end_inset -, +, + \begin_inset Formula $\Theta=0.0108$ \end_inset -, +, + \begin_inset Formula $x_{o}=0.0345$ \end_inset @@ -4965,27 +5246,27 @@ Data preconditioning \begin_layout Standard The algorithm expects raw data from orbicularis oculi EMG. - Data filtering and preprocessing is taken care of by a separate PsPM function - (see + Data filtering and preprocessing is taken care of by a separate PsPM function (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:Preprocess-startle-eyeblink" +nolink "false" \end_inset -) and includes a 4th order Butterworth band-pass filter with cutoff frequency - of 50 Hz and 470 Hz, removal of mains noise with a 50 Hz notch filter. - Filtered continuous EMG signals are rectified and smoothed using a 4th - order Butterworth low-pass filter with a time constant of 3 ms corresponding - to a cutoff frequency of 53.05 Hz. - No more data pre-conditioning is applied during GLM inversion, which allows +) and includes a 4th order Butterworth band-pass filter with cutoff frequency of 50 Hz and 470 Hz, + removal of mains noise with a 50 Hz notch filter. + Filtered continuous EMG signals are rectified and smoothed using a 4th order Butterworth low-pass filter with a time constant of 3 ms corresponding to a cutoff frequency of 53.05 Hz. + No more data pre-conditioning is applied during GLM inversion, + which allows \color black to visually inspect the filtered EMG data in advance to the inversion. - To specify startle sound onsets with high precision, you can use the function - + To specify startle sound onsets with high precision, + you can use the function \begin_inset CommandInset ref LatexCommand ref reference "subsec:Preprocess-startle-eyeblink" +nolink "false" \end_inset @@ -4997,13 +5278,13 @@ Recommendations \end_layout \begin_layout Itemize -Experimental design: +Experimental design: + \end_layout \begin_deeper \begin_layout Itemize -record audio output from your startle equipment and use PsPM to detect sound - onsets +record audio output from your startle equipment and use PsPM to detect sound onsets \end_layout \end_deeper @@ -5023,8 +5304,8 @@ Model setup: \begin_deeper \begin_layout Itemize -model each trial as separate event type such that the response latency can - be estimated per trial, rather than per condition +model each trial as separate event type such that the response latency can be estimated per trial, + rather than per condition \end_layout \end_deeper @@ -5037,9 +5318,10 @@ General \end_layout \begin_layout Standard -Various salient stimuli, e.g. - threat-conditioned cues, capture overt attention in a bottom-up process - +Various salient stimuli, + e.g. + threat-conditioned cues, + capture overt attention in a bottom-up process \begin_inset CommandInset citation LatexCommand cite key "schutz:2011" @@ -5047,14 +5329,20 @@ literal "false" \end_inset -, as shown in multiple stimulus competition paradigms using aversive cues. +, + as shown in multiple stimulus competition paradigms using aversive cues. This yields a possibility to assess threat memory by overt attention. - In cue competition paradigms, overt attention is usually measured as gaze - patterns; for example, fixation duration, saccade initiation latency, and - number of erroneous saccades. - Here, we implement a model that captures gaze patterns during exclusive - presentation of a single cue, by assessing scanpath speed, the length of - scanpath per time unit, quantified as degree visual angle per second + In cue competition paradigms, + overt attention is usually measured as gaze patterns; + for example, + fixation duration, + saccade initiation latency, + and number of erroneous saccades. + Here, + we implement a model that captures gaze patterns during exclusive presentation of a single cue, + by assessing scanpath speed, + the length of scanpath per time unit, + quantified as degree visual angle per second \begin_inset CommandInset citation LatexCommand cite key "xia:2020" @@ -5063,11 +5351,11 @@ literal "false" \end_inset . - In our publication, we refer to scanpath length, which is the integral - of scanpath speed over time. - Since we used constant cue presentation times in our publication, average - scanpath speed and scanpath length were identical up to a multiplicative - constant. + In our publication, + we refer to scanpath length, + which is the integral of scanpath speed over time. + Since we used constant cue presentation times in our publication, + average scanpath speed and scanpath length were identical up to a multiplicative constant. \end_layout \begin_layout Subsection @@ -5075,23 +5363,21 @@ Model for fear-conditioned SPS \end_layout \begin_layout Standard -Scanpath speed/length allow differentiating CS+ and CS- in fear-conditioning - paradigms with visual cues, and without fixation instructions or fixation - cross. - PsPM implements two simple models that build on the GLM inversion algorithm - (see +Scanpath speed/length allow differentiating CS+ and CS- in fear-conditioning paradigms with visual cues, + and without fixation instructions or fixation cross. + PsPM implements two simple models that build on the GLM inversion algorithm (see \begin_inset CommandInset ref LatexCommand ref reference "subsec:General-linear-convolution" plural "false" caps "false" noprefix "false" +nolink "false" \end_inset ). - The first model is to compute average scanpath speed during a 2-s time - window before US (shock) delivery. + The first model is to compute average scanpath speed during a 2-s time window before US (shock) delivery. This was validated on three independent samples in \begin_inset CommandInset citation LatexCommand cite @@ -5101,16 +5387,14 @@ literal "false" \end_inset . - The model is implemented with a simple boxcar response function without - mean-centering and is the default option. + The model is implemented with a simple boxcar response function without mean-centering and is the default option. Parameter estimates can be interpreted as average scan path speed per second, - and if they are multiplied with 2 then the resulting values can be interpreted - as scan path length during the 2 s preceding the US. - We also implement a gamma RF that describes the shape of the scanpath speed - during the CS-US interval better than the boxcar function, but did not - yield higher retrodictive validity in inferring the CS-/+ difference. - This RF was fitted to the data of 21 participants and validated in an independe -nt sample; it is described by a gamma probability density function: + and if they are multiplied with 2 then the resulting values can be interpreted as scan path length during the 2 s preceding the US. + We also implement a gamma RF that describes the shape of the scanpath speed during the CS-US interval better than the boxcar function, + but did not yield higher retrodictive validity in inferring the CS-/+ difference. + This RF was fitted to the data of 21 participants and validated in an independent sample; + it is described by a gamma probability density function: + \begin_inset Formula \[ y=\frac{A}{\mu^{k}\Gamma(k)}(t-t_{0})^{k-1}e^{-\frac{t-t_{0}}{\mu}} @@ -5130,7 +5414,8 @@ literal "false" \end_inset -, where +, + where \begin_inset Formula $SOA$ \end_inset @@ -5144,12 +5429,14 @@ Data preconditioning \begin_layout Standard PsPM provides procedures to import scan path speed directly. - More commonly, it is convenient to import gaze coordinates in pixels, distance - units, or visual angle, and convert them to scanpath speed. + More commonly, + it is convenient to import gaze coordinates in pixels, + distance units, + or visual angle, + and convert them to scanpath speed. This requires interpolation of missing values which is done automatically. Conversion from pixels to mm or visual angle in degree is also possible. - No filtering or smoothing is required for both RF during model inversion - with GLM. + No filtering or smoothing is required for both RF during model inversion with GLM. \end_layout \begin_layout Subsection @@ -5186,286 +5473,157 @@ User Guide \end_layout \begin_layout Section -Installation -\end_layout - -\begin_layout Standard -You can find and download the PsPM package at the following URL: -\end_layout - -\begin_layout Standard -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -http://bachlab.org/pspm -\end_layout - -\end_inset - - +File types \end_layout \begin_layout Standard -Decompress and copy the files to any directory of your choice. - Then add the PsPM files to the Matlab search path by entering the following - command in the Matlab command line: +PsPM knows two file types: \end_layout -\begin_layout Standard - +\begin_layout Itemize +Data files - the original file name is prepended with 'pspm_' during import. + Various pre-processing steps prepend additonal letters to the name. + These files are loaded and saved with the function \family typewriter -addpath([your Matlab path]) +pspm_load_data \family default -where [your Matlab path] is a string of the file location on your hard drive, - e.g. - +. \end_layout -\begin_layout Standard - +\begin_layout Itemize +First-level model files - all models use a similar data structure. + The name can be freely specified by the user. + These files can also contain reconstructed responses in GLM. + These files are loaded and saved with the function \family typewriter -addpath(‘C: -\backslash -Program Files -\backslash -MATLAB -\backslash -R2013a -\backslash -toolbox -\backslash -PsPM -\backslash -’) +pspm_load1 \family default . - \end_layout -\begin_layout Standard -Do not add subfolders of the PsPM directory to the matlab path. +\begin_layout Section +Functions that create new data files \end_layout \begin_layout Standard -Type -\family typewriter -pspm -\family default - in the command line to start the package. - Alternatively, each function can be called individually from the command - line. - In that case, you can use -\family typewriter -pspm_init -\family default - to load the settings, and -\family typewriter -pspm_quit -\family default - to remove PsPM subfunctions from the path and delete the settings. - -\end_layout +All functions in the Matlabbatch menu item +\begin_inset Quotes eld +\end_inset -\begin_layout Standard -PsPM requires Matlab 2009a or higher. - -\end_layout +Data preparation +\begin_inset Quotes erd +\end_inset -\begin_layout Section -General points + create new data files. + These functions ask whether an existing file with the same name should be overwritten - unless you specify 'overwrite' in the options. \end_layout -\begin_layout Subsection -File types +\begin_layout Itemize +Import - prepended with 'pspm_' \end_layout -\begin_layout Standard -PsPM knows three different file types: +\begin_layout Itemize +Trim - prepended with 't' \end_layout \begin_layout Itemize -Data files - usually the original file name is prepended with 'pspm_' during - import. - Various pre-processing steps prepend additonal letters to the name. +Split sessions - appended with '_sn' \end_layout \begin_layout Itemize -First-level model files - all models use a similar data structure. - The name can be freely specified by the user. - These files also contain reconstructed responses in GLM, and contrast values. +Rename - user-defined file name \end_layout \begin_layout Itemize -Second-level model files. - The name can be freely specified by the user. +Interpolation - prepended with 'i' (only if run on all channels of the file) \end_layout -\begin_layout Subsection -Functions that create new data files +\begin_layout Section +Functions that create or modify data channels in an existing file \end_layout -\begin_layout Itemize -Import - prepended with 'pspm_' -\end_layout +\begin_layout Standard +All functions in the Matlabbatch menu item +\begin_inset Quotes eld +\end_inset -\begin_layout Itemize -Interpolation - prepended with 'i' -\end_layout +Data preprocessing +\begin_inset Quotes erd +\end_inset -\begin_layout Itemize -Trim - prepended with 't' + create new channels. + These functions allow you to select where to store a modified data channel. + The following options exist: \end_layout \begin_layout Itemize -Artefact removal - prepended with 'm' +add: + A new channel is created with the new data \end_layout \begin_layout Itemize -Split sessions - appended with '_sn' +replace: + If one or several channels of the output type exists, + the last of these will be overwritten. + For some functions, + this can overwrite the original data, + i. + e. + if a conversion function produces an output of the same type as the input. + If no channel of the output channel type is found, + a channel will be added. \end_layout -\begin_layout Itemize -Downsample data - prepended with 'd' +\begin_layout Section +Import details \end_layout \begin_layout Standard -These functions ask whether an existing file with the same name should be - overwritten - unless you specify 'overwrite' in the options. +Here, + we list some additional information regarding the import of various data types. \end_layout -\begin_layout Subsection -Functions that create or modify data channels in an existing file +\begin_layout Paragraph +CED Spike \end_layout -\begin_layout Itemize -Preprocess heart data +\begin_layout Paragraph +Text \end_layout -\begin_layout Itemize -Preprocess respiration data +\begin_layout Standard +Text files can only contain numbers (i.e. + no header lines with channel names) and one data column per channel. + Make sure you use the decimal point (i.e. + not decimal comma). + At the moment, + no import of event time stamps is possible, + but continuous event marker channels are supported. \end_layout -\begin_layout Itemize -Preprocess startle eyeblink EMG +\begin_layout Paragraph +Matlab \end_layout -\begin_layout Itemize -Find valid fixations +\begin_layout Standard +Each input file must contain a variable called data that is either a cell array of column vectors, + or a data points × channels matrix. + The import of event markers is supported. + Marker channels are assumed to be continuous if the input data is a matrix or if the input data is a cell and the given samplerate is larger than 1 Hz. + A sample rate has to be specified for any type of data. \end_layout -\begin_layout Itemize -Pupil foreshortening error correction +\begin_layout Paragraph +Biopac AcqKnowledge (up to v. + 3.9) \end_layout -\begin_layout Itemize -Pupil preprocessing +\begin_layout Standard +Imports original files. \end_layout -\begin_layout Itemize -Convert data -\end_layout - -\begin_layout Itemize -Find startle sound onsets -\end_layout - -\begin_layout Itemize -Interpolate missing data -\end_layout - -\begin_layout Standard -These functions allow you to select where to store a modified data channel. - The following options exist: -\end_layout - -\begin_layout Itemize -add: A new channel is created with the new data -\end_layout - -\begin_layout Itemize -replace: If one or several channels of the output type exists, the last - of these will be overwritten. - For some functions, this can overwrite the original data, i. - e. - if a conversion function produces an output of the same type as the input - (e.g. - when units are converted, or artefacts removed). - If no channel of the output channel type is found, a channel will be added. -\end_layout - -\begin_layout Section -Data preparation -\end_layout - -\begin_layout Subsection -Import -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_import -\end_layout - -\begin_layout Standard -Import external data files for use by PsPM. - First, specify the data type. - Then, other fields will come up as required for this data type. - The imported data will be written to a new .mat file, prepended with 'pspm_'. -\end_layout - -\begin_layout Subsubsection* -Data Type -\end_layout - -\begin_layout Paragraph -CED Spike -\end_layout - -\begin_layout Paragraph -Text -\end_layout - -\begin_layout Standard -Text files can only contain numbers (i.e. - no header lines with channel names) and one data column per channel. - Make sure you use the decimal point (i.e. - not decimal comma). - At the moment, no import of event time stamps is possible, but continuous - event marker channels are supported. -\end_layout - -\begin_layout Paragraph -Matlab -\end_layout - -\begin_layout Standard -Each input file must contain a variable called data that is either a cell - array of column vectors, or a data points × channels matrix. - The import of event markers is supported. - Marker channels are assumed to be continuous if the input data is a matrix - or if the input data is a cell and the given samplerate is larger than - 1 Hz. - A sample rate has to be specified for any type of data. -\end_layout - -\begin_layout Paragraph -Biopac AcqKnowledge (up to v. - 3.9) -\end_layout - -\begin_layout Standard -Imports original files. -\end_layout - -\begin_layout Paragraph -exported Biopac AcqKnowledge +\begin_layout Paragraph +exported Biopac AcqKnowledge \end_layout \begin_layout Standard @@ -5478,8 +5636,7 @@ bioread-converted Biopac AcqKnowledge (any version) \begin_layout Standard Loads mat files which have been converted using the bioread tool acq2mat. - Bioread can be installed using pip (installed by python) or can be downloaded - and installed manually from here + Bioread can be installed using pip (installed by python) or can be downloaded and installed manually from here \begin_inset Flex URL status open @@ -5496,13 +5653,14 @@ https://github.com/njvack/bioread \end_layout \begin_layout Paragraph* -Labchart (any Version, Windows only) +Labchart (any Version, + Windows only) \end_layout \begin_layout Standard Supports the import of any original Labchart (.adicht) file. - Since it uses an external library, this import is restricted to Windows - systems only and does not work on any other operating system. + Since it uses an external library, + this import is restricted to Windows systems only and does not work on any other operating system. \end_layout \begin_layout Paragraph @@ -5511,8 +5669,8 @@ Labchart exported (up to v. \end_layout \begin_layout Standard -Export data to matlab format (plugin for the LabChart software, available - from www.adinstruments.com) +Export data to matlab format (plugin for the LabChart software, + available from www.adinstruments.com) \end_layout \begin_layout Paragraph @@ -5529,8 +5687,9 @@ Biograph Infiniti exported \end_layout \begin_layout Standard -Export data to text format, both "Export Channel Data" and "Export Interval - Data" are supported; a header is required +Export data to text format, + both "Export Channel Data" and "Export Interval Data" are supported; + a header is required \end_layout \begin_layout Paragraph* @@ -5546,8 +5705,7 @@ Windaq (Manufacturer's version) \end_layout \begin_layout Standard -Requires an ActiveX Plugin provided by the manufacturer and contained in - the subfolder Import/wdq for your convenience. +Requires an ActiveX Plugin provided by the manufacturer and contained in the subfolder Import/wdq for your convenience. This plugin only runs under 32 bit Matlab on Windows. \end_layout @@ -5558,15 +5716,16 @@ Windaq (PsPM Version) \begin_layout Standard Windaq import written by the PsPM team. - Is platform independent, thus has no requirements for ActiveX Plugins, + Is platform independent, + thus has no requirements for ActiveX Plugins, Windows or 32bit Matlab. Imports the *.wdq files. Up to now the import has been tested with files of the following type: - Unpacked, no Hi-Res data, no Multiplexer files. - A warning will be produced if the imported data-type fits one of the yet - untested cases. - If this is the case try to use the import provided by the manufacturer - (see above). + Unpacked, + no Hi-Res data, + no Multiplexer files. + A warning will be produced if the imported data-type fits one of the yet untested cases. + If this is the case try to use the import provided by the manufacturer (see above). \end_layout \begin_layout Paragraph* @@ -5586,10 +5745,8 @@ Eyelink \end_layout \begin_layout Standard -Eyelink output files (with extension *.edf) must first be converted to ASCII - format (extension *.asc). - This is done with the utility edf2asc.exe (normally included in the Eyelink - software in +Eyelink output files (with extension *.edf) must first be converted to ASCII format (extension *.asc). + This is done with the utility edf2asc.exe (normally included in the Eyelink software in \backslash SR Research \backslash @@ -5598,7 +5755,8 @@ EyeLink EDF_Access_API \backslash ). - Otherwise there is a Data viewer, available at + Otherwise there is a Data viewer, + available at \begin_inset Flex URL status open @@ -5609,19 +5767,27 @@ http://www.sr-research.com/dv.html \end_inset - (registration needed), which installs a utility called 'Visual EDF2ASC'. + (registration needed), + which installs a utility called 'Visual EDF2ASC'. This also allows the conversion and does not require a license. The composition of channels depends on the acquisition settings. - Available channels are Pupil L, Pupil R, x L, y L, x R, y R, Blink L, Blink - R, Saccade L, Saccade R. - The channels will be imported according to a known data structure, therefore - channel ids passed to the import function or set in the Batch will be ignored. - If the import function defines PsPM file channels that are not available - in the data file, these channels will be filled with NaN values. - Periods of blinks and saccades will be set to NaN in the gaze and pupil - channels. - To reduce the impact of loss of fixation on recorded pupil size, we recommend - setting ELCL_PROC to ELLIPSE during acquisition. + Available channels are Pupil L, + Pupil R, + x L, + y L, + x R, + y R, + Blink L, + Blink R, + Saccade L, + Saccade R. + The channels will be imported according to a known data structure, + therefore channel ids passed to the import function or set in the Batch will be ignored. + If the import function defines PsPM file channels that are not available in the data file, + these channels will be filled with NaN values. + Periods of blinks and saccades will be set to NaN in the gaze and pupil channels. + To reduce the impact of loss of fixation on recorded pupil size, + we recommend setting ELCL_PROC to ELLIPSE during acquisition. \end_layout \begin_layout Subparagraph* @@ -5631,17 +5797,17 @@ Pupil Channels and Eyetracker distance \begin_layout Standard Distance between eyetracker camera and recorded eyes in length units. If the given eyetracker distance is given as a positive numeric value, - it enables the pupil data to be converted from arbitrary area or diameter - units to diameter (mm) and then to the length unit of the eyetracker distance. - If eyetracker distance is not given, or if it is not a positive numeric - value, then the conversion to mm is disabled. - In this case, pupil data will be imported in arbitrary (Eyelink) units. + it enables the pupil data to be converted from arbitrary area or diameter units to diameter (mm) and then to the length unit of the eyetracker distance. + If eyetracker distance is not given, + or if it is not a positive numeric value, + then the conversion to mm is disabled. + In this case, + pupil data will be imported in arbitrary (Eyelink) units. (Use only if you are interested in relative values) \end_layout \begin_layout Standard -The relation between arbitrary units (a.u.) and diameter is assumed to be - linear such that for diameter data +The relation between arbitrary units (a.u.) and diameter is assumed to be linear such that for diameter data \end_layout \begin_layout Standard @@ -5683,15 +5849,18 @@ for data \begin_inset Formula $d$ \end_inset - in mm, data + in mm, + data \begin_inset Formula $d_{a.u.}$ \end_inset - in arbitrary units, reference camera-eye distance + in arbitrary units, + reference camera-eye distance \begin_inset Formula $dist_{ref}$ \end_inset - in mm, used camera-eye distance + in mm, + used camera-eye distance \begin_inset Formula $dist$ \end_inset @@ -5700,7 +5869,8 @@ for data \end_inset in mm. - In our equations, + In our equations, + \begin_inset Formula $m_{area}/dist_{ref}$ \end_inset @@ -5713,7 +5883,8 @@ literal "false" \end_inset . - For area-based conversion, we use the scaling factor + For area-based conversion, + we use the scaling factor \begin_inset Formula $\alpha=1.70\times10^{-4}$ \end_inset @@ -5731,13 +5902,12 @@ literal "false" \end_inset mm. - For diameter-based conversion, we determined reference distance and the - proportionality factor in a simpler calibration with three different artificial - pupil sizes setting using linear regression. - We note that for a different Eyelink eye-tracker setup, conversion with - these values yielded results with slight deviance from the expected value, - such that they are either not entirely precise, or there may be small differenc -es between different eyetrackers. + For diameter-based conversion, + we determined reference distance and the proportionality factor in a simpler calibration with three different artificial pupil sizes setting using linear regression. + We note that for a different Eyelink eye-tracker setup, + conversion with these values yielded results with slight deviance from the expected value, + such that they are either not entirely precise, + or there may be small differences between different eyetrackers. The table below summarises all coefficients: \end_layout @@ -5745,6 +5915,7 @@ es between different eyetrackers. \noindent \begin_inset Float table placement t +alignment document wide false sideways false status open @@ -6020,8 +6191,7 @@ Gaze Channels \end_layout \begin_layout Standard -Gaze channels are reported exactly as given in the datafile without any - conversion. +Gaze channels are reported exactly as given in the datafile without any conversion. Gaze channel units are pixels. \end_layout @@ -6031,7 +6201,9 @@ Distance unit \begin_layout Standard The length unit in which the eyetracker distance is given. - It can be mm, cm, m or inches. + It can be mm, + cm, + m or inches. \end_layout \begin_layout Subparagraph* @@ -6040,38 +6212,38 @@ Blink/Saccade Edge Discard \begin_layout Standard Samples surrounding a blink or saccade period may be noisy. - For this reason, Eyelink import provides a parameter that allows users - to specify the amount of samples they want to discard on each side of every - blink and saccade period. - This value is multiplied by the sampling rate of the recording to determine - the number of samples to discard from one end. - Therefore, for each blink/saccade period, + For this reason, + Eyelink import provides a parameter that allows users to specify the amount of samples they want to discard on each side of every blink and saccade period. + This value is multiplied by the sampling rate of the recording to determine the number of samples to discard from one end. + Therefore, + for each blink/saccade period, + \begin_inset Formula $2\cdot factor\cdot F_{sampling}$ \end_inset - many samples are discarded in total, and effectively blink/saccade period - is extended. + many samples are discarded in total, + and effectively blink/saccade period is extended. \end_layout \begin_layout Standard -This value also corresponds to the duration of samples to discard on one - end in seconds. - For example, when it is 0.01, we discard 10 ms worth of data on each end - of every blink/saccade period. +This value also corresponds to the duration of samples to discard on one end in seconds. + For example, + when it is 0.01, + we discard 10 ms worth of data on each end of every blink/saccade period. \end_layout \begin_layout Standard -The default value has been changed to 0 in PsPM revision r803 to reduce - the amount of discarded data. +The default value has been changed to 0 in PsPM revision r803 to reduce the amount of discarded data. Note that this might result in noisy samples around blink/saccade points. - Therefore, it is highly recommended to perform pupil size data preprocessing - + Therefore, + it is highly recommended to perform pupil size data preprocessing \begin_inset CommandInset ref LatexCommand ref reference "subsec:Pupil-Size-Preprocessing" plural "false" caps "false" noprefix "false" +nolink "false" \end_inset @@ -6082,6 +6254,7 @@ reference "subsec:Find-valid-fixations" plural "false" caps "false" noprefix "false" +nolink "false" \end_inset @@ -6094,27 +6267,39 @@ SMI (SensoMotoric Instruments) \end_layout \begin_layout Standard -SMI output files (with extension *.idf) must first be converted to ASCII - format (extension *.txt) using IDF converter. +SMI output files (with extension *.idf) must first be converted to ASCII format (extension *.txt) using IDF converter. \end_layout \begin_layout Standard SMI iView X EyeTracker sample and optionally also event files can be imported. - The SMI sample file contains pupil, gaze and position related information. + The SMI sample file contains pupil, + gaze and position related information. The SMI event file contains information about blink/saccade events. - Available channels to import are Pupil L, Pupil R, Gaze x L, Gaze x R, - Gaze y L, Gaze y R, Blink L, Blink R, Saccade L, Saccade R, Marker, Custom. + Available channels to import are Pupil L, + Pupil R, + Gaze x L, + Gaze x R, + Gaze y L, + Gaze y R, + Blink L, + Blink R, + Saccade L, + Saccade R, + Marker, + Custom. All channels except custom are imported according to a known data structure. - Therefore, there is no need to specify the column indices of channels. - If specified channels are not available, they will be filled with NaN values. - If an event file is given so that blinks/saccades are available, blink - and saccade periods will be set to NaN. + Therefore, + there is no need to specify the column indices of channels. + If specified channels are not available, + they will be filled with NaN values. + If an event file is given so that blinks/saccades are available, + blink and saccade periods will be set to NaN. \end_layout \begin_layout Standard There are multiple ways to specify pupil information in SMI sample files. - Instead of importing all the channels for a given eye, PsPM selects only - one of the available ones according to the following precedence order: + Instead of importing all the channels for a given eye, + PsPM selects only one of the available ones according to the following precedence order: \end_layout \begin_layout Enumerate @@ -6138,17 +6323,18 @@ Dia (squared px) \end_layout \begin_layout Standard -If the chosen pupil channel is in squared px or squared mm, then it is converted - to diameter by assuming the shape is a circle. - However, no conversion from pixels to milimeters is performed for pupil - channels. - Therefore, if a pixel or squared pixel channel is chosen, it is returned - in pixel units. +If the chosen pupil channel is in squared px or squared mm, + then it is converted to diameter by assuming the shape is a circle. + However, + no conversion from pixels to milimeters is performed for pupil channels. + Therefore, + if a pixel or squared pixel channel is chosen, + it is returned in pixel units. \end_layout \begin_layout Standard -Returned gaze coordinates assume that (0, 0) point of the calibration area - is the top left corner. +Returned gaze coordinates assume that (0, + 0) point of the calibration area is the top left corner. \begin_inset Formula $x$ \end_inset @@ -6158,21 +6344,22 @@ Returned gaze coordinates assume that (0, 0) point of the calibration area \end_inset coordinates increase downwards. - If the resolution of the whole stimulus window is given, the gaze values - are returned in the desired target unit. - Otherwise, they are returned in pixels. - It is important to note that the values can be negative or larger than - the sides of the screen, if gaze is outside the calibration area. + If the resolution of the whole stimulus window is given, + the gaze values are returned in the desired target unit. + Otherwise, + they are returned in pixels. + It is important to note that the values can be negative or larger than the sides of the screen, + if gaze is outside the calibration area. \end_layout \begin_layout Standard Gaze values are reported in pixels by SMI. - The conversion from pixels to milimeters is performed by using the size - and the resolution of the stimulus window to calculate + The conversion from pixels to milimeters is performed by using the size and the resolution of the stimulus window to calculate \begin_inset Formula $px/mm$ \end_inset - ratio, and then using this ratio for scaling. + ratio, + and then using this ratio for scaling. \end_layout \begin_layout Paragraph* @@ -6181,10 +6368,20 @@ Viewpoint (Arrington Research) \begin_layout Standard Arrington Research ViewPoint EyeTracker files can be imported into PsPM. - Available channels to import are Pupil L, Pupil R, Gaze x L, Gaze x R, - Gaze y L, Gaze y R, Blink L, Blink R, Saccade L, Saccade R, Marker, Custom. - Currently, blink and saccade events can only be imported if they are stored - as asynchronous messages in the datafile. + Available channels to import are Pupil L, + Pupil R, + Gaze x L, + Gaze x R, + Gaze y L, + Gaze y R, + Blink L, + Blink R, + Saccade L, + Saccade R, + Marker, + Custom. + Currently, + blink and saccade events can only be imported if they are stored as asynchronous messages in the datafile. This is enabled by \begin_inset Quotes eld \end_inset @@ -6195,25 +6392,25 @@ Include Events in Datafile option in ViewPoint EyeTracker software. All channels except custom are imported according to a known data structure; - therefore, there is no need to specify the column indices of channels. - If specified channels are not available, they will be filled with NaN values. + therefore, + there is no need to specify the column indices of channels. + If specified channels are not available, + they will be filled with NaN values. \end_layout \begin_layout Standard -ViewPoint reports data for eye A in monocular mode and for eyes A and B - in binocular mode. +ViewPoint reports data for eye A in monocular mode and for eyes A and B in binocular mode. PsPM performs the following mapping from A/B to L/R: \end_layout \begin_layout Enumerate -If only one eye is specified by user (only L or only R) and there is only - eye A in data, then data for eye A is returned as the eye specified by - user +If only one eye is specified by user (only L or only R) and there is only eye A in data, + then data for eye A is returned as the eye specified by user \end_layout \begin_layout Enumerate -In all other cases, eye A is mapped to eye R and eye B is mapped to eye - L. +In all other cases, + eye A is mapped to eye R and eye B is mapped to eye L. \end_layout \begin_layout Standard @@ -6221,8 +6418,7 @@ All gaze and diameter values are reported as ratios by ViewPoint: \end_layout \begin_layout Enumerate -Gaze value for a given axis is the ratio of the gaze coordinate to the length - of that axis. +Gaze value for a given axis is the ratio of the gaze coordinate to the length of that axis. \end_layout \begin_layout Enumerate @@ -6230,12 +6426,11 @@ Pupil diameter is the ratio of pupil width to the EyeCamera window width. \end_layout \begin_layout Standard -Since ViewPoint data files contain the size of the stimulus window in milimeters -, PsPM converts normalized gaze values to values in milimeter. - This is performed by multiplying the ratio with the length of the corresponding - stimulus window axis. - Returned gaze coordinates assume that (0, 0) point of the stimulus window - is the top left corner. +Since ViewPoint data files contain the size of the stimulus window in milimeters, + PsPM converts normalized gaze values to values in milimeter. + This is performed by multiplying the ratio with the length of the corresponding stimulus window axis. + Returned gaze coordinates assume that (0, + 0) point of the stimulus window is the top left corner. \begin_inset Formula $x$ \end_inset @@ -6246,8 +6441,7 @@ Since ViewPoint data files contain the size of the stimulus window in milimeters coordinates increase downwards. The gaze values are returned in the desired target unit. - It is important to note that the values can be negative or larger than - side of the screen which correspond to looking outside the stimulus window. + It is important to note that the values can be negative or larger than side of the screen which correspond to looking outside the stimulus window. \end_layout \begin_layout Standard @@ -6425,15 +6619,14 @@ Respiration \begin_inset Newline newline \end_inset -Depending on your scanner settings, there are 10 trigger channels (see complete - list below) of which channel 6 marks time t of the last slice recording. - After importing, a time window from t minus +Depending on your scanner settings, + there are 10 trigger channels (see complete list below) of which channel 6 marks time t of the last slice recording. + After importing, + a time window from t minus \begin_inset Formula $(\#\,volumes)*(repetition\:time)$ \end_inset - seconds until t should be used for trimming or splitting of sessions to - constrain data in the imported file to the EPI recording window and easier - matching with experimental events from a separate source. + seconds until t should be used for trimming or splitting of sessions to constrain data in the imported file to the EPI recording window and easier matching with experimental events from a separate source. \begin_inset Newline newline \end_inset @@ -6685,88 +6878,14 @@ Reference ECG Trigger \end_layout -\begin_layout Subsubsection* -Data File(s) -\end_layout - -\begin_layout Standard -Specify which data file(s) to import. - You can import multiple files that all have the same structure. -\end_layout - -\begin_layout Subsubsection* -New Channel -\end_layout - -\begin_layout Standard -Define each channel that you want to import. -\end_layout - -\begin_layout Paragraph* -Channel Type -\end_layout - -\begin_layout Standard -Specify the type of data in this channel. - Currently supported data types: SCR, ECG, heart beat markers, interpolated - heart rate, interpolated heart period, respiration traces, interpolated - respiration period, pupil size, EMG, marker channels. - -\end_layout - -\begin_layout Paragraph* -Channel /Column Number -\end_layout - -\begin_layout Standard -Specify where in the original file to find the data - depending on your - data type this will be a channel or column number. - You can either specify a number (i. - e. - the n-th channel in the file), or (for many data types) search for this - channel by its name. - Note: the channel number refers to the n-th recorded channel, not to its - number during acquisition: if you did not save all recorded channels, these - might be different for some data types. - -\end_layout - -\begin_layout Itemize -Search [if available]: Search for channel by its name – this only works - if the channel names are unambiguous, and not for all data types. -\end_layout - -\begin_layout Itemize -Specify Channel Number [if required according to data type, otherwise a - default channel number will be assigned]: Specify the n-th channel. - This counts the number of channels actually recorded. -\end_layout - -\begin_layout Paragraph* -Sample Rate [if required] -\end_layout - -\begin_layout Standard -Sample rate in Hz (i. - e. - samples per second). - For most data types, this is read from the original data file. -\end_layout - \begin_layout Paragraph* SCR Transfer Function [for SCR data only] \end_layout \begin_layout Standard -Enter the conversion from recorded data to Microsiemens. - -\end_layout - -\begin_layout Standard -The transfer function supports two recording systems, which are either a - conductance based system (default) or a resistance based system. - Depending on the recording system the relation between measured conductance - +The transfer function supports two recording systems, + which are either a conductance based system (default) or a resistance based system. + Depending on the recording system the relation between measured conductance \begin_inset Formula $G$ \end_inset @@ -6824,6 +6943,7 @@ For a transfer constant \begin_inset CommandInset ref LatexCommand ref reference "eq:Voltage from Skin conductance" +nolink "false" \end_inset @@ -6835,19 +6955,23 @@ reference "eq:Voltage from Skin conductance" \begin_inset CommandInset ref LatexCommand ref reference "eq:Voltage from Skin resistance" +nolink "false" \end_inset -), series resistor +), + series resistor \begin_inset Formula $R_{s}$ \end_inset - in Ohm, and a fixed offset in + in Ohm, + and a fixed offset in \begin_inset Formula $V$ \end_inset which was added to the initially measured voltage. - If there is no offset and series resistor, this is equivalent to + If there is no offset and series resistor, + this is equivalent to \end_layout \begin_layout Standard @@ -6881,14962 +7005,590 @@ There are three options how to enter this information: \end_layout \begin_layout Itemize -File: Enter the name of the .mat file that contains the variables: 'c', 'Rs' - (in Ohm) and 'offset', 'recsys' (possible values: 'conductance' or 'resistance' -). +File: + Enter the name of the .mat file that contains the variables: + 'c', + 'Rs' (in Ohm) and 'offset', + 'recsys' (possible values: + 'conductance' or 'resistance'). \end_layout \begin_layout Itemize -Input: Enter the transfer constants manually. +Input: + Enter the transfer constants manually. \end_layout \begin_layout Itemize -None: No transfer function. - Use this only if you are not interested in absolute values, and if the - recording settings were the same for all subjects. +None: + No transfer function. + Use this only if you are not interested in absolute values, + and if the recording settings were the same for all subjects. \end_layout -\begin_layout Subsection -Trim +\begin_layout Part +Tutorial data sets \end_layout \begin_layout Standard \shape italic -Related function: -\shape default - -\family typewriter -pspm_trim -\end_layout - -\begin_layout Standard -Trim away unnecessary data, for example before an experiment started, or - after it ended. - Trim points can be defined in seconds with respect to start of the data - file, in seconds with respect to first and last marker (if markers exist), - or in seconds with respect to a user-defined marker. - The resulting data will be written to a new file, prepended with 't'. -\end_layout - -\begin_layout Subsubsection* -Data file +Contributed by Christoph Korn & Matthias Staib. \end_layout -\begin_layout Standard -Choose the data file you want to trim. -\end_layout +\begin_layout Section +GLM for SCR: + Appraisal data +\begin_inset CommandInset label +LatexCommand label +name "sec:tutorial_GLM" -\begin_layout Subsubsection* -Reference -\end_layout +\end_inset -\begin_layout Standard -Choose your reference for trimming: file start, first/last marker, or a - user-defined marker. - All trimming is defined in seconds after this reference – choose negative - values if you want to trim before the reference. -\end_layout -\begin_layout Paragraph* -File \end_layout \begin_layout Standard -Trim from xx seconds after file start to xx seconds after file start. -\end_layout - -\begin_layout Itemize -From (seconds after file start): Choose a positive value. -\end_layout +To analyse this data set, + follow tutorials 1-2 on the PsPM website. + Tutorial 6 shows how to adapt your scripts for multiple participants. + In this tutorial, + we analyze SCR data using a general linear model (GLM). + The example data set comprises SCR data from 15 participants and can be downloaded from +\begin_inset CommandInset href +LatexCommand href +name "https://bachlab.github.io/PsPM/courses/" +target "https://bachlab.github.io/PsPM/courses/" +literal "false" -\begin_layout Itemize -Trim To (seconds after file start): Choose a positive value larger than - the 'from' value. -\end_layout +\end_inset -\begin_layout Paragraph* -First/Last Marker -\end_layout +. + Results from this data set have been previously published +\begin_inset CommandInset citation +LatexCommand cite +key "Bach:2013aa,Bach:2014aa" +literal "true" -\begin_layout Standard -Trim from xx seconds after first marker to xx seconds after last marker. -\end_layout +\end_inset -\begin_layout Itemize -From: (seconds after first marker): Choose a positive (after first marker) - or negative (before first marker) value. +. + Each participant saw 45 neutral and 45 aversive pictures within one session that included two short breaks. + SCR data were recorded using a 0.5 V coupler, + optical (wave to pulse) transducer, + and CED Spike, + with a minimum sampling rate of 100 Hz. + \end_layout -\begin_layout Itemize -To: (seconds after last marker): Choose a positive (after last marker) or - negative (before last marker) value. -\end_layout +\begin_layout Section +Non-linear SCR analysis: + Delay fear conditioning data +\begin_inset CommandInset label +LatexCommand label +name "sec:Delay-fear-conditioning" -\begin_layout Itemize -Marker Channel: If you have more than one marker channel, choose the reference - marker channel (default: use the first marker channel in the file) -\begin_inset Separator latexpar \end_inset \end_layout -\begin_deeper \begin_layout Standard -- Default (first marker channel=0) +To analyse this data set, + follow tutorial 3 on the PsPM website. + Tutorial 6 shows how to adapt your scripts for multiple participants. + In this tutorial, + the non-linear model is estimated. + The estimated parameters can then be used to test the within-subject hypothesis that the sympathetic arousal between CS+ and CS- are different on a group level. + The example data set comprises SCR data from 20 participants, + with 40 trials each, + which can be downloaded from +\begin_inset CommandInset href +LatexCommand href +name "https://bachlab.github.io/PsPM/courses/" +target "https://bachlab.github.io/PsPM/courses/" +literal "false" + +\end_inset + + together with the result files of the model inversion. + Participants underwent a differential delay fear conditioning paradigm where coloured circles were presented for 4 seconds each. + Either the blue or orange coloured circles (balanced over participants) were probabilistically paired with an electric stimulation (unconditioned stimulus, + US) that coterminated with the stimulus (conditioned stimulus, + CS+) while the CS- were always presented alone. \end_layout \begin_layout Standard -- Number +Presenting the CS+ causes phasic sympathetic arousal in anticipation of an electric shock. + This anticipatory reaction typically occurs with an unknown and variable latency after stimulus onset. + For such cases, + a GLM should not be used because it assumes that sympathetic arousal follows the stimulus with a fixed latency. + In contrast, + the non-linear model allows estimating (i) a variable onset within a user-specified time window and (ii) a variable duration of a sympathetic response. + Additionally, + the non-linear model includes estimation of spontaneous fluctuations that occur between trials. \end_layout -\end_deeper -\begin_layout Paragraph* -Any Marker +\begin_layout Part +How to reference PsPM \end_layout \begin_layout Standard -Trim from xx seconds after any marker of your choice to xx seconds after - any marker of your choice. +To justify our development and maintenance effort, + we ask you acknowledge PsPM when you use it: + +\begin_inset Quotes eld +\end_inset + +Data were analysed using PsPM [version number], + available at +\begin_inset Flex URL +status open + +\begin_layout Plain Layout + +http://bachlab.github.io/pspm \end_layout -\begin_layout Itemize -From: Choose marker number and trimming point in seconds after this marker. -\begin_inset Separator latexpar \end_inset +. +\begin_inset Quotes erd +\end_inset -\end_layout -\begin_deeper -\begin_layout Standard -- Marker Number x: Choose an integer value. \end_layout \begin_layout Standard -- Seconds after Marker x: Choose a positive (after this marker) or negative - (before this marker) value. +We ask you reference our papers to justify your analysis steps and models in the following way: \end_layout -\end_deeper \begin_layout Itemize -To: Choose marker number and trimming point in seconds after this marker. -\begin_inset Separator latexpar -\end_inset - - +General PsPM reference: + \end_layout \begin_deeper -\begin_layout Standard -- Marker Number y: Choose an integer value. +\begin_layout Itemize +Bach DR, + & Friston KJ (2013). + Model-based analysis of skin conductance responses: + Towards causal models in psychophysiology. + Psychophysiology, + 50, + 15-22. \end_layout -\begin_layout Standard -- Seconds after Marker y: Choose a positive (after this marker) or negative - (before this marker) value. +\begin_layout Itemize +Bach DR, + Castegnetti G, + Korn CW, + Gerster S, + Melinscak F, + Moser T (2018). + Psychophysiological modelling - current state and future directions. + Psychophysiology, + 55, + e13214. \end_layout \end_deeper \begin_layout Itemize -Marker Channel: If you have more than one marker channel, choose the reference - marker channel (default: use the fist marker channel in the file) -\begin_inset Separator latexpar -\end_inset - - +General PsPM reference for fear conditioning experiments: \end_layout \begin_deeper -\begin_layout Standard -- Default (first marker channel=0) -\end_layout - -\begin_layout Standard -- Number +\begin_layout Itemize +Bach DR, + & Melinščak F (2020). + Psychophysiological modelling and the measurement of fear conditioning. + Behaviour Research and Therapy, + 127, + 103576. \end_layout \end_deeper -\begin_layout Paragraph* -Marker according to values or names +\begin_layout Itemize +GLM for SCR \end_layout -\begin_layout Standard -Trim from nn seconds after first marker with value or name x, to mm seconds - after first marker with value or name y. +\begin_deeper +\begin_layout Itemize +general reference: + Bach DR, + Flandin G, + Friston KJ, + & Dolan RJ (2009). + Time-series analysis for rapid event-related skin conductance responses. + Journal of Neuroscience Methods, + 184, + 224-234. + \end_layout \begin_layout Itemize -From: Choose first marker with value or name x, and trimming point in seconds - after this marker. -\begin_inset Separator latexpar -\end_inset - +canonical SCRF: + Bach DR, + Flandin G, + Friston KJ, + & Dolan RJ (2010). + Modelling event-related skin conductance responses. + International Journal of Psychophysiology, + 75, + 349-356. +\end_layout +\begin_layout Itemize +assumptions of the model: + Gerster S, + Namer B, + Elam M, + Bach DR (2018). + Testing a linear time invariant model for skin conductance responses by intraneural recording and stimulation. + Psychophysiology, + 55, + e12986. \end_layout -\begin_deeper -\begin_layout Standard -- First marker with value or name x: Either choose a numeric marker value - or a marker name. +\begin_layout Itemize +optimised filter settings: + Bach DR, + Friston KJ, + Dolan RJ (2013). + An improved algorithm for model-based analysis of evoked skin conductance responses. + Biological Psychology, + 94, + 490-497. + \end_layout -\begin_layout Standard -- Seconds after marker with value/name x: Choose a positive (after this - marker) or negative (before this marker) value. +\begin_layout Itemize +comparison with Ledalab and peak-scoring methods: + Bach DR (2014). + A head-to-head comparison of SCRalyze and Ledalab, + two model-based methods for skin conductance analysis. + Biological Psychology, + 103, + 63-88. \end_layout \end_deeper \begin_layout Itemize -To: Choose first marker with value or name y, and trimming point in seconds - after this marker. -\begin_inset Separator latexpar -\end_inset - - +non-linear model for event-related SCR: \end_layout \begin_deeper -\begin_layout Standard -- First Marker with value or name y: Either choose a numeric marker value - or a marker name. +\begin_layout Itemize +general reference: + Bach DR, + Daunizeau J, + Friston KJ, + & Dolan RJ (2010). + Dynamic causal modelling of anticipatory skin conductance responses. + Biological Psychology, + 85, + 163-70. \end_layout -\begin_layout Standard -- Seconds after marker with value/name y: Choose a positive (after this - marker) or negative (before this marker) value. +\begin_layout Itemize +optimised filter settings: + Staib M, + Castegnetti G, + Bach DR (2015). + Optimising a model-based approach to inferring fear learning from skin conductance responses. + Journal of Neuroscience Methods, + 255, + 131-138. \end_layout -\end_deeper \begin_layout Itemize -Marker Channel: If you have more than one marker channel, choose the reference - marker channel (default: use the fist marker channel in the file) -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Standard -- Default (first marker channel=0) -\end_layout - -\begin_layout Standard -- Number -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Choose -\begin_inset Quotes eld -\end_inset - -yes -\begin_inset Quotes erd -\end_inset - - if you want to overwrite existing file(s) with the same name. - Default: no. -\end_layout - -\begin_layout Section -Data preprocessing -\end_layout - -\begin_layout Subsection -Preprocess heart data -\end_layout - -\begin_layout Standard - -\shape italic -Related functions: -\shape default - -\family typewriter -pspm_ecg2hb, pspm_ecg2hb_amri, pspm_hb2hp, pspm_ppg2hb -\end_layout - -\begin_layout Standard -Convert ECG to heart beat (Pan & Tompkins) detects QRS complexes in ECG - data and write timestamps of detected R spikes into a new heart beat channel. - This function uses an algorithm adapted from -\begin_inset CommandInset citation -LatexCommand cite -key "Pan:1985aa" -literal "true" - -\end_inset - - (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:QRS-detection" - -\end_inset - -). - Hidden options for minimum and maximum heart rate become visible when the - job is saved as a script and should only be used if the algorithm fails. -\end_layout - -\begin_layout Standard -Convert ECG to heart beat (AMRI) similary detects QRS complexes in ECG data - nad write timestamps of detected R peaks into a new heart beat channel. - The algorithm used is described in -\begin_inset CommandInset citation -LatexCommand cite -key "liu2012statistical" -literal "false" - -\end_inset - -. - The algorithm is obtained using the software link described in this paper. -\end_layout - -\begin_layout Standard -Convert Heart Beat to heart period interpolates heart beat time stamps into - continuous heart period data and writes to a new channel. - This function uses heart period rather than heart rate because heart period - varies linearly with ANS input into the heart. - -\end_layout - -\begin_layout Standard -Convert Peripheral pulse oximetry to heart beat first creates a template - from non-ambiguous heart beats. - The signal is then cross correlated with the template and maxima are identified - as heart beats. - -\end_layout - -\begin_layout Standard -Convert ECG to heart period allows to directly convert continuous ECG data - into continuous heart period data. - This function is a combination of the two functions “Convert ECG to heart - beat” and “Convert Heart Beat to heart period”. - -\end_layout - -\begin_layout Standard -If, for ECG conversions, the semi automatic mode is enabled, the ECG editor - will be shown. - This allows manual inspection and correction of potentially wrong HB events. - If the semi automatic mode is disabled, the conversion is done automatically, - without showing the ECG editor. - See ECG editor ( -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:ECG-editor" - -\end_inset - -) for further information. - -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Specify data file. -\end_layout - -\begin_layout Subsubsection* -Preprocessing -\end_layout - -\begin_layout Standard -Add different preprocessing steps here. - The converted data will be written into a new channel in the same file. -\end_layout - -\begin_layout Subsubsection* -Convert ECG to Heart Beat (Pan & Tompkins) -\end_layout - -\begin_layout Standard -Convert ECG data into Heart beat time stamps using modified Pan & Tompkins - algorithm. -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Number of ECG channel (default: first ECG channel). -\end_layout - -\begin_layout Paragraph* -Options -\end_layout - -\begin_layout Itemize -Semi automatic mode: Allows manual correction of all potential beat intervals - (default: off). -\end_layout - -\begin_layout Subsubsection* -Convert ECG to Heart Beat (AMRI) -\end_layout - -\begin_layout Standard -Convert ECG data into heart beat timestamps using AMRI algorithm -\begin_inset CommandInset citation -LatexCommand cite -key "liu2012statistical" -literal "false" - -\end_inset - -. - The algorithm performs template matching to classify candidate R-peaks - after filtering the data and applying Teager Energy Operator (TEO). -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Number of the channel to preprocess (default: first ECG channel found in - the datafile) -\end_layout - -\begin_layout Paragraph* -Options -\end_layout - -\begin_layout Itemize -Signal to use: Which signal to feed to the core heartbeat detection procedure. - 'ecg' corresponds to filtered ECG signal. - 'teo' corresponds to the signal obtained by filtering the ECG signal even - more and applying the Teager Enery Operator. - 'auto' option picks the one of these two options that results in higher - autocorrelation. -\end_layout - -\begin_layout Itemize -Feasible heartrate range: Define the minimum and maximum possible heartrates - for your data. -\end_layout - -\begin_layout Itemize -ECG bandpass filter: Define the cutoff frequencies (Hz) for bandpass filter - applied to raw ECG signal. -\end_layout - -\begin_layout Itemize -TEO bandpass filter: Define the cutoff frequencies (Hz) for bandpass filter - applied to filtered ECG signal before applying TEO. -\end_layout - -\begin_layout Itemize -TEO order: Define the order -\begin_inset Formula $k$ -\end_inset - - of TEO. - Note that for signal -\begin_inset Formula $x(t)$ -\end_inset - -, -\begin_inset Formula $TEO[x(t);k]=x(t)x(t)-x(t-k)x(t+k)$ -\end_inset - -. -\end_layout - -\begin_layout Itemize -Minimum cross correlation: Define the minimum cross correlation between - a candidate R-peak and the found template such that the candidate is classified - as an R-peak. -\end_layout - -\begin_layout Itemize -Minimum relative amplitude: Define the minimum relative amplitude of a candidate - R-peak such that it is classified as an R-peak. -\end_layout - -\begin_layout Subsubsection* -Convert Heart Beat to Heart Period -\end_layout - -\begin_layout Standard -Convert heart beat time stamps into interpolated heart period time series. - You can use the output of the ECG to Heart beat conversion, or directly - work on heart beat time stamps, for example obtained by a pulse oxymeter. -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Number of Heart Beat channel (default: first Heart Beat channel). -\end_layout - -\begin_layout Itemize -Default: First Heart Beat channel -\end_layout - -\begin_layout Itemize -Number -\end_layout - -\begin_layout Itemize -Processed channel: Convert a channel already preprocessed with ECG to Heart - beat. - Specify the preprocessed channel with a number corresponding to the position - in the list of preprocessings. -\end_layout - -\begin_layout Paragraph* -Sample rate -\end_layout - -\begin_layout Standard -Sample rate for the interpolated time series (default: 10 Hz). -\end_layout - -\begin_layout Paragraph* -Limit -\end_layout - -\begin_layout Standard -Define unrealistic values which should be ignored and interpolated. -\end_layout - -\begin_layout Itemize -Upper limit: Values bigger than this value (in seconds) will be ignored - and interpolated. - Default: 2 -\end_layout - -\begin_layout Itemize -Lower limit: Values smaller than this value (in seconds) will be ignored - and interpolated. - Default: 0.2 -\end_layout - -\begin_layout Subsubsection* -Convert ECG to Heart Period -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Number of ECG channel (default: first ECG channel). -\end_layout - -\begin_layout Paragraph* -Options -\end_layout - -\begin_layout Itemize -Semi automatic mode: Allows manual correction of all potential beat intervals - (default: off). -\end_layout - -\begin_layout Paragraph* -Sample rate -\end_layout - -\begin_layout Standard -Sample rate for the interpolated time series (default: 10 Hz). -\end_layout - -\begin_layout Paragraph* -Limit -\end_layout - -\begin_layout Standard -Define unrealistic values which should be ignored and interpolated. -\end_layout - -\begin_layout Itemize -Upper limit: Values bigger than this value (in seconds) will be ignored - and interpolated. - Default: 2 -\end_layout - -\begin_layout Itemize -Lower limit: Values smaller than this value (in seconds) will be ignored - and interpolated. - Default: 0.2 -\end_layout - -\begin_layout Subsubsection* -Convert Peripheral pulse oximetry to Heart Beat -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Number of Peripheral pulse oximetry channel (default: first Peripheral pulse - oximetry channel) -\end_layout - -\begin_layout Subsubsection* -Channel action -\end_layout - -\begin_layout Standard -Choose whether to add the new channels or replace a channel previously added - by this method. - (default: replace) -\end_layout - -\begin_layout Subsection -ECG editor -\begin_inset CommandInset label -LatexCommand label -name "subsec:ECG-editor" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_ecg_editor -\end_layout - -\begin_layout Standard -The ECG editor is integrated into the QRS detection and can also be used - offline, after QRS detection. - It allows to graphically inspect and correct (if necessary) the detected - QRS markers. - To faciliate QRS inspection in data sets with known artefact epochs, the - user can load epoch files which define such artefact periods. - This allows the editor to either ignore or even remove QRS markers which - fall into artefact periods. -\end_layout - -\begin_layout Subsubsection* -Startup -\end_layout - -\begin_layout Standard -The ECG editor can be started from the PsPM window, from the Matlabbatch - window or from the command line. -\end_layout - -\begin_layout Standard -From the command line the ECG editor can be started by typing -\family typewriter -pspm_ecg_editor(argument) -\family default - into the Matlab command line. - For this the PsPM folder has to be added to the matlab path beforehand. - Arguments are either a data struct (generated usually by -\family typewriter -pspm_ecg2hb -\family default -) or a path to a PsPM file. -\end_layout - -\begin_layout Subsubsection* -Data modes -\end_layout - -\begin_layout Standard -Similar to the data editor the ECG editor supports two types of operation - modes, which depend on the startup arguments. - -\end_layout - -\begin_layout Paragraph* -File mode -\end_layout - -\begin_layout Standard -Is entered when the editor is started from the PsPM window, from the Matlabbatch - or when a file path or no argument is specified at the command line startup. - If the first argument is a file path, a second (ECG or PPG channel) and - a third argument (Options struct) is possible. - The second argument specifies the ECG or PPG channel to be plotted. - The third argument is expected to be a struct with the following fields: -\end_layout - -\begin_layout Itemize -hb - specifies a HB channel which contains the QRS markers to be inspected -\end_layout - -\begin_layout Itemize -factor - specifies the minimum factor faulty QRS markers should deviate - from the standard deviation (default is 2) -\end_layout - -\begin_layout Itemize -semi - specifies whether to navigate between potentially wrong hb events - only (semi mode), or between all hb events (manual mode; semi mode is enabled - by default). -\end_layout - -\begin_layout Itemize -limits - with fields 'lower' and 'upper' defines hard limits for the faulty - detection (default is 120bpm [upper] and 40bpm [lower]) -\end_layout - -\begin_layout Standard -The second and third argument is optional. - In file mode the 'Input / Output' panel on the bottom of the left side - is visible. - It allows to specifiy and change input files and channels (ECG/PPG and - HB) and allows to choose whether the edited data should be added as a new - HB channel or replace the existing HB channel. - -\end_layout - -\begin_layout Paragraph* -Inline mode -\end_layout - -\begin_layout Standard -The inline mode is usually used together with -\family typewriter -pspm_ecg2hb -\family default -. - Therefore a struct which is generated by the latter function is expected. - The following fields are needed for the editor: -\end_layout - -\begin_layout Itemize -settings -\end_layout - -\begin_deeper -\begin_layout Itemize -.outfact - specifies to which factor faulty QRS markers should deviate from - the standard deviation -\end_layout - -\begin_layout Itemize -.sr - specifies the sample rate of the data -\end_layout - -\end_deeper -\begin_layout Itemize -data -\end_layout - -\begin_deeper -\begin_layout Itemize -.x - contains the ecg data values -\end_layout - -\begin_layout Itemize -.r - contains n x 4 vector where n corresponds to the ecg data values and - columns 1-4 tell whether there is a QRS marker (column 1-4) and whether - a QRS marker is faulty (column 2). - Columns 3 and 4 are ignored and regenerated during data inspection -\end_layout - -\end_deeper -\begin_layout Itemize -set -\end_layout - -\begin_deeper -\begin_layout Itemize -.R - contains sample ids of all the QRS markers -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Editor output -\end_layout - -\begin_layout Standard -The output always contains as a first argument a status (sts). - If the status equals 1 no error happend while creating the output. - Otherwise the editor could not successfully create the output. - The second output depends on the data mode and in file mode contains the - channel id of the written channel. - In inline mode the second output argument is a data vector which contains - the sample ids of the resulting QRS markers. -\end_layout - -\begin_layout Subsubsection* -Data inspection -\end_layout - -\begin_layout Paragraph* -Navigation -\end_layout - -\begin_layout Standard -The ECG editor uses QRS markers as anchor points for the navigation. - One option to navigate between QRS markers is to use the listbox placed - in 'Heart beat events' on the right side of the plot. - Selecting a QRS marker in the listbox will cause the plot to center the - selected marker with some space left before and after depending on the - zoom state. - If manual mode is active, the listbox contains all QRS markers available - (all colors), otherwise it will only contain QRS markers marked as faulty - (orange). - The navigation buttons ('<<' and '>>') below the listbox allow moving back - and forth in the plot. - In manual mode the step size equals the size of the plot window. - If manual mode is inactive, the next/previous step equals jumping to the - next/previous faulty QRS marker. -\end_layout - -\begin_layout Paragraph* -Zooming -\end_layout - -\begin_layout Standard -The zoom buttons are placed on the upper right. - Zooming in will cause the time window to be shortened by the factor of - two. - Zooming out will cause the time window to be extended by the factor of - two. -\end_layout - -\begin_layout Paragraph* -Add QRS marker -\end_layout - -\begin_layout Standard -The button for this is placed on the upper right side. - Once clicked the cursor will turn into a crosshair. - After that, clicking on the plot will cause an additional QRS marker to - be added at that position (a green QRS marker appears). -\end_layout - -\begin_layout Paragraph* -Remove QRS marker -\end_layout - -\begin_layout Standard -The button is also placed on the upper right side. - The cursor aswell will turn into a crosshair but different to adding QRS - markers, clicking on the plot (without releasing the mouse-button) will - cause a selection rectangle to be drawn. - Upon release of the mouse-button all QRS markers which lie in the selection - rectangle will be marked for removal (violet). -\end_layout - -\begin_layout Subsubsection* -Artefact epochs -\end_layout - -\begin_layout Standard -Settings for the artefact epochs can be found in the 'Artefact epochs' panel. -\end_layout - -\begin_layout Paragraph* -Load / Disable -\end_layout - -\begin_layout Standard -Clicking the 'Load' button causes a file dialog to appear, which allows - to choose a PsPM epoch/timing file containing the definition of artefact - epochs. - The button 'Disable' will cause the artefact epochs to be unloaded and - artefact settings to be disabled. - Once an artefact epoch file is loaded, QRS marker stems and listbox font - color will turn grey if they lie within an artefact epoch. -\end_layout - -\begin_layout Paragraph* -Display settings -\end_layout - -\begin_layout Standard -There are three different display options on how to deal with QRS markers - which fall into artefact epochs. -\end_layout - -\begin_layout Itemize -use all QRS markers - do nothing; all markers will be displayed and used - for faulty detection -\end_layout - -\begin_layout Itemize -exclude artefact periods from faulty QRS detection - still all markers will - be displayed but QRS markes in artefact periods will be ignored for faulty - detection -\end_layout - -\begin_layout Itemize -hide QRS markers during artefact periods - QRS markers in artefact periods - will be hidden and ignored for faulty detection -\end_layout - -\begin_layout Paragraph* -Output settings -\end_layout - -\begin_layout Standard -There are two different output options on how to deal with QRS markes which - fall into artefact epochs. -\end_layout - -\begin_layout Itemize -include QRS during artefact periods - all markers (faulty and valid) including - those lying in artefact periods will be either returned or written to the - new HB channel. -\end_layout - -\begin_layout Itemize -remove QRS during artefact periods - only markes (faulty and valid) outside - of artefact periods will be either returned or written to the new HB channel. -\end_layout - -\begin_layout Subsubsection* -Faulty detection -\end_layout - -\begin_layout Standard -Settings for faulty detection can be changed in the 'Heart beat events' - panel. - The following settings are possible. -\end_layout - -\begin_layout Itemize -Detection factor - specifies the minimum factor faulty QRS markers should - deviate from the standard deviation -\end_layout - -\begin_layout Itemize -Upper limit - Heart rates higher than the upper limit will be marked as - faulty -\end_layout - -\begin_layout Itemize -Lower limit - Heart rates lower than the lower limit will be marked as faulty -\end_layout - -\begin_layout Standard -When changed settings should be applied, clicking 'Find faulty' will cause - the plot to be refreshed. -\end_layout - -\begin_layout Subsubsection* -Color coding -\end_layout - -\begin_layout Paragraph* -Stem / Listbox background colors -\end_layout - -\begin_layout Itemize -Valid QRS marker ⇒ blue -\end_layout - -\begin_layout Itemize -Faulty QRS marker ⇒ orange -\end_layout - -\begin_layout Itemize -Added QRS marker ⇒ green -\end_layout - -\begin_layout Itemize -Removed QRS marker ⇒ violet -\end_layout - -\begin_layout Paragraph* -Artefact periods -\end_layout - -\begin_layout Standard -The color of QRS markers lying in artefact periods will be converted to - greyscale. - This applys for the marker stems (not the tips) and the listbox font color. -\end_layout - -\begin_layout Subsubsection* -Matlabbatch -\end_layout - -\begin_layout Standard -Possible options when the ECG editor is started from Matlabbatch. -\end_layout - -\begin_layout Paragraph* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the ECG data -\end_layout - -\begin_layout Paragraph* -ECG channel -\end_layout - -\begin_layout Standard -Specify the channel containing the ECG data. -\end_layout - -\begin_layout Itemize -Default -\end_layout - -\begin_layout Itemize -Number -\end_layout - -\begin_layout Paragraph* -HB channel -\end_layout - -\begin_layout Standard -Specify the channel containing the HB data. -\end_layout - -\begin_layout Itemize -None -\end_layout - -\begin_layout Itemize -Number -\end_layout - -\begin_layout Paragraph* -Artefact Epochs -\end_layout - -\begin_layout Standard -Specify a PsPM timing file defining artefact epochs.I -\end_layout - -\begin_layout Itemize -Disabled -\end_layout - -\begin_layout Itemize -File -\end_layout - -\begin_layout Paragraph* -Faulty detection settings -\end_layout - -\begin_layout Standard -Settings for the faulty detection. -\end_layout - -\begin_layout Itemize -Factor: The minimum factor potentially wrong QRS complexes should deviate - from the standard deviation. -\end_layout - -\begin_layout Itemize -Limit: Define hard limits for the faulty detection. -\end_layout - -\begin_deeper -\begin_layout Itemize -Upper limit: Values bigger than this value (in bpm) will be marked as faulty. - Default: 120. -\end_layout - -\begin_layout Itemize -Lower limit: Values smaller than this value (in bpm) will be marked as faulty. - Default: 40. -\end_layout - -\end_deeper -\begin_layout Subsection -Preprocess respiration data -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_resp_pp -\end_layout - -\begin_layout Standard -Convert continuous respiration traces into interpolated respiration period, - amplitude, or RFR, or into time stamps indicating the start of inspiration. - This function detects the beginning of inspiration (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Breathing-cycle-detection" - -\end_inset - -), assigns period/amplitude/RFR of the last cycle to this data point, and - interpolates data (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Interpolation-and-Filtering-Resp" - -\end_inset - -). - This function outputs respiration period rather than respiration rate in - analogy to heart period models - heart period linearly varies with ANS - input to the heart. - RFR (respiratory flow rate) is the integral of the absolute thorax excursion - per respiration cycle, divided by the cycle period. - Converted data are written into new channel(s). -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Specify data file. - The processed respiration data will be written to a new channel in this - file. -\end_layout - -\begin_layout Subsubsection* -Sample Rate -\end_layout - -\begin_layout Standard -Sample rate for the new channel. - Default: 10 Hz. - Will be ignored for datatype "respiration time stamps". -\end_layout - -\begin_layout Subsubsection* -Channel -\end_layout - -\begin_layout Standard -Number of respiration channel (default: first respiration channel). -\end_layout - -\begin_layout Subsubsection* -Options -\end_layout - -\begin_layout Paragraph* -System type -\end_layout - -\begin_layout Standard -Type of the measuring system: bellows or cushion (default: bellows). -\end_layout - -\begin_layout Paragraph* -Datatype -\end_layout - -\begin_layout Standard -Choose for each possible process datatype either yes or no (default: yes): -\end_layout - -\begin_layout Itemize -Respiration period: Create a channel with interpolated respiration period -\end_layout - -\begin_layout Itemize -Respiration amplitude: Create a channel with interpolated respiration amplitude -\end_layout - -\begin_layout Itemize -Respiratory flow rate: Create a channel with interpolated respiratory flow - rate -\end_layout - -\begin_layout Itemize -Respiration time: Create a channel with respiration time stamp -\end_layout - -\begin_layout Paragraph* -Diagnostic plot -\end_layout - -\begin_layout Standard -Specify whether a respiratory cycle detection plot should be created (Yes) - or not (No) (default: No). -\end_layout - -\begin_layout Subsubsection* -Channel action -\end_layout - -\begin_layout Standard -Choose whether to add the new channels or replace a channel previously added - by this method. - (default: add) -\end_layout - -\begin_layout Subsection -Prepare illuminance GLM -\begin_inset CommandInset label -LatexCommand label -name "subsec:Prepare-illuminance-GLM" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_process_illuminance -\end_layout - -\begin_layout Standard -Transform an illuminance time series into a convolved pupil response time - series to be used as nuisance file in a GLM. - This allows you to partial out illuminance contributions to pupil responses - evoked by cognitive inputs. - Alternatively you can analyse the illuminance responses themselves, by - extracting parameter estimates relating to the regressors from the GLM. - -\end_layout - -\begin_layout Standard -The illuminance file should be a .mat file with a vector variable called - Lx. - In order to fulfill the requirements of a later nuisance file there must - be as many values as there are data values in the data file. - The data must be given in lux (lm/m²) to account for the non-linear mapping - from illuminance to steady-state pupil size. - A function to transform luminace (cd/m²) to illuminace values is provided - under PsPM > Data processing > Pupil & Eyetracking. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Korn:2016a" -literal "true" - -\end_inset - - -\end_layout - -\begin_layout Subsubsection* -Illuminance file -\end_layout - -\begin_layout Standard -Select a file that contains illuminance data. - The file should contain a variable 'Lx' which should be an n x 1 numeric - vector containing the illuminance values. -\end_layout - -\begin_layout Subsubsection* -Sample rate -\end_layout - -\begin_layout Standard -Specify the sample rate of the illuminance data. -\end_layout - -\begin_layout Subsubsection* -Basis function options -\end_layout - -\begin_layout Standard -Specify options for the basis functions. -\end_layout - -\begin_layout Itemize -Duration: Specify the duration of the basis function in seconds (default: - 20 s). - -\end_layout - -\begin_layout Itemize -Offset: Specify an offset of the basis function in seconds (default: 0.2 - s). -\end_layout - -\begin_layout Itemize -Dilation: Specify the basis function to model the dilation response. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -LDRF_GM: Use gamma probability density function to model the dilation response - (default). -\end_layout - -\begin_layout Itemize -LDRF_GU: Use a smoothed gaussian function to model the dilation response. -\end_layout - -\end_deeper -\begin_layout Itemize -Constriction: Specify the basis function to model the constriction response. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -LCRF_GM: Use gamma probability density function to model the constriction - response (default). -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Output directory -\end_layout - -\begin_layout Standard -Specify the directory where the .mat file with the resulting nuisance data - will be written. -\end_layout - -\begin_layout Subsubsection* -Filename for output -\end_layout - -\begin_layout Standard -Specify the name for the resulting nuisance file. -\end_layout - -\begin_layout Subsubsection* -Overwrite existing file -\end_layout - -\begin_layout Standard -Choose “yes” if you want to overwrite an existing file with the same name. - (Default: No) -\end_layout - -\begin_layout Subsection -Find valid fixations -\begin_inset CommandInset label -LatexCommand label -name "subsec:Find-valid-fixations" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_find_valid_fixations -\end_layout - -\begin_layout Standard -Pupil data time series can contain missing values due to blinks and head - movements. - Additionally, pupil measurements obtained from a video-based eye tracker - depend on the gaze angle, therefore breaks of fixation can be excluded. - Valid fixations can be determined by setting an a priori threshold with - respect to the fixation point (in degree visual angle) for x- or y-gaze-positio -ns. - The input are x- and y-gaze positions converted to length units (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Convert-data" - -\end_inset - -). - The output is a time series with NaN values during invalid fixations (discrimin -ated according to parameters passed to the function). - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Korn:2016a,Hayes:2015a" -literal "true" - -\end_inset - - -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the gaze recordings in length units. -\end_layout - -\begin_layout Subsubsection* -Eyes -\end_layout - -\begin_layout Standard -Choose eyes which should be processed. - If ‘All eyes’ is selected, all eyes which are present in the data will - be processed. - Otherwise only the chosen eye will be processed. - (All eyes [Default], Left eye, Right eye) -\end_layout - -\begin_layout Subsubsection* -Validation method -\end_layout - -\begin_layout Standard -You can either validate the data by indicating a range on the screen (in - degree visual angle) and fixation point(s) or by passing a bitmap representing - the screen and holding a 1 for all the fixations that are valid. -\end_layout - -\begin_layout Itemize - -\series bold -Validation settings -\series default -: Settings to validate fixations within a given range on the screen (in - degree visual angle). -\end_layout - -\begin_deeper -\begin_layout Itemize - -\shape slanted -Visual angle: -\shape default - Range of valid fixations (around a fixation point). - The value has to be in degree visual angle. -\end_layout - -\begin_layout Itemize - -\shape slanted -Distance -\shape default -: Distance between eyes and screen in in length units. -\end_layout - -\begin_layout Itemize - -\shape slanted -Unit -\shape default -: Unit in which the distance is given. -\end_layout - -\begin_layout Itemize - -\shape slanted -Resolution -\shape default -: Resolution to which the fixation point refers (maximum value of the x- - and y-coordinates). - This can be the resolution set in cogent / psychtoolbox (e.g. - [1280 1024]) or the width and height of the screen in length units (e.g. - [50 40]). -\end_layout - -\begin_layout Itemize - -\shape slanted -Fixation point: -\shape default -X- and y-coordinates for the point of fixation with respect to the given - resolution. -\end_layout - -\begin_deeper -\begin_layout Itemize -Default: If default is set, the middle of the screen will be defined as - fixation point. -\end_layout - -\begin_layout Itemize -File: .mat file containing a variable F with an n x 2 matrix. - N should have the length of the recorded data and each row should define - the fixation point for the respective recorded data row. -\end_layout - -\begin_layout Itemize -Point: If the fixation point does not change during the acquisition, specify - x- and y-coordinates of the constant fixation point. -\end_layout - -\end_deeper -\end_deeper -\begin_layout Itemize - -\series bold -Bitmap file -\series default -: .mat file containing a variable called 'bitmap', which is an n x m matrix. - The bitmap represents the display (n=height and m = width) and holds for - each position a 1, where a gaze point is valid, and a 0 otherwise. - Gaze data at invalid positions (indicated by bitmap or outside the display) - are set to NaN. -\end_layout - -\begin_layout Subsubsection* -Channels -\end_layout - -\begin_layout Standard -Enter a list of channels (numbers or names) to work on. - Default is pupil channels. - Channels which depend on eyes will automatically be expanded. - E.g. - pupil becomes pupil_l. -\end_layout - -\begin_layout Subsubsection* -Missing -\end_layout - -\begin_layout Standard -If enabled an additional channel containing additional information about - valid data points will be written. - Data points equal to 1 describe epochs which have been discriminated as - invalid during validation (=missing). - Data points equal to 0 describe epochs of valid data. - This function may be enabled in combination with enabled interpolation. -\end_layout - -\begin_layout Paragraph* -Enabled -\end_layout - -\begin_layout Standard -Missing is enabled. -\end_layout - -\begin_layout Paragraph* -Disabled -\end_layout - -\begin_layout Standard -Missing is disabled. -\end_layout - -\begin_layout Subsubsection* -Output settings -\end_layout - -\begin_layout Standard -Define how the validated data should be stored. -\end_layout - -\begin_layout Paragraph* -File output -\end_layout - -\begin_layout Standard -Write data to a new file or overwrite original data file. -\end_layout - -\begin_layout Itemize -Overwrite original file: Overwrite original data file. -\end_layout - -\begin_layout Itemize -Create new file: Write data into given file. - The original data will be copied to the given file and the new data channels - will, according to the channel output, either be added or replace the original - channels. -\end_layout - -\begin_deeper -\begin_layout Itemize -File path: Path to new file. -\end_layout - -\begin_layout Itemize -File name: Name of new file. -\end_layout - -\end_deeper -\begin_layout Paragraph* -Channel action -\end_layout - -\begin_layout Standard -Choose whether to add the new channels or replace a channel previously added - by this method. - (default: add) -\end_layout - -\begin_layout Subsection -Pupil Foreshortening Error Correction -\begin_inset CommandInset label -LatexCommand label -name "subsec:Pupil-Foreshortening-Error" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_pupil_correct, pspm_pupil_correct_eyelink -\end_layout - -\begin_layout Paragraph* - -\series medium -Perform pupil foreshortening error correction using the equations described - in -\begin_inset CommandInset citation -LatexCommand cite -key "Hayes:2015a" -literal "false" - -\end_inset - -. - To perform correction, we define the coordinate system centered on the - pupil. - In this system, -\begin_inset Formula $x$ -\end_inset - - coordinates grow towards right for a person looking forward in an axis - perpendicular to the screen. - -\begin_inset Formula $y$ -\end_inset - - coordinates grow upwards and -\begin_inset Formula $z$ -\end_inset - - coordinates grow towards the screen. -\end_layout - -\begin_layout Standard -In order to perform PFE, we need both pupil and gaze data. - If the gaze data in the given file is in pixels, we need information about - the screen dimensions and resolution to calculate the pixel to milimeter - ratio. - On the other hand, if the gaze data is in mm, cm, inches, etc., there is - no need to enter any screen size related information. - If the gaze data is in pixels and screen information is not given, the - function emits a warning and exits early. - -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the pupil and gaze recordings. -\end_layout - -\begin_layout Subsubsection* -Screen resolution -\end_layout - -\begin_layout Standard -Specify screen resolution ([width height]) in pixels. - Screen resolution is required only if at least one gaze channel is in pixels. -\end_layout - -\begin_layout Subsubsection* -Screen size -\end_layout - -\begin_layout Standard -Specify screen size ([width height]) in milimeters. - Screen size is required only if at least one gaze channel is in pixels. -\end_layout - -\begin_layout Subsubsection* -Correction method -\end_layout - -\begin_layout Standard -Choose the correction method: -\end_layout - -\begin_layout Itemize -auto: In auto mode, you need to enter -\begin_inset Formula $C_{z}$ -\end_inset - - value. - Other values will be set using the optimized parameters in reference paper. - -\series bold -Note that you should only use auto mode if your geometric setup matches - exactly one of the layouts given in -\series default - -\begin_inset CommandInset citation -LatexCommand cite -key "Hayes:2015a" -literal "false" - -\end_inset - -. - For ease of reference, we include the page from -\begin_inset CommandInset citation -LatexCommand cite -key "Hayes:2015a" -literal "false" - -\end_inset - - that describes the three layouts below. -\end_layout - -\begin_layout Itemize -manual: In manual mode, you need to enter all values defining the geometry. -\end_layout - -\begin_layout Subsubsection* -Geometry Setup -\end_layout - -\begin_layout Standard -To perform correction, we define the coordinate system centered on the pupil. - In this system, x coordinates grow towards right for a person staring at - the screen. - y coordinates grow upwards and z coordinates grow towards the screen. -\end_layout - -\begin_layout Itemize -\begin_inset Formula $C_{x}:$ -\end_inset - -Horizontal displacement of the camera with respect to the eye. - (Unit: milimeters). -\end_layout - -\begin_layout Itemize -\begin_inset Formula $C_{y}$ -\end_inset - -: Vertical displacement of the camera with respect to the eye. - (Unit: milimeters). -\end_layout - -\begin_layout Itemize -\begin_inset Formula $C_{z}$ -\end_inset - -: Eye to camera Euclidean distance if they are on the same x and y coordinates. - (Unit: milimeters). -\end_layout - -\begin_layout Itemize -\begin_inset Formula $S_{x}$ -\end_inset - -: Horizontal displacement of the top left corner of the screen with respect - to the eye. - (Unit: milimeters). -\end_layout - -\begin_layout Itemize -\begin_inset Formula $S_{y}$ -\end_inset - -: Vertical displacement of the top left corner of the screen with respect - to the eye. - (Unit: milimeters). -\end_layout - -\begin_layout Itemize -\begin_inset Formula $S_{z}$ -\end_inset - -: Eye to top left screen corner distance if they are on the same x and y - coordinates. - (Unit: milimeters). -\end_layout - -\begin_layout Standard -Refer to the geometry setup from -\begin_inset CommandInset citation -LatexCommand cite -key "Hayes:2015a" -literal "false" - -\end_inset - -: -\end_layout - -\begin_layout Standard -\begin_inset ERT -status open - -\begin_layout Plain Layout - - -\backslash -begin{figure} -\end_layout - -\begin_layout Plain Layout - - -\backslash -centering -\end_layout - -\begin_layout Plain Layout - - -\backslash -includegraphics[width= -\backslash -linewidth]{Figures/Hayes-Petrov2016_Article_MappingAndCorrectingTheInfluen_svg.pd -f} -\end_layout - -\begin_layout Plain Layout - - -\backslash -caption{Hayes -\backslash -& Petrov, 2015, page 5} -\end_layout - -\begin_layout Plain Layout - - -\backslash -end{figure} -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsubsection* -Channel to correct -\end_layout - -\begin_layout Itemize -Channel definition: Choose the channel definition. - Only the last channel in the file corresponding to the selection will be - corrected. -\end_layout - -\begin_layout Itemize -Channel number: Number of the pupil channel in the PsPM file. -\end_layout - -\begin_layout Subsubsection* -Channel action -\end_layout - -\begin_layout Itemize -add: Add a new preprocessed channel to the PsPM file. - The new channel type will contain a 'pp' suffix at the end if the input - channel did not contain a 'pp' suffix. -\end_layout - -\begin_layout Itemize -replace: Replace previously existing preprocessed channel. - If no preprocessed channel exists, this option behaves the same way as - add option. - (default) -\end_layout - -\begin_layout Subsection -Pupil Size Preprocessing -\begin_inset CommandInset label -LatexCommand label -name "subsec:Pupil-Size-Preprocessing" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_pupil_pp, pspm_pupil_pp_options -\end_layout - -\begin_layout Subparagraph* - -\series medium -Pupil size preprocessing using the steps described in -\begin_inset CommandInset citation -LatexCommand cite -key "kret2018preprocessing" -literal "false" - -\end_inset - -. - This function allows users to preprocess two eyes simultaneously and average - them in addition to offering single eye preprocessing. - Further, users can define segments on which statistics such as min, max, - mean, etc. - will be computed. - We shortly describe the steps performed below: -\end_layout - -\begin_layout Enumerate -Pupil preprocessing is performed in two main steps. - In the first step, the -\begin_inset Quotes eld -\end_inset - -valid -\begin_inset Quotes erd -\end_inset - - samples are determined. - The samples that are not valid are not used in the second step. - Determining valid samples is done by -\end_layout - -\begin_deeper -\begin_layout Enumerate -Range filtering: Pupil size values outside a predefined range are considered - invalid. - This range is configurable. -\end_layout - -\begin_layout Enumerate -Speed filtering: Speed is computed as the 1st difference of pupil size array - normalized by the temporal separation. - Samples with speed higher than a threshold are considered invalid. - The threshold is configurable. -\end_layout - -\begin_layout Enumerate -Edge filtering: Samples at both sides of temporal gaps in the data are considere -d invalid. - Both the duration of gaps and the invalid sample duration before/after - the gaps are configurable. -\end_layout - -\begin_layout Enumerate -Trendline filtering: A data trend is generated by smoothing and interpolating - the data. - Then, samples that are too far away from this trend are considered invalid. - These two steps are performed multiple times in an iterative fashion. - Note that the generated trend is -\series bold -not -\series default - the final result of this function. - The smoothing, invalid threshold and the number of passes are configurable. -\end_layout - -\begin_layout Enumerate -Isolated sample filtering: Isolated and small sample islands are considered - invalid. - The size of the islands and the temporal separation are configurable. -\end_layout - -\end_deeper -\begin_layout Enumerate -In the second step, output smooth signal is generated using the valid samples - found in the previous step. - This is done by performing filtering, upsampling and interpolation. - The parameters of the filtering and upsampling are configurable. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the pupil and gaze recordings. -\end_layout - -\begin_layout Subsubsection* -Channel to correct -\end_layout - -\begin_layout Itemize -Channel definition: Choose the channel definition. - Only the last channel in the file corresponding to the selection will be - corrected. -\end_layout - -\begin_layout Itemize -Channel number: Number of the pupil channel in the PsPM file. -\end_layout - -\begin_layout Subsubsection* -Channel to combine -\end_layout - -\begin_layout Standard -Optionally choose the additional channel to use so that a new, combined - preprocessed channel can be constructed using the two input channels. - The combined channel is created by computing the mean of the two preprocessed - channels. - Note that main and combined input channels -\series bold -must -\series default - correspond to different eyes. -\end_layout - -\begin_layout Itemize -Channel definition: Choose the channel definition. - Only the last channel in the file corresponding to the selection will be - corrected. -\end_layout - -\begin_layout Itemize -Channel number: Number of the pupil channel in the PsPM file. -\end_layout - -\begin_layout Standard -The channel combination feature also considerates the number of NaNs in - the two channels to combine, which follows the rules as below -\end_layout - -\begin_layout Itemize -The channel is considered to be valid if its percentage of NaNs is below - the parameter -\family typewriter -nan_cutoff -\family default -. - The default value of -\family typewriter -nan_cutoff -\family default - is -\family typewriter -10% -\family default -. -\end_layout - -\begin_layout Itemize -If one channel is valid and the other is invalid, then only the valid channel - will be used as the generated channel from combining the two channels. - The invalid channel will not be used. - The valid channel can be either the original data channel or the data channel - to combine. - The metadata of the generated channel will be exactly the same to the used - channel, such as -\family typewriter -pupil_l -\family default - instead of -\family typewriter -pupil_c -\family default -. -\end_layout - -\begin_layout Itemize -If both of two channels are valid or invalid, then they will be combined - following the conventional rule. -\end_layout - -\begin_layout Itemize -A warning is always thrown if any channel is invalid. -\end_layout - -\begin_layout Subsubsection* -Channel action -\end_layout - -\begin_layout Itemize - -\family typewriter -add -\family default -: Add a new preprocessed channel to the PsPM file. - The new channel type will contain a 'pp' suffix at the end if the input - channel did not contain a 'pp' suffix. -\end_layout - -\begin_layout Itemize - -\family typewriter -replace -\family default -: Replace a previously existing preprocessed channel. - If no preprocessed channel exists, this option behaves the same way as - add option. - (default) -\end_layout - -\begin_layout Subsubsection* -Settings -\end_layout - -\begin_layout Itemize - -\family typewriter -default -\family default -: Use the default settings provided in the underlying preprocessing implementati -on. -\end_layout - -\begin_layout Itemize - -\family typewriter -custom -\family default -: In custom settings mode, you can specify any of the settings below according - to your preferences. -\end_layout - -\begin_deeper -\begin_layout Itemize -Minimum allowed pupil diameter: Minimum allowed pupil diameter. - (Unit: in the same unit as the pupil channel) -\end_layout - -\begin_layout Itemize -Maximum allowed pupil diameter: Maximum allowed pupil diameter. - (Unit: in the same unit as the pupil channel) -\end_layout - -\begin_layout Itemize -Island separation min distance: Minimum distance used to consider samples - 'separated'. - Separated samples can later be considered invalid depending on other parameters. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Min valid island width: Minimum temporal width required to still consider - a sample island valid. - If the temporal width of the island is less than this value, all the samples - in the island will be marked as invalid. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Number of medians in speed filter: Number of median to use as the cutoff - threshold when applying the speed filter. -\end_layout - -\begin_layout Itemize -Max gap to compute speed: Only calculate the speed when the gap between - samples is smaller than this value. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Min missing data width: Minimum width of a missing data section that causes - it to be classified as a gap. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Max missing data width: Maximum width of a missing data section that causes - it to be classified as a gap. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Reject before missing data: The section right before the start of a gap - within which samples are to be rejected. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Reject after missing data: The section right after the end of a gap within - which samples are to be rejected. - (Unit: ms) -\end_layout - -\begin_layout Itemize -Deviation filter passes: Number of passes deviation filter makes. -\end_layout - -\begin_layout Itemize -Number of medians in deviation filter: The multiplier used when defining - the threshold. - Threshold equals this multiplier times the median. - After each pass, all the input samples that are outside the threshold are - removed. - Note that all samples (even the ones which may have been rejected by the - previous devation filter pass) are considered. -\end_layout - -\begin_layout Itemize -Butterworth sampling frequency: -\begin_inset Formula $F_{S}$ -\end_inset - - for first order Butterworth filter. - (Unit: Hz) -\end_layout - -\begin_layout Itemize -Butterworth cutoff frequency: Cutoff frequency for first order Butterworth - filter. - (Unit: Hz) -\end_layout - -\begin_layout Itemize -Store intermediate steps: If true, intermediate filter data will be stored - for plotting. - Set to false to save memory and improve plotting performance. -\end_layout - -\begin_layout Itemize -Interpolation upsampling frequency: The upsampling frequency used to generate - the smooth signal. - (Unit: Hz) -\end_layout - -\begin_layout Itemize -Lowpass filter cutoff frequency: Cutoff frequency of the lowpass filter - used during final smoothing. - (Unit: Hz) -\end_layout - -\begin_layout Itemize -Lowpass filter order: Filter order of the lowpass filter used during final - smoothing. -\end_layout - -\begin_layout Itemize -Interpolation max gap: Maximum gap in the used (valid) raw samples to interpolat -e over. - Sections that were interpolated over distances larger than this value will - be set to NaN. - (Unit: ms) -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Segments -\end_layout - -\begin_layout Standard -Optionally define any number of segments. - Simple statistics for each segment will be calculated. - These segments will be stored in the output channel and also will be shown - if plotting is enabled. -\end_layout - -\begin_layout Itemize -Segment start: Start of the segment in seconds. -\end_layout - -\begin_layout Itemize -Segment stop: End of the segment in seconds. -\end_layout - -\begin_layout Itemize -Segment name: Name of the segment. -\end_layout - -\begin_layout Subsubsection* -Plot data -\end_layout - -\begin_layout Standard -Choose whether to plot the result of preprocessing and possibly various - filtering steps performed. -\end_layout - -\begin_layout Subsection -Convert data -\begin_inset CommandInset label -LatexCommand label -name "subsec:Convert-data" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_convert_area2mm, pspm_convert_pixel2unit_core -\end_layout - -\begin_layout Standard -Provides conversion functions for the specified data (e.g. - pupil data). - Currently conversions from area to diameter and from pixel to length units - are available. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the channels to be converted. -\end_layout - -\begin_layout Subsubsection* -Conversions -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Specify the channel which should be converted. - If 0, functions are executed on all channels. -\end_layout - -\begin_layout Paragraph* -Mode -\end_layout - -\begin_layout Standard -Choose conversion mode. -\end_layout - -\begin_layout Itemize - -\shape italic -Area to diameter -\end_layout - -\begin_layout Itemize - -\shape italic -Pixel to unit -\shape default -: Convert pupil gaze coordinates from pixel values to unit values. - The unit values can be distance units or degree visual angle. - In the latter case, the data are first converted into distance units and - then to visual angle. - Visual angle is expressed in spherical coordinates as two-element vector - where the first element refers to the azimuth angle and the second to the - elevation angle. - The azimuth angle is the counterclockwise angle in the x-y plane measured - in degree from the positive x-axis (This axis is parallel to the screen - pointing toward your right). - The elevation angle is the angle in degree from the x-y plane in z-axis - direction. - The range for the azimuth indicates the angle of the left left edge of - the screen to the angle of the right edge of the screen. - The range for the elevation indicates the angle of the bottom edge of the - screen to the angle of the top edge of the screen. - (mathworks.com/help/matlab/ref/cart2sph.html ). -\end_layout - -\begin_deeper -\begin_layout Itemize -Width: Width of the display window. - Unit is 'mm' if 'degree' is chosen, otherwise Unit. - -\end_layout - -\begin_layout Itemize -Height: Height of the display window. - Unit is 'mm' if 'degree' is chosen, otherwise Unit. - -\end_layout - -\begin_layout Itemize -Unit: Unit to which the measurements should be converted. - The value can contain any length unit (mm, cm, inches, etc.) or 'degree'. - In this case the corresponding data is firstly convertet into 'mm ' and - afterwards the visual angles are computed. -\end_layout - -\end_deeper -\begin_layout Itemize - -\shape italic -Visual angle to scanpath speed: -\shape default - Takes pairs of channels with gaze data in spherical coordinates (i.e. - visual angle) and computes scanpath speed (i.e. - scalar distance per second). - Saves the result into a new channel with chaneltype 'sps' (Scanpath speed). -\end_layout - -\begin_deeper -\begin_layout Itemize -Eyes: Indicates on which eyes the function should be evaluated. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Channel action -\end_layout - -\begin_layout Standard -Choose whether to ‘replace’ the given channel or ‘add’ the converted data - as a new channel. - (default: replace) -\end_layout - -\begin_layout Subsection -Find startle sound onsets -\begin_inset CommandInset label -LatexCommand label -name "subsec:Find-startle-sound" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_find_sounds -\end_layout - -\begin_layout Standard -Translate continuous sound data into an event marker channel. - The function adds a new marker channel to the given data file containing - the sound data and returns the added channel number. - The option threshold, passed in percent to the maximum amplitude of the - sound data, allows to specify the minimum amplitude of a sound to be accepted - as an event. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the imported startle sound data. -\end_layout - -\begin_layout Subsubsection* -Channel -\end_layout - -\begin_layout Standard -Number of channel containing the startle sounds (default: first sound channel). -\end_layout - -\begin_layout Subsubsection* -Threshold -\end_layout - -\begin_layout Standard -Percent of the maximum sound amplitude still being accepted as belonging - to a sound (important for defining the sound onset).(Default: 0.1 [= 10%]). -\end_layout - -\begin_layout Subsubsection* -Region of interest -\end_layout - -\begin_layout Standard -Region of interest for discovering sounds. - Only sounds between the 2 timestamps will be considered. -\end_layout - -\begin_layout Itemize -Whole file -\end_layout - -\begin_layout Itemize -Region -\end_layout - -\begin_layout Subsubsection* -Output -\end_layout - -\begin_layout Paragraph* -Create channel -\end_layout - -\begin_layout Standard -The new data channel contains by default all marker onsets found in the - specified data file. - If you want specific sounds defined by a marker, use the diagnostics option. -\end_layout - -\begin_layout Itemize -Channel action: Add will append the new marker channel as additional channel - to the specified PsPM file. - Replace will overwrite the last marker channel of the PsPM file (be careful - with reference markers). - (Default: ‘add’) -\end_layout - -\begin_layout Paragraph* -Diagnostic -\end_layout - -\begin_layout Standard -Analyze delays between existing marker channel and detected sound onsets. -\end_layout - -\begin_layout Itemize -Diagnostics output -\end_layout - -\begin_deeper -\begin_layout Itemize -Text only: Output delay statistics as text (amount, mean, stddev). -\end_layout - -\begin_layout Itemize -Histogram & plot: Display a histogram of the delays found and a plot with - the detected sound, the marker event and the onset of the sound events. - Color codes are green (smallest delay) and red (longest delay). -\end_layout - -\end_deeper -\begin_layout Itemize -Create channel with specific sounds: Create new data channel which contains - only marker onsets which could have been assigned to a marker in the specified - marker channel (Default: No). -\end_layout - -\begin_deeper -\begin_layout Itemize -Channel action: Add will append the new marker channel as additional channel - to the specified PsPM file. - Replace will overwrite the last marker channel of the PsPM file (be careful - with reference markers). - (Default: ‘add’) -\end_layout - -\end_deeper -\begin_layout Itemize -Marker channel -\end_layout - -\begin_layout Itemize -Max delay: Upper limit in seconds of the window in which sounds are accepted - to belong to a marker. - Default: 3 s -\end_layout - -\begin_layout Itemize -Min delay: Lower limit in seconds of the window in which sounds are accepted - to belong to a marker. - Default: 0 s -\end_layout - -\begin_layout Itemize -Expected sound count: Checks for correct number of detected sounds. - If too few sounds are found, threshold is lowered until specified count - is reached. -\end_layout - -\begin_layout Subsection -Preprocess startle eyeblink EMG -\begin_inset CommandInset label -LatexCommand label -name "subsec:Preprocess-startle-eyeblink" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_emg_pp -\end_layout - -\begin_layout Standard -Preprocess startle eyeblink EMG data for further analysis. - Noise in EMG data will be removed in three steps: Initially the data is - filtered with a 4th order Butterworth filter with cutoff frequencies 50 - Hz and 470 Hz. - Then, Mains frequency will be removed using a notch filter at 50 Hz (can - be changed). - Finally, the data is smoothed and rectified using a 4th order Butterworth - low-pass filter with a time constant of 3 ms (= cutoff at 53.05 Hz). - The applied filter settings are according to the literature -\begin_inset CommandInset citation -LatexCommand cite -key "Khemka:2016a" -literal "true" - -\end_inset - -. - While the input data must be an 'emg' channel, the output will be an 'emg_pp' - channel which is the requirement for startle eyeblink GLM. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the EMG data channel. - -\end_layout - -\begin_layout Subsubsection* -Options -\end_layout - -\begin_layout Paragraph* -Channel -\end_layout - -\begin_layout Standard -Channel ID of the channel containing the unprocessed EMG data. -\end_layout - -\begin_layout Paragraph* -Mains frequency -\end_layout - -\begin_layout Standard -The frequency of the alternating current (AC) which will be filtered out - using bandstop filter. -\end_layout - -\begin_layout Paragraph* -Channel action -\end_layout - -\begin_layout Standard -Defines whether the processed data should be added as a new channel or replace - the last existing channel of the same data type. - After preprocessing the data will be stored as 'emg_pp' channel. - (default: add) -\end_layout - -\begin_layout Subsection -Gaze Preprocessing -\begin_inset CommandInset label -LatexCommand label -name "subsec:Gaze-Preprocessing" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_convert_gaze -\end_layout - -\begin_layout Standard -Convert gaze data from degree or distance units such as pixels or mm into - degree data or scanpath speed. - The gaze data must be oriented such that the point 0,0 relates the bottom-left - of the screen, and the maximal x and y points relate to the top-right of - the screen. - These functions do not accept input channels, they will seacrch the provided - data file for channels with the gaze_[x|y]_[l|r] chantype in the specified - from unit. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing the gaze recordings. -\end_layout - -\begin_layout Subsubsection* -Conversion -\end_layout - -\begin_layout Paragraph* -Degree To Scanpath Speed -\end_layout - -\begin_layout Standard -Convert existing degree data to scanpath speed, stored as chantype: sps_[l|r] -\end_layout - -\begin_layout Paragraph* -Distance To Degree -\end_layout - -\begin_layout Standard -Convert distance x/y coordinate data to degrees stored as chantype: gaze_[x|y]_[ -l|r], unit: degree -\end_layout - -\begin_layout Itemize -From - unit to covert from, [ pixel, mm, cm, inches, m ] -\end_layout - -\begin_layout Itemize -Width - The width of the screen in mm -\end_layout - -\begin_layout Itemize -Height - The height of the screen in mm -\end_layout - -\begin_layout Itemize -Distance - The distance to the screen from the subjects eyes, in mm -\end_layout - -\begin_layout Paragraph* -Distance To Scanpath Speed -\end_layout - -\begin_layout Standard -Convert distance x/y coordinate data to scanpath speed, stored as chantype: - sps_[l|r] -\end_layout - -\begin_layout Itemize -From - unit to covert from, [ pixel, mm, cm, inches, m ] -\end_layout - -\begin_layout Itemize -Width - The width of the screen in mm -\end_layout - -\begin_layout Itemize -Height - The height of the screen in mm -\end_layout - -\begin_layout Itemize -Distance - The distance to the screen from the subjects eyes, in mm -\end_layout - -\begin_layout Subsubsection* -Channel Action -\end_layout - -\begin_layout Standard -Defines whether the processed data should be added as a new channel or replace - the last existing channel of the same chantype and unit. -\end_layout - -\begin_layout Subsection -Preprocessing SCR -\begin_inset CommandInset label -LatexCommand label -name "subsec:Pre-processing SCR" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_scr_pp -\end_layout - -\begin_layout Standard -Applies skin conductance response (SCR) preprocessing for the given data. - The function applies to two rules: (1) microsiemens values must be within - range (0.05 to 60), (2) Absolute slope of value change must be less than - 10 microsiemens per second. - -\end_layout - -\begin_layout Paragraph* -Data file -\end_layout - -\begin_layout Standard -Specify a file name or a cell array of file names. -\end_layout - -\begin_layout Paragraph* -Parameters -\end_layout - -\begin_layout Itemize -Minimum value: Minimum SCR value in -\begin_inset Formula $μS$ -\end_inset - -, default as 0.05 -\begin_inset Formula $μS$ -\end_inset - -. -\end_layout - -\begin_layout Itemize -Maximum value: Maximum SCR value in -\begin_inset Formula $μS$ -\end_inset - -, default as 60 -\begin_inset Formula $μS$ -\end_inset - -. -\end_layout - -\begin_layout Itemize -Maximum slope: Maximum slope in -\begin_inset Formula $\frac{μS}{s}$ -\end_inset - -, default as 10 -\begin_inset Formula $\frac{μS}{s}$ -\end_inset - -. -\end_layout - -\begin_layout Itemize -Missing epochs filename: Name of the .mat file where the missing epochs will - be stored. -\end_layout - -\begin_layout Itemize -Deflection threshold: Amplitude threshold which excludes epochs from the - filter if the overall deflection over this epoch is below it. - Default: 0.1 . -\end_layout - -\begin_layout Itemize -Island threshold: Duration threshold (seconds) which determines the maximum - length of data between NaN epochs. - Islands of data shorter than this threshold will be removed. - Default: 0 s (no threshold). -\end_layout - -\begin_layout Itemize -Expand epochs: Duration threshold (seconds) which determines by how much - data on the flanks of artefact epochs will be removed. - Default: 0.5 s. -\end_layout - -\begin_layout Itemize -clipping_step_size: the step size in moving average algorithm for detecting - clipping, default as 2. -\end_layout - -\begin_layout Itemize -clipping_threshold: the proportion of local maximum in a step, default as - 0.1. -\end_layout - -\begin_layout Paragraph -Channel action -\end_layout - -\begin_layout Standard -Defines whether the new channel should be added or the previous outputs - of this function should be replaced, default as replaced. -\end_layout - -\begin_layout Section -First level -\end_layout - -\begin_layout Subsection -\begin_inset CommandInset label -LatexCommand label -name "sec:General-GLM" - -\end_inset - -GLM (modality-independent options) -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -General linear convolution models (GLM) are powerful for analysing evoked - responses in various modalities that follow an event with (approximately) - fixed latency. - This is similar to standard analysis of fMRI data. - The user specifies events for different conditions. - These are used to estimate the mean response amplitude per condition. - These mean amplitudes can later be compared, using the contrast manager. -\end_layout - -\begin_layout Subsubsection* -Model Filename & output directory -\end_layout - -\begin_layout Standard -Specify file name and directory where the *.mat file with the resulting model - will be written. -\end_layout - -\begin_layout Subsubsection* -Modality specific Channel -\end_layout - -\begin_layout Standard -Indicate the channel containing the modality specific data. - By default the -\series bold -last -\series default - modality specific channel is assumed to contain the data for this model. - If the last modality specific channel does not contain the data for this - model (e. - g. - there are two modality specific channels), indicate the channel number - (within the modality specific file) that contains the data for this model. -\end_layout - -\begin_layout Standard -Note: If modality is pupil, the function loads the channels according to - a precedence order and then uses the last channel among all these loaded - ones. - The precedence order is given below: -\end_layout - -\begin_layout Enumerate -Combined pupil channels (by definition also preprocessed): These channels - are constructed by averaging the data from both left and right eye after - performing pupil preprocessing on both of these channels. -\end_layout - -\begin_layout Enumerate -Preprocessed pupil channels corresponding to best eye: Best eye is defined - as the channel having less amount of missing data. - If there is only one eye in PsPM file, then that eye is defined as the - best eye. -\end_layout - -\begin_layout Enumerate -Preprocessed pupil channels: In case there are two eyes and the best eye - channel is not preprocessed, then PsPM prefers the preprocessed channel. -\end_layout - -\begin_layout Enumerate -Best eye pupil channels: When there is no preprocessed channels, PsPM prefers - the best eye channel. -\end_layout - -\begin_layout Subsubsection* -Time Units -\end_layout - -\begin_layout Standard -Indicate the time units on which the specification of the conditions will - be based. - Time units can be specified in ‘seconds’, number of ‘markers’, or number - of data ‘samples’ . - Time units refer to the beginning of the data file and not to the beginning - of the original recordings e. - g. - if data were trimmed. -\end_layout - -\begin_layout Paragraph* -Option for marker channels: -\end_layout - -\begin_layout Itemize -Marker Channel: Indicate the marker channel. - By default the first marker channel is assumed to contain the relevant - markers. - Markers are only used if you have specified the time units as ‘markers’. - -\end_layout - -\begin_layout Subsubsection* -Data & Design -\end_layout - -\begin_layout Standard -Add the required number of data files or sessions here. - These will be concatenated for analysis. -\end_layout - -\begin_layout Paragraph* -Data File -\end_layout - -\begin_layout Standard -Add the data file containing the modality specific data (and potential marker - information). - If you have trimmed your data, add the file containing the trimmed data. -\end_layout - -\begin_layout Paragraph* -Missing Epochs -\end_layout - -\begin_layout Standard -Indicate epochs in your data in which the modality specific signal is missing - or corrupted (e.g., due to artifacts). - NaN values in the signal will be interpolated for filtering and downsampling - and later automatically removed from data and design matrix. - -\end_layout - -\begin_layout Itemize -No Missing Epochs: The whole time series will be analyzed (default). -\end_layout - -\begin_layout Itemize -Define Missing Epochs: Define the start and end points of the missing epochs - either as epoch files or manually. - Missing epochs will be excluded from the design matrix. - Start and end points have to be defined in seconds starting from the beginning - of the session. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Standard -- Missing Epoch File: Indicate an epoch file specifying the start and end - points of missing epochs. - The mat file has to contain a variable ‘epochs’, which is an m x 2 array, - where m is the number of missing epochs. - The first column marks the start points of the epochs that are excluded - from the analysis and the second column the end points. -\end_layout - -\begin_layout Standard -- Enter Missing Epochs Manually (m: nr. - of epochs): Enter the start and end points of missing epochs manually. - Specify an m x 2 array, where m is the number of missing epochs. - The first column marks the start points of the epochs that are excluded - from the analysis and the second column the end points. - -\end_layout - -\end_deeper -\begin_layout Paragraph* -Design -\end_layout - -\begin_layout Standard -Specify the timing of the events within the design matrix. - Timing can be specified in ‘seconds’, ‘markers’ or ‘samples’ with respect - to the beginning of the data file. - See ‘Time Units’ settings. - Conditions can be specified manually or by using multiple condition files - (i.e., an SPM-style mat file). - There are several possibilities to specify the design. - All of them require you to state, for each condition: -\end_layout - -\begin_layout Itemize -Name of the experimental condition -\end_layout - -\begin_layout Itemize -Onsets: vector of event onsets for this condition, expressed in seconds, - marker numbers, or samples, as specified in time units. - If seconds, do use precise values according to the data type (e. - g. - at least 0.1 s time resolution for SCR) -\end_layout - -\begin_layout Itemize -Durations (optional, default 0): vector of durations of each event for this - condition. - You need to use 'seconds' or 'samples' as time units -\end_layout - -\begin_layout Itemize -Parametric modulators: this is used to specify regressors that specify how - responses in an experimental condition depend on a parameter to model the - effect e.g. - of habituation, reaction times, or stimulus ratings. - For each parametric modulator a new regressor is included in the design - matrix. - To create this column, the normalized parameters are multiplied with the - respective onset regressors. - Parametric modulators require: -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -Names for each parametric modulator for this condition -\end_layout - -\begin_layout Itemize -Actual values: a vector for each parameter for this condition, containing - as many numbers as there are onsets -\end_layout - -\begin_layout Itemize -Polynomial degree. - A value of 1 leaves the parametric modulator unchanged and thus corresponds - to a linear change over the values of the parametric modulator (first-order). - Higher order modulation introduces further columns that contain the non-linear - parametric modulators [e.g., second-order: (squared), third-order (cubed), - etc]. -\end_layout - -\end_deeper -\begin_layout Itemize -Condition File: Create a file with the following variables: -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -names: a cell array of string for the names of all experimental conditions -\end_layout - -\begin_layout Itemize -onsets: a cell array of number vectors for the event onsets with the same - number of elements as names -\end_layout - -\begin_layout Itemize -durations (optional, default 0): a cell array of vectors for the duration - of each event -\end_layout - -\begin_layout Itemize -pmod (optional): a struct array with the same number of elements as names, - and containing the fields -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -name: cell array of names for each parametric modulator for this condition -\end_layout - -\begin_layout Itemize -param: cell array of vectors for each parameter for this condition, containing - as many numbers as there are onsets -\end_layout - -\begin_layout Itemize -poly (optional, default 1): specifies the polynomial degree -\end_layout - -\end_deeper -\begin_layout Itemize -e.g. - produce a simple multiple condition file by typing: -\family typewriter -names = {'condition a', 'condition b'}; onsets = {[1 2 3], [4 5 6]}; save('testf -ile', 'names', 'onsets'); -\end_layout - -\end_deeper -\begin_layout Itemize -Enter conditions manually: -\end_layout - -\begin_deeper -\begin_layout Itemize -Name: Specify the name of the condition. -\end_layout - -\begin_layout Itemize -Onsets: Specify a vector of onsets. - -\end_layout - -\begin_layout Itemize -Durations: Typically, a duration of 0 is used to model an event onset. - If all events included in this condition have the same length specify just - a single number. - If events have different durations, specify a vector with the same length - as the vector for onsets. -\end_layout - -\begin_layout Itemize -Parametric Modulator(s) [optional] (n: nr. - of pmods): If you want to include a parametric modulator, specify a vector - with the same length as the vector for onsets. - -\end_layout - -\begin_deeper -\begin_layout Enumerate -Name: Specify the name of the parametric modulator. -\end_layout - -\begin_layout Enumerate -Polynomial Degree: Specify an exponent that is applied to the parametric - modulator. - -\end_layout - -\begin_layout Enumerate -Parameter Values: Specify a vector with the same length as the vector for - onsets. -\end_layout - -\end_deeper -\end_deeper -\begin_layout Itemize -Define conditions from distinct values or names of event markers: This option - defines event onsets according to the values or names of events stored - in the a marker channel. - These values or names are imported for some data types. -\end_layout - -\begin_deeper -\begin_layout Itemize -Condition-defining values/names -\end_layout - -\begin_layout Itemize -Name: the names of the conditions in the same order as the conditioning-defining - values/names -\end_layout - -\end_deeper -\begin_layout Itemize -No condition - If there is no condition, it is mandatory to specify a nuisance - file (e. - g. - for illuminance GLM, see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Prepare-illuminance-GLM" - -\end_inset - -). -\end_layout - -\begin_layout Paragraph* -Nuisance File (optional) -\end_layout - -\begin_layout Standard -You can include nuisance parameters such as motion parameters in the design - matrix. - Nuisance parameters are not convolved with the canonical response function. - This is also used for the illuminance GLM (see -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Prepare-illuminance-GLM" - -\end_inset - -). - The file has to be either a .txt file containing the regressors in columns, - or a .mat file containing the regressors in a matrix variable called R. - There must be as many values for each column of R as there are data values - in your data file. - PsPM will call the regressors pertaining to the different columns R1, R2, - ... - -\end_layout - -\begin_layout Subsubsection* -Normalize -\end_layout - -\begin_layout Standard -Specify if you want to z-normalize the modality specific data for each subject. - For within-subjects designs, this is highly recommended, but for between-subjec -ts designs it needs to be set to false. - -\end_layout - -\begin_layout Subsubsection* -Centering -\end_layout - -\begin_layout Standard -Specify if you want to mean centering the convoluted X data. - By default this centering is applied to every model but for some specific - cases such as some scanpath length analysis it has to be set to 0 (i.e. - False). -\end_layout - -\begin_layout Subsubsection* -Filter Settings -\end_layout - -\begin_layout Standard -Specify how you want filter the modality specific data. -\end_layout - -\begin_layout Paragraph* -Default -\end_layout - -\begin_layout Standard -Standard settings for the Butterworth bandpass filter. - These are the optimal settings for the modaliy specific data. -\end_layout - -\begin_layout Paragraph* -Edit Settings -\end_layout - -\begin_layout Standard -Create your own filter settings (not encouraged). -\end_layout - -\begin_layout Itemize -Low-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Itemize -Enable -\end_layout - -\begin_deeper -\begin_layout Enumerate -Cutoff Frequency: Specify the low-pass filter cutoff in Hz. -\end_layout - -\begin_layout Enumerate -Filter Order: Specify the low-pass filter order. -\end_layout - -\end_deeper -\begin_layout Itemize -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -High-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Itemize -Enable -\end_layout - -\begin_deeper -\begin_layout Enumerate -Cutoff Frequency: Specify the high-pass filter cutoff in Hz. -\end_layout - -\begin_layout Enumerate -Filter Order: Specify the high-pass filter order. -\end_layout - -\end_deeper -\begin_layout Itemize -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -New Sampling Rate: Specify the sampling rate in Hz to down sample modality - specific data. - Enter NaN to leave the sampling rate unchanged. -\end_layout - -\begin_layout Itemize -Filter Direction {uni, bi}, (default: uni): A unidirectional filter is applied - twice in the forward direction. - A ‘bidirectional’ filter is applied once in the forward direction and once - in the backward direction to correct the temporal shift due to filtering - in forward direction. -\end_layout - -\begin_layout Subsubsection* -Create information on missing data values -\end_layout - -\begin_layout Standard -Option to extract information over missing values in each condition of the - GLM. - This option extracts the ratio of NaN-values over all trials for each condition -, and whether this ratio exceeds a cutoff value. - The information is stored in the GLM structure and will be used in future - releases for excluding values during extraction and first-level contrasts. - -\end_layout - -\begin_layout Itemize - -\shape italic -No -\end_layout - -\begin_layout Itemize - -\shape italic -Yes -\shape default -: Need to define the segment length and a cutoff value -\end_layout - -\begin_deeper -\begin_layout Itemize -Segment length: Length of segments. - -\end_layout - -\begin_layout Itemize -Cutoff: Value which represents upperbound for the ratio of NaN-values in - the trials. - -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Specify whether you want to overwrite existing mat files. -\end_layout - -\begin_layout Subsection -GLM for SCR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM [ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2009aa,Bach:2010ad,Bach:2013aa,Bach:2014aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. - Standard is to use a canonical skin conductance response function (SCRF) - with time derivative for later reconstruction of the response peak. - -\end_layout - -\begin_layout Paragraph* -SCRF0 -\end_layout - -\begin_layout Standard -SCRF without derivatives. -\end_layout - -\begin_layout Paragraph* -SCRF1 -\end_layout - -\begin_layout Standard -SCRF with time derivative (default). - This is the recommended option based on the publication -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2014aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Paragraph* -SCRF2 -\end_layout - -\begin_layout Standard -SCRF with time and dispersion derivative. -\end_layout - -\begin_layout Paragraph* -FIR -\end_layout - -\begin_layout Standard -Uninformed finite impulse response (FIR) model: specify the number and duration - of time bins to be estimated. -\end_layout - -\begin_layout Itemize -Arguments -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Standard -- N: Number of Time Bins: Number of time bins. -\end_layout - -\begin_layout Standard -- D: Duration of Time Bins: Duration of time bins (in seconds). -\end_layout - -\end_deeper -\begin_layout Subsection -GLM for evoked HPR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Paulus:2016aa" -literal "true" - -\end_inset - -]. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -HPRF_E -\end_layout - -\begin_layout Itemize -Arguments -\end_layout - -\begin_deeper -\begin_layout Itemize -Number of basis functions -\end_layout - -\end_deeper -\begin_layout Paragraph* -FIR -\end_layout - -\begin_layout Standard -Uninformed finite impulse response (FIR) model: specify the number and duration - of time bins to be estimated. -\end_layout - -\begin_layout Itemize -Arguments -\end_layout - -\begin_deeper -\begin_layout Itemize -N: Number of Time Bins: Number of time bins. -\end_layout - -\begin_layout Itemize -D: Duration of Time Bins: Duration of time bins (in seconds). -\end_layout - -\end_deeper -\begin_layout Subsection -GLM for fear-conditioned HPR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Castegnetti:2016aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -Function -\end_layout - -\begin_layout Subparagraph* -HPRF_FC0 -\end_layout - -\begin_layout Standard -HPRF_FC without derivatives. -\end_layout - -\begin_layout Subparagraph* -HPRF_FC1 -\end_layout - -\begin_layout Standard -HPRF_FC with time derivative. -\end_layout - -\begin_layout Paragraph* -SOA -\end_layout - -\begin_layout Standard -Specify custom SOA for response function. - Tested values are 3.5 s, 4 s and 6 s. - Default: 3.5 s -\end_layout - -\begin_layout Subsection -GLM for fear-conditioned PSR -\begin_inset CommandInset label -LatexCommand label -name "subsec:GLM-for-fear-conditioned" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Korn:2016a" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -PSRF_FC0 -\end_layout - -\begin_layout Standard -PSRF_FC with CS only and without derivatives. -\end_layout - -\begin_layout Paragraph* -PSRF_FC1 -\end_layout - -\begin_layout Standard -PSRF_FC with CS and derivatives for CS (default). -\end_layout - -\begin_layout Paragraph* -PSRF_FC2 -\end_layout - -\begin_layout Standard -PSRF_FC with CS and US. - Without derivatives. -\end_layout - -\begin_layout Paragraph* -PSRF_FC3 -\end_layout - -\begin_layout Standard -PSRF_FC with US only and without derivatives. -\end_layout - -\begin_layout Subsubsection* -Default Channel -\end_layout - -\begin_layout Paragraph* -Best eye -\end_layout - -\begin_layout Standard -Use eye with the fewest NaN values. -\end_layout - -\begin_layout Paragraph* -First left eye -\end_layout - -\begin_layout Standard -Look for first left eye channel. -\end_layout - -\begin_layout Paragraph* -First right eye -\end_layout - -\begin_layout Standard -Look for first right eye channel. -\end_layout - -\begin_layout Subsection -GLM for evoked RAR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2016aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -RARF_E0 -\end_layout - -\begin_layout Standard -RARF_E without time derivative. -\end_layout - -\begin_layout Paragraph* -RARF_E1 -\end_layout - -\begin_layout Standard -RARF_E with time derivative (default). -\end_layout - -\begin_layout Subsection -GLM for fear-conditioned RAR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: . -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -RARF_FC0 -\end_layout - -\begin_layout Standard -RARF_FC early and late response. -\end_layout - -\begin_layout Paragraph* -RARF_FC1 -\end_layout - -\begin_layout Standard -RARF_FC early response with derivative. -\end_layout - -\begin_layout Subsection -GLM for evoked RPR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2016aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -RPRF_E0 -\end_layout - -\begin_layout Standard -RPRF_E without time derivative. -\end_layout - -\begin_layout Paragraph* -RPRF_E1 -\end_layout - -\begin_layout Standard -RPRF_E with derivative. -\end_layout - -\begin_layout Subsection -GLM for evoked RFRR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM[ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2016aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -RFRRF_E0 -\end_layout - -\begin_layout Standard -RFRRF_E without time derivative. -\end_layout - -\begin_layout Paragraph* -RFRRF_E1 -\end_layout - -\begin_layout Standard -RFRRF_E with derivative. -\end_layout - -\begin_layout Subsection -GLM for SEBR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM [ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Khemka:2016a" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Latency -\end_layout - -\begin_layout Standard -Latency is either ‘fixed’ or ‘free’. - If latency is ‘free’, the model estimates the best latency within the given - time window for each regressor (using a dictionary matching algorithm) - and then inverts the GLM with these latencies. - See -\begin_inset CommandInset citation -LatexCommand cite -key "Khemka:2016a" -literal "true" - -\end_inset - - in the context of SEBR. -\end_layout - -\begin_layout Paragraph* -Fixed latency -\end_layout - -\begin_layout Paragraph* -Free latency -\end_layout - -\begin_layout Itemize -Time window - In seconds, specifies over which time window latencies should - be evaluated. - Positive values mean that the response function is shifted to later time - points, negative values that it is shifted to earlier time points. -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -SEBRF0 -\end_layout - -\begin_layout Standard -SEBRF without time derivative (default). -\end_layout - -\begin_layout Paragraph* -SEBRF1 -\end_layout - -\begin_layout Standard -SEBRF with derivative. -\end_layout - -\begin_layout Subsection -GLM for SPS (fear-conditioning) -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_glm, pspm_glm_recon, pspm_get_timing -\end_layout - -\begin_layout Standard -This section only covers modality specific topics for GLM. - Settings applying to all modalities are discussed in the general section - GLM [ -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -]. - -\end_layout - -\begin_layout Subsubsection* -Basis Function -\end_layout - -\begin_layout Standard -Basis functions for the peripheral model. -\end_layout - -\begin_layout Paragraph* -Average scanpath speed -\end_layout - -\begin_layout Standard -This option implements a boxcar function over 2 s before the US time point, - and yields the averaged scan path speed over that interval (i.e. - the scan path length over that interval, divided by 2 s). - (default). -\end_layout - -\begin_layout Paragraph* -SPSRF_FC -\end_layout - -\begin_layout Standard -This option implements a gamma function for fear-conditioned scan path speed - responses, time-locked to the end of the CS-US interval. -\end_layout - -\begin_layout Paragraph* -SOA -\end_layout - -\begin_layout Standard -Specify custom SOA for response function. - Tested values are 3.0 s and 3.5 s. - Default: 3.5 s -\end_layout - -\begin_layout Subsection -Non-Linear Model for SCR -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_dcm, pspm_dcm_inv -\end_layout - -\begin_layout Standard -Non-linear models for SCR are powerful if response timing is not precisely - known and has to be estimated. - A typical example are anticipatory SCR in fear conditioning – they must - occur at some point within a time-window of several seconds duration, but - that time point may vary over trials. - Dynamic causal modelling (DCM) is the framework for parameter estimation. - PsPM implements an iterative trial-by-trial algorithm. - Different from GLM, response parameters are estimated per trial, not per - condition, and the algorithm must not be informed about the condition. - Trial-by-trial response parameters can later be summarized across trials, - and compared between conditions, using the contrast manager. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2010aa,Staib:2015aa" -literal "true" - -\end_inset - - -\end_layout - -\begin_layout Subsubsection* -Model Filename & Output directory -\end_layout - -\begin_layout Standard -Specify file name for the resulting model. - Specify directory where the mat file with the resulting model will be written. -\end_layout - -\begin_layout Subsubsection* -SCR channel -\end_layout - -\begin_layout Standard -Indicate the channel containing the SCR data. - By default the first SCR channel is assumed to contain the data for this - model. - If the first SCR channel does not contain the data for this model (e. - g. - there are two SCR channels), indicate the channel number (within the SCR - file) that contains the data for this model. - -\end_layout - -\begin_layout Subsubsection* -Data & design -\end_layout - -\begin_layout Standard -Add the appropriate number of data files or sessions here. - Results will be concatenated. -\end_layout - -\begin_layout Paragraph* -Data File -\end_layout - -\begin_layout Standard -Add the data file containing the SCR data. - If you have trimmed your data, add the file containing the trimmed data. -\end_layout - -\begin_layout Paragraph* -Design -\end_layout - -\begin_layout Standard -Specify the timings of individual events from your design either by creating - a timing file or by entering the timings manually. - The DCM framework allows you to specify two types of events: -\end_layout - -\begin_layout Standard -Fixed latency (evoked): An event is assumed to elicit an immediate response. - The amplitude of the sympathetic arousal will be estimated, while the latency - and duration of the response are fixed. - This event type is meant to model evoked responses. -\end_layout - -\begin_layout Standard -Flexible latency and duration (event-related): An event is assumed to elicit - sympathetic arousal within a known response window, but with unknown amplitude, - latency and duration. - For each event of this type, specify a time window in which the response - is expected. - PsPM will then estimate the amplitude, duration and latency of the response. - An example for this type of event is an anticipatory response which might - vary in timing between trials (e. - g. - in fear conditioning). - -\end_layout - -\begin_layout Itemize -Timing File: The timing file has to be a .mat file containing a cell array - called 'events'. - For a design with n trials and m events per trial (n × m events in total), - the cell array has to be structured in the following way: Create m cells - in the cell array (one per event type that occurs in each trial). - Each cell defines either a fixed or a flexible event type. - A cell that defines a fixed event type has to contain a vector with n entries, - i.e. - one time point per trial, in seconds, samples or markers. - A cell that defines a flexible type has to contain an array with n rows - and two columns. - The first column specifies the onsets of the time windows for each trial, - while the second column specifies the offsets of the time windows. - It is assumed that all trials have the same structure, i.e. - the same number of fixed and flexible event types. - For individual trials with a different structure you can enter negative - values as time information to omit estimation of a response. - For later comparison between trials of different conditions, it is absolutely - mandatory that they contain the same types of events, to avoid bias. - Hence, if one condition omits an event (e. - g. - unreinforced trials in conditioning experiments), the omitted event needs - to be modelled as well. - -\end_layout - -\begin_layout Itemize -Enter Timing Manually: In the DCM framework, a session is structured in - n individual trials. - Each trial contains m fixed and/or flexible event types. - All trials need to have the same structure. - Create event types to define the structure of a trial and enter the timings - for all events. - -\end_layout - -\begin_deeper -\begin_layout Itemize -Name (optional): Enter a name of the event. - This name can later be used for display and export. -\end_layout - -\begin_layout Itemize -Onsets: For events with a fixed response, specify a vector of onsets. - The length of the vector corresponds to the number of trials (n). - For events with a flexible response, specify a two column array. - The first column defines the onset of the time window in which the response - occurs. - The second column defines the offset. - The number of rows of the array corresponds to the number of trials (n). - All timings are specified in seconds. - -\end_layout - -\end_deeper -\begin_layout Paragraph* -Conditions (optional) -\end_layout - -\begin_layout Standard -Specify the conditions that the individual trials belong to. - This information is not used for the parameter estimation, but it allows - you to later access the conditions in the contrast manager. - -\end_layout - -\begin_layout Itemize -Name: Specify the name of the condition. -\end_layout - -\begin_layout Itemize -Index: Specify a vector of trial indices between 1 and n. - The length of the vector corresponds to the number of events included in - this condition. -\end_layout - -\begin_layout Paragraph* -Missing epochs -\end_layout - -\begin_layout Standard -Indicate epochs in your data in which the signal is missing or corrupted - (e.g., due to artifacts). - Data around missing epochs are split into subsessions and are evaluated - independently if the missing epoch is at least as long as subsession threshold. - NaN periods within the evaluated subsessions will be interpolated for averages - and principal response components. -\end_layout - -\begin_layout Itemize -No Missing Epochs: Missing epochs are detected automatically according to - the data option ‘Subsession threshold’. -\end_layout - -\begin_layout Itemize -Define Missing Epochs: Define the start and end points of the missing epochs - either as epoch files or manually. - Start and end points have to be defined in seconds starting from the beginning - of the session. -\end_layout - -\begin_deeper -\begin_layout Itemize -Missing Epoch File: Indicate an epoch file specifying the start and end - points of missing epochs (m). - The mat file has to contain a variable ‘epochs’, which is an m x 2 array, - where m is the number of missing epochs. - The first column marks the start points of the epochs that are excluded - from the analysis and the second column the end points. -\end_layout - -\begin_layout Itemize -Enter Missing Epochs Manually: Enter the start and end points of missing - epochs (m) manually. - Specify an m x 2 array, where m is the number of missing epochs. - The first column marks the start points of the epochs that are excluded - from the analysis and the second column the end points. - -\end_layout - -\end_deeper -\begin_layout Standard - -\shape italic -Note: pspm_dcm calculates the inter-trial intervals as the duration between - the end of a trial and the start of the next one. - ITI value for the last trial in a session is calculated as the duration - between the end of the last trial and the end of the whole session. - Since this value may differ significantly from the regular ITI duration - values, it is not used when computing the minimum ITI duration of a session. -\end_layout - -\begin_layout Standard - -\shape italic -Minimum of session specific min ITI values is used -\end_layout - -\begin_layout Enumerate - -\shape italic -when computing mean SCR signal -\end_layout - -\begin_layout Enumerate - -\shape italic -when computing the PCA from all the trials in all the sessions. -\end_layout - -\begin_layout Standard - -\shape italic -In case of case (2), after each trial, all the samples in the period with - duration equal to the just mentioned overall min ITI value is used as a - row of the input matrix. - Since this minimum does not use the min ITI value of the last trial in - each session, the sample period may be longer than the ITI value of the - last trial. - In such a case, pspm_dcm is not able to compute the PCA and emits a warning. -\end_layout - -\begin_layout Standard - -\shape italic -The rationale behind this behaviour is that we observed that ITI value of - the last trial in a session might be much smaller than the usual ITI values. - For example, this can happen when a long missing data section starts very - soon after the beginning of a trial. - If this very small ITI value is used to define the sample periods after - each trial, nearly all the trials use much less than available amount of - samples in both case (1) and (2). - Instead, we aim to use as much data as possible in (1), and perform (2) - only if this edge case is not present. -\end_layout - -\begin_layout Standard - -\shape italic -In PsPM 5.1.0, pspm_dcm can determine the last trials that is less than the - given cut-off value (default as 7s). -\end_layout - -\begin_layout Subsubsection* -Data Options -\end_layout - -\begin_layout Paragraph* -Normalization -\end_layout - -\begin_layout Standard -Specify if you want to normalize the SCR data for each subject. - For within-subjects designs, this is highly recommended. - During analysis, data are always z-transformed, but the parameter estimates - are transformed back if this is set to false. -\end_layout - -\begin_layout Paragraph* -Filter Settings -\end_layout - -\begin_layout Standard -Specify if you want filter the SCR data. -\end_layout - -\begin_layout Itemize -Default: Standard settings for the Butterworth bandpass filter. - These are the optimal settings from -\begin_inset CommandInset citation -LatexCommand cite -key "Staib:2015aa" -literal "true" - -\end_inset - -: bidirectional Butterworth band pass filter with cutoff frequencies of - 0.0159 Hz and 5 Hz, downsampling to 10 Hz. -\end_layout - -\begin_layout Itemize -Edit Settings: Create your own filter (discouraged). -\end_layout - -\begin_deeper -\begin_layout Itemize -Low-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Enumerate -Enable -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Standard -- Cutoff Frequency: Specify the low-pass filter cutoff in Hz. -\end_layout - -\begin_layout Standard -- Filter Order: Specify the low-pass filter order. -\end_layout - -\end_deeper -\begin_layout Enumerate -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -High-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Enumerate -Enable -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Standard -- Cutoff Frequency: Specify the high-pass filter cutoff in Hz. -\end_layout - -\begin_layout Standard -- Filter Order: Specify the high-pass filter order. -\end_layout - -\end_deeper -\begin_layout Enumerate -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -New Sampling Rate: Specify the sampling rate in Hz to down sample SCR data. - Enter NaN to leave the sampling rate unchanged. -\end_layout - -\begin_layout Itemize -Filter Direction {uni, bi}, (default: bi): A unidirectional filter is applied - twice in the forward direction. - A ‘bidirectional’ filter is applied once in the forward direction and once - in the backward direction to correct the temporal shift due to filtering - in forward direction. -\end_layout - -\end_deeper -\begin_layout Paragraph* -Subsession threshold -\end_layout - -\begin_layout Standard -Specify the minimum duration (in seconds) of NaN periods to be considered - as missing epochs. - Data around missing epochs is then split into subsessions, which are evaluated - independently. - This setting is ignored for sessions having set missing epochs manually. -\end_layout - -\begin_layout Paragraph* -Last trial cutoff [s] (default: 7s) -\end_layout - -\begin_layout Standard -Define a cutoff value for using the parameters estimated from the last trial. - If there are fewer data after the end of the last trial in a session than - the given cutoff value (in second), the estimated parameters from this - trial will be assumed inestimable and set to -\shape italic -NaN -\shape default - after the inversion. - This value can be set as -\shape italic -inf -\shape default - to always retain the parameters in the last trial. - The default value for this field is 7 s, corresponding to the time at which - the canonical SCRF has decayed to around 80% of its peak value. -\end_layout - -\begin_layout Paragraph* -Constrained model -\end_layout - -\begin_layout Standard -This option can be set to one if the flexible responses have fixed dispersion - (0.3 s SD) but flexible latency. - If the option is set, the value must be 0 or 1. - The default value is 0. - -\end_layout - -\begin_layout Subsubsection* -Response Function Options -\end_layout - -\begin_layout Paragraph* -Estimate the Response Function from The Data -\end_layout - -\begin_layout Standard -A response function can be estimated from the data and used instead of the - canonical response function (default 0 for fully flexible and 1 for fix - and flex/fix paradigms). - This is not normally recommended unless you have long inter trial intervals - in the range of 20-30 s -\begin_inset CommandInset citation -LatexCommand cite -key "Staib:2015aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Paragraph* -Only Estimate RF (Do Not Do Trial-Wise DCM) -\end_layout - -\begin_layout Standard -This option can be used to estimate an individual response function to be - used in analysis of another experiment. -\end_layout - -\begin_layout Paragraph* -Call External File to Provide Response Function -\end_layout - -\begin_layout Standard -Call an external file to provide a response function, which was previously - estimated using the option "only estimate RF". -\end_layout - -\begin_layout Subsubsection* -Inversion Options -\end_layout - -\begin_layout Paragraph* -Number of Trials to Invert at The Same Time (default: 2 s) -\end_layout - -\begin_layout Standard -The iterative DCM algorithm accounts for response overlap by considering - several trials at a time. - This can be set here. -\end_layout - -\begin_layout Paragraph* -SF-Free Window Before First Event [s] (default: 2 s) -\end_layout - -\begin_layout Standard -The DCM algorithm automatically models spontaneous fluctuations in inter - trial intervals. - Here, you can define a time window before the first event in every trial - in which no spontaneous fluctuation will be estimated. -\end_layout - -\begin_layout Paragraph* -SF-Free Window After Last Event [s] (default: 5 s) -\end_layout - -\begin_layout Standard -The DCM algorithm automatically models spontaneous fluctuations in inter - trial intervals. - Here, you can define a time window after the last event in every trial - in which no spontaneous fluctuation will be estimated. -\end_layout - -\begin_layout Paragraph* -Maximum Frequency of SF in ITIs [Hz] (default: 0.5 Hz) -\end_layout - -\begin_layout Standard -The DCM algorithm automatically models spontaneous fluctuations in inter - trial intervals. - Here you can define the minimal delay between two subsequent spontaneous - fluctuations. -\end_layout - -\begin_layout Paragraph* -SCL-Change-Free Window Before First Event [s] (default: 2 s) -\end_layout - -\begin_layout Standard -The DCM algorithm automatically models baseline drifts in inter trial intervals. - Here, you can define a window before the first event in every trial in - which no change of the skin conductance level will be assumed. -\end_layout - -\begin_layout Paragraph* -SCL-Change-Free Window After Last Event [s] (default: 5 s) -\end_layout - -\begin_layout Standard -The DCM algorithm automatically models baseline drifts in inter trial intervals. - Here, you can define a window after the last event in every trial in which - no change of the skin conductance level will be assumed. -\end_layout - -\begin_layout Subsubsection* -Display Options -\end_layout - -\begin_layout Paragraph -Display Progress Window -\end_layout - -\begin_layout Standard -Show a on-line diagnostic plot for each iteration of the estimation process. -\end_layout - -\begin_layout Paragraph* -Display Intermediate Windows -\end_layout - -\begin_layout Standard -Show small plots displaying the progress of each iteration in the estimation - process. -\end_layout - -\begin_layout Subsection -SF models -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_sf -\end_layout - -\begin_layout Standard -This suite of models is designed for analysing spontaneous fluctuations - (SF) in skin conductance as a marker for tonic arousal. - SF are analysed over time windows that typically last 60 s and should at - least be 15 s long. - PsPM implements 3 different models: (1) Skin conductance level (SCL): this - is the mean signal over the epoch (2) Area under the curve (AUC): this - is the time-integral of the above-minimum signal, divided by epoch duration. - This is designed to be independent from SCL and ideally represents the - number x amplitude of SF in this time window. - (3) Number of SF estimated by DCM (Dynamic Causal Modelling) or MP (Matching - Pursuit): this is a non-linear estimation of the number of SF, and is the - most sensitive indicator of tonic arousal. - It relies on absolute data values as it implements and absolute threshold - for data peaks. - References: -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2011a,Bach:2015aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Standard -The parameter estimates of these different methods have interpretable physical - units: (1) SCL parameters have the same units as the input data, most often - -\begin_inset Formula $\mu S$ -\end_inset - -, (2) AUC parameters have the same units as the input data, most often -\begin_inset Formula $\mu S$ -\end_inset - -, and (3) DCM and MP parameters are the frequency of above-threshold SF, - stated in -\begin_inset Formula $Hz=1/s$ -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Add the data file containing the SCR data (and potential marker information). - If you have trimmed your data, add the file containing the trimmed data. -\end_layout - -\begin_layout Subsubsection* -Model Filename & Output directory -\end_layout - -\begin_layout Standard -Specify file name for the resulting model. - Specify directory where the mat file with the resulting model will be written. -\end_layout - -\begin_layout Subsubsection* -Method -\end_layout - -\begin_layout Standard -Choose the method for estimating tonic sympathetic arousal: AUC (equivalent - to number x amplitude of spontaneous fluctuations), SCL (tonic skin conductance - level), DCM or MP. - The latter two estimate the number of spontaneous fluctuations, requiring - absolute data units as both methods implement an absolute amplitude threshold. - In theory, DCM provides highest sensitivity but is slow -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2011a" -literal "true" - -\end_inset - -. - MP is a very fast approximation to the DCM results, and comparable in sensitivi -ty for analysis of empirical data -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2015aa" -literal "true" - -\end_inset - -. - In simulations, it is less accurate when the expected number of SF exceeds - 10/min. -\end_layout - -\begin_layout Subsubsection* -Time Units -\end_layout - -\begin_layout Standard -Indicate the time units on which the specification of the conditions will - be based. - Time units can be specified in ‘seconds’, number of ‘markers’, or number - of data ‘samples’ . - Time units refer to the beginning of the data file and not to the beginning - of the original recordings e. - g. - if data were trimmed. - Choose 'seconds', 'markers', 'samples', or 'whole' to analyse the entire - data file as one epoch. - -\end_layout - -\begin_layout Paragraph* -Seconds/Markers/Samples -\end_layout - -\begin_layout Itemize -Epochs - define data epochs to analyse -\end_layout - -\begin_deeper -\begin_layout Itemize -Epoch File -\end_layout - -\begin_layout Itemize -Enter Epochs Manually -\end_layout - -\end_deeper -\begin_layout Paragraph* -Markers -\end_layout - -\begin_layout Itemize -Marker Channel (default: 0): Indicate the marker channel. - By default the first marker channel is assumed to contain the relevant - markers. - Markers are only used if you have specified the time units as ‘markers’. - -\end_layout - -\begin_layout Subsubsection* -Filter Settings -\end_layout - -\begin_layout Standard -Specify if you want filter the SCR data. -\end_layout - -\begin_layout Paragraph* -Default -\end_layout - -\begin_layout Standard -Standard settings for the Butterworth bandpass filter: unidirectional Butterwort -h bandpass filter with cut off frequencies of 0.0159 Hz and 5 Hz, down sampling - to 10 Hz. -\end_layout - -\begin_layout Paragraph* -Edit Settings -\end_layout - -\begin_layout Standard -Create your own filter (discouraged). -\end_layout - -\begin_layout Itemize -Low-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Itemize -Enable -\end_layout - -\begin_deeper -\begin_layout Enumerate -Cutoff Frequency: Specify the low-pass filter cutoff in Hz. -\end_layout - -\begin_layout Enumerate -Filter Order: Specify the low-pass filter order. -\end_layout - -\end_deeper -\begin_layout Itemize -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -High-Pass Filter -\end_layout - -\begin_deeper -\begin_layout Itemize -Enable -\end_layout - -\begin_deeper -\begin_layout Enumerate -Cutoff Frequency: Specify the high-pass filter cutoff in Hz. -\end_layout - -\begin_layout Enumerate -Filter Order: Specify the high-pass filter order. -\end_layout - -\end_deeper -\begin_layout Itemize -Disable -\end_layout - -\end_deeper -\begin_layout Itemize -New Sampling Rate: Specify the sampling rate in Hz to down sample SCR data. - Enter NaN to leave the sampling rate unchanged. -\end_layout - -\begin_layout Itemize -Filter Direction): A unidirectional filter is applied twice in the forward - direction. - A ‘bidirectional’ filter is applied once in the forward direction and once - in the backward direction to correct the temporal shift due to filtering - in forward direction. -\end_layout - -\begin_layout Subsubsection* -Channel -\end_layout - -\begin_layout Standard -Indicate the channel containing the SCR data. - By default the first SCR channel is assumed to contain the data for this - model. - If the first SCR channel does not contain the data for this model (e. - g. - there are two SCR channels), indicate the channel number (within the SCR - file) that contains the data for this model. - -\end_layout - -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Specify whether you want to overwrite existing mat file. -\end_layout - -\begin_layout Subsubsection* -Threshold (used for DCM and MP only) -\end_layout - -\begin_layout Standard -Threshold for SN detection - default 0.1 µS. -\end_layout - -\begin_layout Subsubsection* -Display Progress Window (used for DCM and MP only) -\end_layout - -\begin_layout Standard -Show a on-line diagnostic plot for each iteration of the estimation process - (DCM) or for the result of the estimation process (MP). -\end_layout - -\begin_layout Subsubsection* -Display Intermediate Windows (used for DCM only) -\end_layout - -\begin_layout Standard -Show small plots displaying the progress of each iteration in the estimation - process. -\end_layout - -\begin_layout Subsection -Review First-Level Model (via Batch editor) -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_review -\end_layout - -\begin_layout Standard -This module allows you to look at the first-level (within-subject) model - to investigate model fit and potential estimation problems. - This is not necessary for standard analyses. - Further processing can be performed directly on the second level after - first-level model estimation. -\end_layout - -\begin_layout Subsubsection* -Model File -\end_layout - -\begin_layout Standard -Choose model file to review. -\end_layout - -\begin_layout Subsubsection* -Model Type -\begin_inset CommandInset label -LatexCommand label -name "subsec:Model-Type" - -\end_inset - - -\end_layout - -\begin_layout Standard -Specify the type of model. -\end_layout - -\begin_layout Paragraph* -GLM -\end_layout - -\begin_layout Standard -Specify the plot that you wish to display: -\end_layout - -\begin_layout Itemize -Design matrix -\end_layout - -\begin_layout Itemize -Orthogonality -\end_layout - -\begin_layout Itemize -Predicted & Observed -\end_layout - -\begin_layout Itemize -Regressor names -\end_layout - -\begin_layout Itemize -Reconstructed -\end_layout - -\begin_layout Paragraph* -Non-linear model -\end_layout - -\begin_layout Itemize -Inversion results for one trial: Non-linear SCR model (DCM) - Review individual - trials or sequences of trials inverted at the same time. -\end_layout - -\begin_deeper -\begin_layout Itemize -Session Number (Default 1): Data session. - Must be 1 if there is only one session in the file. -\end_layout - -\begin_layout Itemize -Trial Number: Trial to review. -\end_layout - -\end_deeper -\begin_layout Itemize -Predicted & Observed for all trials: Non-linear SCR model for event-related - responses - Review summary plot of all trials. - -\end_layout - -\begin_deeper -\begin_layout Itemize -Session Number -\end_layout - -\begin_layout Itemize -Figure Name [optional]: Adding a figure name saves the figure as .fig file. -\end_layout - -\end_deeper -\begin_layout Itemize -SCRF: Non-linear model for event-related responses - review SCRF (useful - if SCRF was estimated from the data). -\end_layout - -\begin_layout Paragraph* -SF -\end_layout - -\begin_layout Standard -Non-linear model for spontaneous fluctuations: Show inversion results for - one episode -\end_layout - -\begin_layout Itemize -Epoch Number: Epoch to review. -\end_layout - -\begin_layout Paragraph* -Contrasts -\end_layout - -\begin_layout Standard -Display contrast names for any first level model. -\end_layout - -\begin_layout Subsection -First-Level Model Review Manager (via GUI) -\begin_inset CommandInset label -LatexCommand label -name "sec:First-Level-Model-RevGUI" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_review -\end_layout - -\begin_layout Standard -Display information stored in a model file through an easily accessible - interface. - Add a model file to the menu via -\emph on -Add Models -\emph default -. - Available content of a highlighted model is listed on the right hand side - under -\emph on -Figure Selection -\emph default -. - For non-linear models, you can select the session number by entering its - index in the field -\emph on -Session number -\emph default -; GLMs are inverted and displayed across all sessions. - Click on any -\emph on -Display -\emph default - or -\emph on -Show -\emph default - button to visualize information. - Details for each model type are listed in Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "subsec:Model-Type" - -\end_inset - -. -\end_layout - -\begin_layout Subsection -First-Level Contrasts (via Batch editor) -\begin_inset CommandInset label -LatexCommand label -name "sec:First-Level-Contrasts-(via" - -\end_inset - - -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_con1 -\end_layout - -\begin_layout Standard -Define within-subject contrasts here for testing on the second level. - Contrasts can be between conditions (GLM), epochs (SF) or trials (Non-linear - SCR models). - Contrast weights should add up to 0 (for testing differences between conditions -/epochs/trials) or to 1 (for testing global/intercept effects across conditions/ -epochs/trials). - Example: an experiment realises a 2 (Factor 1: a, A) x 2 (Factor 2: b, - B) factorial design and consists of 4 conditions: aa, aB, Ab, AB. - Testing the following contrasts is equivalent to a full ANOVA model: Main - effect factor 1: [1 1 -1 -1], Main effect factor 2: [1 -1 1 -1], Interaction - factor 1 x factor 2: [1 -1 -1 1]. - To test condition effects in non-linear models, assign the same contrast - weight to all trials from the same condition. - -\end_layout - -\begin_layout Subsubsection* -Model File(s) -\end_layout - -\begin_layout Standard -Specify the model file for which to compute contrasts. -\end_layout - -\begin_layout Subsubsection* -Specify Contrasts on Datatype -\end_layout - -\begin_layout Standard -Contrasts are usually specified on parameter estimates. - For GLM, you can also choose to specify them on conditions or reconstructed - responses per condition. - In this case, your contrast vector needs to take into account only the - first basis function. - For non-linear SCR models, you can specify contrasts based on conditions - as well. - This will average within conditions. - Use the review manager to extract condition names and their order. - This argument will be ignored for other first-level models. - -\end_layout - -\begin_layout Standard -- Parameter: Use all parameter estimates. -\end_layout - -\begin_layout Standard -- Condition: Contrasts formulated in terms of conditions in a GLM, automatically - detects number of basis functions and uses only the first one (i.e. - without derivatives), or based on assignment of trials to conditions in - DCM. -\end_layout - -\begin_layout Standard -- Reconstructed: Contrasts formulated in terms of conditions in a GLM, reconstru -cts estimated response from all basis functions and uses the peak of the - estimated response. - -\end_layout - -\begin_layout Subsubsection* -Contrast(s) -\end_layout - -\begin_layout Paragraph* -Contrast Name -\end_layout - -\begin_layout Standard -This name identifies the contrast in tables and displays. -\end_layout - -\begin_layout Paragraph* -Contrast Vector -\end_layout - -\begin_layout Standard -This is a vector on all included conditions (GLM), trials (non-linear SCR - model for event-related responses), or epochs (non-linear model for SF). - Shorter vectors will be appended with zeros. - To specify a condition or trial difference, the contrast weights must add - up to zero (e. - g. - was sympathetic arousal in condition A larger than in condition B: c = - [1 -1]). - To specify a summary of conditions or trials, the contrast weights should - add up to 1 to retain proper scaling (e. - g. - was non-zero sympathetic arousal elicited in combined conditions A and - B: c = [0.5 0.5]) . -\end_layout - -\begin_layout Subsubsection* -Delete Existing Contrasts -\end_layout - -\begin_layout Standard -Deletes existing contrasts from the model file. -\end_layout - -\begin_layout Subsubsection* -Z-Scoring -\end_layout - -\begin_layout Standard -Use parameter estimates across all conditions for each parameter/event type, - subtract the mean and divide by the standard deviation, before computing - the contrast. - This option is only available for models with trial-wise parameter estimates. - (default: false) -\end_layout - -\begin_layout Subsection -First level contrast manager (via GUI) -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_con1 -\end_layout - -\begin_layout Standard -The Manager guides you through the setup of pre-defined within-subject contrasts - applied to the parameter estimates of your model. -\end_layout - -\begin_layout Paragraph* -Load Model -\end_layout - -\begin_layout Standard -Import a model file from a subject containing parameter estimates for which - to compute contrasts. -\end_layout - -\begin_layout Paragraph* -Define Contrast Name -\end_layout - -\begin_layout Standard -Enter a name to identify a contrast. - By pressing -\emph on -New Contrast -\emph default -, the contrast is added to the box -\emph on -Contrasts -\emph default -. - You can reset existing contrasts by highlighting a contrast and pressing - -\emph on -Clear Contrast -\emph default - or you can remove contrasts from your model file by pressing -\emph on -Delete Contrast. -\end_layout - -\begin_layout Paragraph* -Define Stats Type -\end_layout - -\begin_layout Standard -Depending on the model (GLM, spontaneous fluctuation or non-linear model), - different data types are available (see Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:First-Level-Contrasts-(via" - -\end_inset - - for details). - Choose the type you want to be entered into a statistical test. -\end_layout - -\begin_layout Paragraph* -\noindent -Define Test -\end_layout - -\begin_layout Standard -\noindent -Three pre-defined types of statistics can be computed on your estimates. - Parameter estimates for individual conditions or trials are grouped by - the user to compute test contrasts. - -\begin_inset Quotes eld -\end_inset - -Group -\begin_inset Quotes erd -\end_inset - - refers to groups of conditions/trials, not to groups of individuals or - datasets. - After choosing the test, you can add or remove conditions/trials to a group - by clicking on them in the -\emph on -Names -\emph default - window. - The color will indicate to which group they belong. -\end_layout - -\begin_layout Itemize -\noindent -Test of intercept: Compute the average of conditions entered in -\emph on -Group 1 -\emph default -. - This option is suitable if you are interested in the main effect of one - or across several conditions. -\end_layout - -\begin_layout Itemize -\noindent -Test of condition differences: Compute the difference between the averages - of conditions/trials in -\emph on -Group 1 -\emph default - and conditions/trials -\emph on -Group 2 -\emph default -. -\end_layout - -\begin_layout Itemize -\noindent -Test of quadratic effects: Here you compute the combined effect of -\emph on -Group 1 -\emph default - and -\emph on -Group 3 -\emph default - against -\emph on -Group 2 -\emph default -. - This option requires at least three conditions/trials. -\end_layout - -\begin_layout Paragraph* -Run -\end_layout - -\begin_layout Standard -Execute computation of statistics. - The contrasts are stored in your model files and can be reviewed any time - using the Review Manager (Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:First-Level-Model-RevGUI" - -\end_inset - -). -\end_layout - -\begin_layout Subsection -Export Statistics -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_exp -\end_layout - -\begin_layout Standard -Export first level statistics to a file for further analysis in statistical - software, or to the screen. -\end_layout - -\begin_layout Subsubsection* -Model File(s) -\end_layout - -\begin_layout Standard -Specify file from which to export statistics. -\end_layout - -\begin_layout Subsubsection* -Stats type -\end_layout - -\begin_layout Standard -Normally, all parameter estimates are exported. - For GLM, you can choose to only export the first basis function per condition, - or the reconstructed response per condition. - For DCM, you can specify contrasts based on conditions as well. - This will average within conditions. - This argument cannot be used for other models. -\end_layout - -\begin_layout Itemize -Parameter: Export all parameter estimates. -\end_layout - -\begin_layout Itemize -Condition: Export all conditions in a GLM, automatically detects number - of basis functions and export only the first one (i.e. - without derivatives), or export condition averages in DCM. - -\end_layout - -\begin_layout Itemize -Reconstructed: Export all conditions in a GLM, reconstructs estimated response - from all basis functions and export the peak of the estimated response. - -\end_layout - -\begin_layout Subsubsection* -Exclude conditions with too many NaN -\end_layout - -\begin_layout Standard -Exclude statistics from conditions with too many NaN values. - This option can only be used for GLM file for which the corresponding option - was used during model setup. - Otherwise this argument is ignored. -\end_layout - -\begin_layout Subsubsection* -Target -\end_layout - -\begin_layout Standard -Export to screen or to file? -\end_layout - -\begin_layout Subsubsection* -Delimiter for Output File -\end_layout - -\begin_layout Standard -Select a delimiter for the output file. - Default is 'tab', you can select from a choice of several options or specify - as free text. -\end_layout - -\begin_layout Section -Second level -\end_layout - -\begin_layout Subsection -Define Second-Level Model -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_con2 -\end_layout - -\begin_layout Standard -Define one-sample and two-sample t-tests on the between-subject (second) - level. - A one-sample t-test is normally used to test within-subject contrasts and - is equivalent to t-contrasts in an ANOVA model A two-sample t-test is required - for between-subjects contrasts or interactions. - This module sets up the model but does not report results. -\end_layout - -\begin_layout Subsubsection* -Test Type -\end_layout - -\begin_layout Standard -Specify the test type. - -\end_layout - -\begin_layout Paragraph* -One Sample T-Test -\end_layout - -\begin_layout Itemize -Model File(s) -\end_layout - -\begin_layout Paragraph* -Two Sample T-Test -\end_layout - -\begin_layout Itemize -Model File(s) 1: Model files for group 1. -\end_layout - -\begin_layout Itemize -Model File(s) 2: Model files for group 2. -\end_layout - -\begin_layout Subsubsection* -Output directory -\end_layout - -\begin_layout Standard -Specify directory where the mat file with the resulting model will be written. -\end_layout - -\begin_layout Subsubsection* -Filename for Output Model -\end_layout - -\begin_layout Standard -Specify name for the resulting model. -\end_layout - -\begin_layout Subsubsection* -Define Contrasts -\end_layout - -\begin_layout Standard -Define which contrasts to use from the model files, and the second level - contrast names. - Names can be read from the first model file, or just be numbered. -\end_layout - -\begin_layout Paragraph* -Read from First Model File -\end_layout - -\begin_layout Itemize -All Contrasts -\end_layout - -\begin_layout Itemize -Contrast Vector: Index of first-level contrasts to use. -\end_layout - -\begin_layout Paragraph* -Number Contrasts -\end_layout - -\begin_layout Itemize -All Contrasts -\end_layout - -\begin_layout Itemize -Contrast Vector: Index of first-level contrasts to use. -\end_layout - -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Specify whether you want to overwrite existing mat file. -\end_layout - -\begin_layout Subsection -Report Second-Level Results -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_rev2 -\end_layout - -\begin_layout Standard -Result reporting for second level model. -\end_layout - -\begin_layout Subsubsection* -Model File -\end_layout - -\begin_layout Standard -Specify 2nd level model file. -\end_layout - -\begin_layout Subsubsection* -Contrast Vector (only accessible from Batch Editor) -\end_layout - -\begin_layout Standard -Index of contrasts to be reported (optional). -\end_layout - -\begin_layout Section -Tools -\end_layout - -\begin_layout Subsection -Display Data -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_display -\end_layout - -\begin_layout Standard -Display PsPM data file in a new figure. -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Specify data file to display. -\end_layout - -\begin_layout Subsection -Data editor -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_data_editor -\end_layout - -\begin_layout Standard -The data editor allows you to visualize data time series and mark epochs, - for example to mark artefacts that should be excluded, for example to be - used as missing epochs in GLM (see -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:General-GLM" - -\end_inset - -). - -\end_layout - -\begin_layout Subsubsection* -Startup -\end_layout - -\begin_layout Standard -The Data edtior can be started from the PsPM window, the Matlabbatch and - from the Matlab command line. - The command line startup requires the PsPM folder to be added to the Matlab - path. - Once that is done, the data editor can be started by typing ' -\family typewriter -pspm_data_editor(argument) -\family default -' in the Matlab command line. - The command accepts two types of arguments. - (i) a path to file, which causes the editor to open the specified file - and to work in the ' -\series bold -file mode -\series default -' or (ii) a data vector which causes the editor to plot the passed data - vector and to work in the ' -\series bold -inline mode -\series default -'. - If no argument is specified, the editor is stared in 'file mode'. -\end_layout - -\begin_layout Subsubsection* -Data modes -\end_layout - -\begin_layout Standard -The data editor differs between two data modes. - The data mode depends on the specified startup argument. -\end_layout - -\begin_layout Paragraph* -File mode -\end_layout - -\begin_layout Standard -Is entered when called from the PsPM window, the Matlabbatch or a file path - or no argument is speciefied at command line startup. - File input/output settings aswell as the Channel view are visible on the - left. - The latter can be used to select the plotted channel. - Multiple selection is possible and the color of the plot corresponds to - the color in the channel list. - File input settings can be used to change the file to be edited, while - the output settings specify where the edited data should be stored to. - It is also possible to specify the output file from when calling the data - editor using Matlabbatch or the argument options.output_file from the Matlab - command line. -\end_layout - -\begin_layout Paragraph -Inline mode -\end_layout - -\begin_layout Standard -Is entered when a data vector is specified as command line startup argument. - Channel view and file input/output settings are hidden. - Once the user exits, the editor returns either the interpolated data or - the selected epochs in a PsPM epoch format. -\end_layout - -\begin_layout Subsubsection* -Data navigation -\end_layout - -\begin_layout Standard -Data navigation can be done by zooming ( -\begin_inset Graphics - filename Figures/icons/button_zoom.PNG - -\end_inset - -) and panning ( -\begin_inset Graphics - filename Figures/icons/button_pan.PNG - -\end_inset - -). - Zooming does only change the horizontal axis. - After zooming axis limits remain fixed when changing the selected channel. - This sometimes may cause data not to be plotted because the data points - are out of the visible range. - Zooming out will make the data appear again. - Panning allows the rearrangement of the plot horizontally and vertically. - After panning the axis limits remain fixed as well and data may disappear - when changing the selected channel. - -\end_layout - -\begin_layout Subsubsection* -Epochs -\end_layout - -\begin_layout Paragraph* -Add epochs -\end_layout - -\begin_layout Standard -New epochs can be added by clicking the 'add epoch' button ( -\begin_inset Graphics - filename Figures/icons/button_add_epoch.PNG - -\end_inset - -). - Once clicked the cursor will change to a crosshair and it is possible to - select data in the plot, which will upon release create a new epoch in - the selected range. - The new epoch will appear on the right side in the epoch list and is marked - in green on the plot. -\end_layout - -\begin_layout Paragraph* -Remove epochs -\end_layout - -\begin_layout Standard -Existing epochs can be removed by clicking the 'remove epoch' button ( -\begin_inset Graphics - filename Figures/icons/button_remove_epoch.PNG - -\end_inset - -). - Once clicked the cursor will change to a crosshair and it is possible to - select the range in which the epochs should be removed. - If an epoch is selected partially, the rest of the epoch will remain. - The epoch-list on the right side will be updated automatically. -\end_layout - -\begin_layout Paragraph* -Epoch navigation -\end_layout - -\begin_layout Standard -In order to navigate between epochs it is either possible to use the epoch - list on the right side or the two epoch navigation buttons ( -\begin_inset Graphics - filename Figures/icons/button_navigate_epochs.PNG - -\end_inset - -). - The selected epoch always corresponds to the selected epoch in the epoch-list - and is marked in black in the plot. -\end_layout - -\begin_layout Subsubsection* -Output format -\end_layout - -\begin_layout Standard -There are two possible output formats. - The output, depending on the data mode, will either be written to a specified - output file (file mode) or will be returned as a data vector (first argument; - inline mode). -\end_layout - -\begin_layout Paragraph* -Epochs -\end_layout - -\begin_layout Standard -If epochs is selected, the output will be a n x 2 vector, where n is the - number of epochs. - The first column marks the onset of the epoch, while the second column - marks the offset of the epoch. - The time unit is seconds. - In file mode the data will be written into the specified mat file in the - variable 'epochs'. -\end_layout - -\begin_layout Paragraph* -Interpolated data -\end_layout - -\begin_layout Standard -If interpolated data is selected, the output will be the specified data - itself with the selected channels (in Channel view) interpolated during - the selected epochs. - In file mode the original channels will be replaced. - If 'Display interpolated curve' is checked the interpolated data will be - displayed in the plot as a dashed line. -\end_layout - -\begin_layout Subsubsection* -Matlabbatch -\end_layout - -\begin_layout Standard -Possible options when the Data editor is started from Matlabbatch. -\end_layout - -\begin_layout Paragraph* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile to be edited. -\end_layout - -\begin_layout Subsection -Rename File -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_ren -\end_layout - -\begin_layout Standard -Rename PsPM data file. - This renames the file and updates the file information. -\end_layout - -\begin_layout Subsubsection* -File -\end_layout - -\begin_layout Standard -Choose how many files to rename. -\end_layout - -\begin_layout Paragraph* -File Name -\end_layout - -\begin_layout Standard -Choose name of original file. -\end_layout - -\begin_layout Paragraph* -New File Name -\end_layout - -\begin_layout Standard -Choose new file name. -\end_layout - -\begin_layout Subsection -Split Sessions -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_split_sessions, pspm_trim -\end_layout - -\begin_layout Standard -Split sessions, defined by trains of markers. - This function is most commonly used to split fMRI sessions when a (slice - or volume) pulse from the MRI scanner has been recorded. - In automatic mode, the function will identify trains of markers and detect - breaks in these marker sequences. - In manual model, you can provide a vector of markers that are used to split - the file. - The individual sessions will be written to new files with a suffix ''_sn'', - and the session number. - You can choose one datafile and, optionally, one missing epochs file, which - will be split at the same points. - By default, the function will use the first marker channel. - Alternatively, you can choose a marker channel number. -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Choose the data file, in which you want to split sessions. - The data file should be a single file, and a cell array is not allowed. -\end_layout - -\begin_layout Subsubsection* -Marker Channel -\end_layout - -\begin_layout Standard -If you have more than one marker channel, choose the marker channel used - for splitting sessions (default: use first marker channel). -\end_layout - -\begin_layout Itemize -Default -\end_layout - -\begin_layout Itemize -Number -\end_layout - -\begin_layout Subsubsection* -Split behaviour -\end_layout - -\begin_layout Standard -Choose whether sessions should be detected automatically or if sessions - should be split according to given marker id's. -\end_layout - -\begin_layout Itemize -Automatic: Detect sessions according to longest distances between markers. -\end_layout - -\begin_layout Itemize -Marker: Split sessions according to given marker id's. -\end_layout - -\begin_layout Subsubsection* -Missing epoch file -\end_layout - -\begin_layout Standard -Split sessions can split the corresponding missing epoch file of the data - file if defined. - Up to one missing epoch file can be added. -\end_layout - -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Choose -\begin_inset Quotes eld -\end_inset - -yes -\begin_inset Quotes erd -\end_inset - - if you want to overwrite existing file(s) with the same name. - -\end_layout - -\begin_layout Subsection -Merge files -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_merge -\end_layout - -\begin_layout Standard -Allows to merge two files by stacking channels. - Multiple pairs of files are allowed and are processed in a sequential manner. - Which means the first element of the second file set is merged into the - first element of first file set and so on. - Therefore first file se and second file set must have the same number of - elements. - Within each pair of files, they are aligned according to the first event - of a given marker channel, or to the start of the file. - The output file consists of an ‘m’ at the beginning and the name of the - first file appended. - -\end_layout - -\begin_layout Subsubsection* -Datafiles -\end_layout - -\begin_layout Standard -Specify the PsPM datafiles to be merged. -\end_layout - -\begin_layout Paragraph* -First file(s) -\end_layout - -\begin_layout Standard -Specify the first of the two files to be merged. - This can be one file or a set of files. - The output file will have the name of the first file prepended with an - ‘m’. -\end_layout - -\begin_layout Paragraph* -Second file(s) -\end_layout - -\begin_layout Standard -Specify the second of the two files to be merged. - This can be one file or a set of files. - This set must have the same length as the set defined as first file(s). -\end_layout - -\begin_layout Subsubsection* -Reference -\end_layout - -\begin_layout Standard -Specify whether to align the files with respect to the first marker or with - respect to the file start. -\end_layout - -\begin_layout Subsubsection* -Options -\end_layout - -\begin_layout Paragraph* -Marker channel -\end_layout - -\begin_layout Standard -Specify for each file (first and second) a channel which should be used - as marker reference. - A 1x2 vector is expected. - If equal to 0, the first marker channel is used. - Default: [0 0] -\end_layout - -\begin_layout Paragraph* -Overwrite existing file(s) -\end_layout - -\begin_layout Standard -Specify whether existing files should be overwritten (Yes) or not (No). - Default: No -\end_layout - -\begin_layout Subsection -Artefact Removal -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_pp, pspm_prepdata -\end_layout - -\begin_layout Standard -This module offers a few basic artifact removal functions. - Currently, median, and butterworth filters -\begin_inset CommandInset citation -LatexCommand cite -key "Kleckner:2017a" -literal "false" - -\end_inset - - are implemented. - The median filter is useful to remove short "spikes" in the data, for example - from gradient switching in MRI. - The Butterworth filter can be used to get rid of high frequency noise that - is not sufficiently filtered away by the filters implemented on-the-fly - during first level modelling. -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Choose the data file. -\end_layout - -\begin_layout Subsubsection* -Channel Number -\end_layout - -\begin_layout Standard -Select the channel to work on. -\end_layout - -\begin_layout Subsubsection* -Filter Type -\end_layout - -\begin_layout Standard -Currently, median and Butterworth filters are implemented. - A median filter is recommended for short spikes, generated for example - in MRI scanners by gradient switching. - A Butterworth filter is applied in most models; check there to see whether - an additional filtering is meaningful. -\end_layout - -\begin_layout Paragraph* -Median Filter -\end_layout - -\begin_layout Itemize -Number of Time Points: Number of time points over which the median is taken. -\end_layout - -\begin_layout Paragraph* -Butterworth Low pass Filter -\end_layout - -\begin_layout Itemize -Cutoff Frequency: Cutoff frequency has to be at least 20Hz. -\end_layout - -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Choose -\begin_inset Quotes eld -\end_inset - -yes -\begin_inset Quotes erd -\end_inset - - if you want to overwrite existing file(s) with the same name. - -\end_layout - -\begin_layout Subsection -Downsample Data -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_down -\end_layout - -\begin_layout Standard -This function downsamples individual channels in a PsPM file to a required - sampling rate, after applying an anti-aliasing Butterworth filter at the - Nyquist frequency. - The resulting data will be written to a new .mat file, prepended with 'd', - and will contain all channels – also the ones that were not downsampled. -\end_layout - -\begin_layout Subsubsection* -Data File -\end_layout - -\begin_layout Standard -Name of the data files to be downsampled. -\end_layout - -\begin_layout Subsubsection* -New Frequency -\end_layout - -\begin_layout Standard -Required sampling frequency. -\end_layout - -\begin_layout Subsubsection* -Channels To Downsample -\end_layout - -\begin_layout Standard -Vector of channels to downsample, or all channels. -\end_layout - -\begin_layout Subsubsection* -Overwrite Existing File -\end_layout - -\begin_layout Standard -Choose -\begin_inset Quotes eld -\end_inset - -yes -\begin_inset Quotes erd -\end_inset - - if you want to overwrite existing file(s) with the same name. - -\end_layout - -\begin_layout Subsection -Interpolate missing data -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_interpolate -\end_layout - -\begin_layout Standard -The function interpolates missing values, either for all continuous channels - in a specified PsPM data file (file mode), or for selected channel(s) only - (channel mode). - In file mode, the function writes all channels to a new file with the same - name prepended by an ‘i’. - In channel mode, the function interpolates data and either replaces a channel - or writes the data to a new channel. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Select data files. -\end_layout - -\begin_layout Subsubsection* -Work mode -\end_layout - -\begin_layout Standard -Specify whether to work on a whole file or just on the specified channel(s). - If whole file is specified, the data will be written to a new file with - the same name prepended by an ‘i’. - Otherwise the specified channel(s) will be written to a new channel or - replace an existing channel in the same file. -\end_layout - -\begin_layout Itemize -File mode -\end_layout - -\begin_deeper -\begin_layout Itemize -Overwrite existing file: Choose -\begin_inset Quotes eld -\end_inset - -yes -\begin_inset Quotes erd -\end_inset - - if you want to overwrite existing file(s) with the same name (Default: - No). -\end_layout - -\end_deeper -\begin_layout Itemize -Channel mode -\end_layout - -\begin_deeper -\begin_layout Itemize -Interpolate channel(s): Specify which channel(s) should be interpolated. -\end_layout - -\begin_layout Itemize -Mode: Specify how to behave with the interpolated data. -\end_layout - -\begin_deeper -\begin_layout Itemize -New channel: Always add as a new channel. -\end_layout - -\begin_layout Itemize -Replace channel: Replace specified channel(s). -\end_layout - -\end_deeper -\end_deeper -\begin_layout Subsection -Extract segments -\end_layout - -\begin_layout Standard - -\shape italic -Related function: -\shape default - -\family typewriter -pspm_extract_segments -\end_layout - -\begin_layout Standard -This function extracts data segments (e.g., for visual inspection of mean - responses per condition). -\end_layout - -\begin_layout Subsubsection* -Mode -\end_layout - -\begin_layout Standard -Either extract all information from a GLM or DCM model structure/file or - define the relevant information manually. - -\end_layout - -\begin_layout Itemize - -\series bold -Automatically read from GLM or DCM -\series default -: Extracts all relevant information from a GLM or DCM model structure/file. - To distinguish between conditions in a DCM, trialnames must be specified - in the DCM definition (before running it). -\end_layout - -\begin_deeper -\begin_layout Itemize - -\shape italic -GLM or DCM -\shape default -structure/file: Give a GLM or DCM structure already loaded to MATLAB or - give the filepath to a GLM or DCM model. -\end_layout - -\begin_deeper -\begin_layout Itemize -When filepath is given, GLM or DCM structure will be loaded to MATLAB automatica -lly. - (From now on called the model) -\end_layout - -\begin_layout Itemize -When the model corresponds to GLM, the data used for segment extraction - is -\family typewriter -model.input.data -\family default -. - This corresponds to the unfiltered input data passed to GLM model fitting - part. -\end_layout - -\begin_layout Itemize -When the model corresponds to GLM, duration of each onset must be given - in -\family typewriter -model.timing.durations -\family default - as seconds -\family typewriter -. -\end_layout - -\begin_layout Itemize -When the model corresponds to DCM, the data used for segment extraction - is -\family typewriter -model.input.scr -\family default -. -\end_layout - -\begin_layout Itemize -When the model corresponds to DCM, the trials that should belong to the - same condition should have the same trial name. - By default, DCM generates different trial names for each trial. - If the input trial names are all different, then all the trials are assumed - to be in the same case. -\end_layout - -\end_deeper -\end_deeper -\begin_layout Itemize - -\series bold -Manual: -\series default - Specify all the settings manually. -\end_layout - -\begin_deeper -\begin_layout Itemize - -\shape italic -Data files -\shape default -: PsPM files from which data segments should be extracted. -\end_layout - -\begin_layout Itemize - -\shape italic -Channel -\shape default -: Channel in specified data file from which the segments should be extracted. -\end_layout - -\begin_layout Itemize - -\shape italic -Conditions -\shape default -: -\end_layout - -\begin_deeper -\begin_layout Itemize -Condition files: Should be in the format of the conditions defined in a - GLM model. - Required fields are names, onsets, duration. -\end_layout - -\begin_layout Itemize -Enter conditions manually: Specify the conditions that you want to include - in your design matrix. -\end_layout - -\begin_deeper -\begin_layout Itemize -Name: Specify the name of the condition. -\end_layout - -\begin_layout Itemize -Onsets: Specify a vector of onsets. - The length of the vector corresponds to the number of events included in - this condition. - Onsets have to be indicated in the specified time unit (‘seconds’, ‘samples’). -\end_layout - -\begin_layout Itemize -Duration: Specify the length of the condition. -\end_layout - -\end_deeper -\end_deeper -\end_deeper -\begin_layout Itemize - -\series bold -Raw: -\series default - Specify all the settings manually (i.e. - choose manual mode) and provide raw data -\end_layout - -\begin_deeper -\begin_layout Itemize - -\shape italic -Data -\shape default -: Numeric raw data or a cell array of numeric raw data. -\end_layout - -\begin_layout Itemize - -\shape italic -Sampling rate -\shape default -: One sampling rate or an array of sampling rates of the corresponding -\shape italic -Data -\shape default -. -\end_layout - -\begin_layout Itemize - -\shape italic -Conditions -\shape default -: -\end_layout - -\begin_deeper -\begin_layout Itemize -Condition files: Should be in the format of the conditions defined in a - GLM model. - Required fields are names, onsets, duration. -\end_layout - -\begin_layout Itemize -Enter conditions manually: Specify the conditions that you want to include - in your design matrix. -\end_layout - -\begin_deeper -\begin_layout Itemize -Name: Specify the name of the condition. -\end_layout - -\begin_layout Itemize -Onsets: Specify a vector of onsets. - The length of the vector corresponds to the number of events included in - this condition. - Onsets have to be indicated in the specified time unit (‘seconds’, ‘samples’). -\end_layout - -\begin_layout Itemize -Duration: Specify the length of the condition. -\end_layout - -\end_deeper -\end_deeper -\end_deeper -\begin_layout Subsubsection* -Options -\end_layout - -\begin_layout Standard -Change values of optional settings. -\end_layout - -\begin_layout Itemize - -\series bold -Timeunit -\series default -: The timeunit in which conditions should be interpreted. -\end_layout - -\begin_deeper -\begin_layout Itemize -Seconds -\end_layout - -\begin_layout Itemize -Samples -\end_layout - -\begin_layout Itemize -Markers -\end_layout - -\end_deeper -\begin_layout Itemize - -\series bold -Marker channel -\series default -: Channel containing the markers referenced in the conditions. - Only needed if option 'Timeunit' is set to 'markers'. -\end_layout - -\begin_layout Itemize - -\series bold -Segment length -\series default -: Length of segments. - If set durations of trials in conditions will be ignored. -\end_layout - -\begin_layout Itemize - -\series bold -NaN-output -\series default -: Option to visualize the ratio of NaN values for each trial for each condition. - Possibilities of visualization: -\end_layout - -\begin_deeper -\begin_layout Itemize -None -\end_layout - -\begin_layout Itemize -Screen: a table of the NaN-ratios is printed on the MATLAB command window. - -\end_layout - -\begin_layout Itemize -File output : a table of the NaN-ratios is saved in a file (Attention: already - existing files get overwritten) -\end_layout - -\begin_deeper -\begin_layout Itemize -File name: defines the name of the file -\end_layout - -\begin_layout Itemize -Path to File: defines the path where the file should be stored -\end_layout - -\end_deeper -\begin_layout Standard -The table printed in the option 'Screen' or 'File output' has the conditions - as columns and all the trials as rows. - For each row there exists only one non-NaN value, which represents the - propotion of the NaN values in the correspondig trial for the corresponding - condition. - The last row indicates the proportion of NaN-values over all trials for - each condition. - -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Output -\end_layout - -\begin_layout Standard -Output settings. -\end_layout - -\begin_layout Itemize - -\series bold -Output file -\series default -: Where to store the extracted segments. -\end_layout - -\begin_deeper -\begin_layout Itemize -File path: Path to file. -\end_layout - -\begin_layout Itemize -File name: Name of file. -\end_layout - -\end_deeper -\begin_layout Itemize - -\series bold -Overwrite existing file -\series default -: Overwrite existing segment files. -\end_layout - -\begin_layout Itemize - -\series bold -Plot -\series default -: Plot means over conditions with standard error of the mean. -\end_layout - -\begin_layout Subsection -Segment mean -\end_layout - -\begin_layout Standard -This function creates means over extracted data segments (as extracted in - ‘Extract segments’). -\end_layout - -\begin_layout Subsubsection* -Segment files -\end_layout - -\begin_layout Standard -Specify the segment files which have been created with the ‘extract segment’ - function. -\end_layout - -\begin_layout Subsubsection* -Output file -\end_layout - -\begin_layout Standard -Where to store the segment mean across the specified files. -\end_layout - -\begin_layout Paragraph* -File path -\end_layout - -\begin_layout Standard -Path to file. -\end_layout - -\begin_layout Paragraph* -File name -\end_layout - -\begin_layout Standard -Name of file. -\end_layout - -\begin_layout Subsubsection* -Adjust method -\end_layout - -\begin_layout Standard -How to deal with different sample rates across segment files. - ‘interpolate’ data segments to highest or ‘downsample’ data segments to - lowest sampling rate. -\end_layout - -\begin_layout Subsubsection* -Overwrite existing file -\end_layout - -\begin_layout Standard -Overwrite existing segment mean files. - -\end_layout - -\begin_layout Subsubsection* -Plot -\end_layout - -\begin_layout Standard -Plot means over segment files with standard error of the mean. -\end_layout - -\begin_layout Subsection -Extract event marker info -\end_layout - -\begin_layout Standard -Allows to extract additional marker information for further processing. - The information can be used to distinguish between different types of events - or for other purposes. - This is usually used to extract marker information from EEG-style data - files such as BrainVision or NeuroScan. -\end_layout - -\begin_layout Subsubsection* -Data file -\end_layout - -\begin_layout Standard -Specify the PsPM datafile containing a marker channel with a markerinfo - field. -\end_layout - -\begin_layout Subsubsection* -Marker channel -\end_layout - -\begin_layout Standard -Specify which marker channel should be used for marker info extraction. -\end_layout - -\begin_layout Subsubsection* -Output -\end_layout - -\begin_layout Paragraph* -File -\end_layout - -\begin_layout Standard -Specify the output file to which the marker info should be written to. -\end_layout - -\begin_layout Paragraph* -Overwrite existing file -\end_layout - -\begin_layout Standard -Overwrite existing marker info files. -\end_layout - -\begin_layout Section -Convenience functions -\end_layout - -\begin_layout Standard -This section is about function which do not directly belong to PsPM but - may have at some point. - There is no support for these functions. - They are kept because they might be useful for some tasks or may serve - as skeleton for other functions. - Convenience functions are located in '/backroom'. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_axpos -\shape default -: Creates position vectors for axes() commands, which can be passed along - the 'Position' argument. - -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_bf_Fourier -\shape default -: Fourier response function for GLM. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_convert_ -\shape default -...: Conversion functions for -\end_layout - -\begin_deeper -\begin_layout Itemize -Illuminance to luminance -\end_layout - -\begin_layout Itemize -Lux to candela -\end_layout - -\begin_layout Itemize -mm to visual degree -\end_layout - -\end_deeper -\begin_layout Itemize - -\shape italic -pspm_find_data_epochs -\shape default -: Find epochs of non-zero values in the given data. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_get_transfer_function -\shape default -: Tries to estimate a SCR transfer function. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_ledalab -\shape default -: Wrapper for Ledalab analysis from within SCRalyze / PsPM. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_peakscore -\shape default -: Calculate event-related responses by scoring the peak response against - a pre-stiumulus baseline. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_predval -\shape default -: Computes evidence for a predictive model. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_scr2ledalab -\shape default -: Export SCRalyze / PsPM files to ledalab. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_sf_get_theta -\shape default -: Create parameters for f_SF, given some SCR data. -\end_layout - -\begin_layout Itemize - -\shape italic -pspm_transfer_fit -\shape default -: Calculates the mean squared error for pulse rates. -\end_layout - -\begin_layout Itemize - -\shape italic -SCR_f_amplitude_check -\shape default -: Check the scaling of SCR/SF amplitudes in functions f_SF and f_SCR. -\end_layout - -\begin_layout Section -Troubleshooting and known problems -\end_layout - -\begin_layout Subsection -Path -\end_layout - -\begin_layout Standard -If the PsPM folder is added to the path with all subfolders, the batch editor - will not work. - Only put the PsPM main folder (containing the function pspm.m) to the path. -\end_layout - -\begin_layout Subsection -Diagnostic graphics for non-linear model inversion -\end_layout - -\begin_layout Standard -During non-linear model inversion, a diagnostic window is displayed for - each trial. - Between two trials, there is a short period of time during which several - tabs appear in that window. - If you click on one of the hidden tabs in that moment, model inversion - will fail due to a display error. -\end_layout - -\begin_layout Subsection -Export statistics into text format with tab delimiter -\end_layout - -\begin_layout Standard -The tab delimiter in the exported files is not correctly interpreted by - text editors like MS Word. - Nonetheless, the data can be imported into softwares such as Excel or SPSS. -\end_layout - -\begin_layout Part -Tutorial -\end_layout - -\begin_layout Standard - -\shape italic -Contributed by Christoph Korn & Matthias Staib. -\end_layout - -\begin_layout Section -GLM for SCR tutorial: Appraisal data -\begin_inset CommandInset label -LatexCommand label -name "sec:tutorial_GLM" - -\end_inset - - -\end_layout - -\begin_layout Standard -Here, we analyze SCR data using a general linear model (GLM). - The example data set comprises SCR data from 15 participants and can be - downloaded from -\begin_inset CommandInset href -LatexCommand href -name "https://bachlab.github.io/PsPM/software/" -target "https://bachlab.github.io/PsPM/software/" -literal "false" - -\end_inset - -. - Results from this data set have been previously published -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2013aa,Bach:2014aa" -literal "true" - -\end_inset - -. - Each participant saw 45 neutral and 45 aversive pictures within one session - that included two short breaks. - SCR data were recorded using a 0.5 V coupler, optical (wave to pulse) transducer -, and CED Spike, with a minimum sampling rate of 100 Hz. - Be aware that this example uses functions from the MATLAB Signal Processing - Toolbox, make sure to have it installed before starting the tutorial. -\end_layout - -\begin_layout Subsection -Import -\end_layout - -\begin_layout Standard -We import the SCR data and the corresponding marker data. - We first import data from one subject. -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - Data Preparation -\begin_inset Formula $\rightarrow$ -\end_inset - - Import -\emph default -. -\end_layout - -\begin_layout Itemize -Specify the Data Type. - Several data formats are available. - The current data set is in the smr format. -\end_layout - -\begin_layout Itemize -Select the SCR Data File of the first subject -\family typewriter -trsp_1_25.smr -\family default -. -\end_layout - -\begin_layout Itemize -Specify the -\emph on -Channels -\emph default -. - We need one SCR channel and one marker channel. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -The -\emph on -Channel Number -\emph default - of the SCR channel is 2. -\end_layout - -\begin_layout Itemize -For the -\emph on -Transfer Function -\emph default - choose -\emph on -None -\emph default -. -\end_layout - -\begin_layout Itemize -For the -\emph on -Channel Number -\emph default - of the marker channel put in -\emph on -Search -\emph default - to test the automatic search (otherwise you can specify the number of the - marker channel manually. - In this data set, the marker channel is 6). -\end_layout - -\end_deeper -\begin_layout Standard -See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:import" - -\end_inset - - for a picture of the final batch editor. - We recommend saving the batch and script so that you can easily re-run - your analyses at a later time point (see Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Adapting-scripts-for" - -\end_inset - -). - Run the batch. - A mat file with the name -\family typewriter -pspm_trsp_1_25.mat -\family default - will be created in the same folder as the original data file. -\end_layout - -\begin_layout Standard -You can have a look at the imported data by loading this file into MATLAB. - The cell array data contains two structures. - The first one contains the SCR data and the second one the marker data - (this data set contains 96 markers). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY1_import.png - scale 50 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Batch editor for importing raw SCR data. -\begin_inset CommandInset label -LatexCommand label -name "fig:import" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection -Trim -\end_layout - -\begin_layout Standard -Most of the time, the SCR recording is switched on some time before the - actual experiment starts and is switched off some time after it ends. - These parts of the time series may contain large artifacts from subject - motion, setting up the equipment, etc. - Trimming excludes these parts from the analyses. -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY2_trim.png - scale 50 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Batch editor for trimming SCR data. -\begin_inset CommandInset label -LatexCommand label -name "fig:trim" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - Data Preparation -\begin_inset Formula $\rightarrow$ -\end_inset - -Trim -\emph default -. -\end_layout - -\begin_deeper -\begin_layout Itemize -Select the currently imported file as Data File. - Alternatively, you can use the -\emph on -Dependency -\emph default - button. -\end_layout - -\end_deeper -\begin_layout Itemize -You can choose different References to specify how data should be trimmed. - Here, select -\emph on -First/Last Marker -\emph default - and -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -From (seconds after first marker) -\emph default -: +110 (In the current data set the first 2 minutes are a task-relevant - baseline period and are thus trimmed. - Note that a positive number will delete at least the first marker of the - original data. - Thus, make sure that a possible specification of the First-Level takes - this into account.) -\end_layout - -\begin_layout Itemize - -\emph on -To (seconds after first marker) -\emph default -: 10 (The specified time window should be large enough to completely include - the last trial.) -\end_layout - -\end_deeper -\begin_layout Standard -You can also specify time points before the markers by using negative numbers - (see above). - See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:trim" - -\end_inset - - for a picture of the final batch editor. - Again, it is recommended to save the batch and script for future use. - Run the batch. - A mat file with the name -\family typewriter -tpspm_trsp_1_25.mat -\family default - will be created (i.e., a “t” will be prepended). -\end_layout - -\begin_layout Subsection -First-Level -\end_layout - -\begin_layout Standard -Now, we specify the GLM on the first (i.e., the subject-specific) level, estimatin -g average responses per experimental condition (this equivalent to averaging - responses over trials in classical "peak scoring" analysis, or to performing - a first level analysis in SPM). -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - First Level -\begin_inset Formula $\rightarrow$ -\end_inset - - SCR -\begin_inset Formula $\rightarrow$ -\end_inset - -GLM -\shape italic -\emph default - for SCR -\shape default -. -\end_layout - -\begin_layout Itemize - -\emph on -Model Filename -\emph default -: This is the name of the resulting mat file containing the GLM. - Here, we call it -\family typewriter -glm_25 -\family default -. -\end_layout - -\begin_layout Itemize - -\emph on -Output Directory -\emph default -: The resulting mat file containing the GLM will be saved in this folder. -\end_layout - -\begin_layout Itemize - -\emph on -Time Units -\emph default - on which the specification of the conditions will be based. - Here, we want to analyze with respect to Markers. -\end_layout - -\begin_layout Itemize - -\emph on -Session(s) -\emph default -: Similar to SPM, SCRalyze allows the specification of multiple sessions - per subject. - Here, we only have one session. -\end_layout - -\begin_deeper -\begin_layout Itemize -Add the trimmed data ( -\family typewriter -tpspm_trsp_1_25.mat -\family default -) as Data File. - Alternatively, you can use the -\emph on -Dependency -\emph default - button. -\end_layout - -\begin_layout Itemize - -\emph on -Missing Epochs -\emph default - allows the specification of time periods which you do not want to include - in the analysis for example because they contain corrupted data. - In the example data set, there are no missing epochs. -\end_layout - -\begin_layout Itemize - -\emph on -Data & Design -\emph default -: This option allows specifying the different conditions of the experiment. - You need to provide the information when the different conditions started. - This time information has to be in the unit specified above (see -\emph on -Time Units -\emph default -). - In the current data set, condition information is provided in Markers and - is stored in the mat file -\family typewriter -trSP_appraisal_01_25_onsets_1.mat -\family default -, which you should select as -\emph on -Condition File -\emph default -. - When you open this file in MATLAB, you will see that the file contains - a 1x3 cell “names” and a 1x3 cell “onsets” specifying three conditions. - The numbers in “onsets” correspond to the -\begin_inset Formula $n$ -\end_inset - -th marker when the respective trial started. -\end_layout - -\begin_layout Itemize - -\emph on -Nuisance File -\emph default - allows the inclusion of nuisance confounds such as motion or respiration - parameters. - Here, we leave it empty. -\end_layout - -\end_deeper -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY3_glm.png - scale 40 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Batch editor for First-Level analysis. - -\begin_inset CommandInset label -LatexCommand label -name "fig:firstlevel" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize - -\emph on -Basis Function -\emph default -: We chose the default -\emph on -SCRF 1 -\emph default -, which is the version with time derivative. - The default basis set follows the recommendations by -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2013aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Itemize - -\emph on -Normalize -\emph default -: The design of the current data set is “within-subjects.” Therefore, we - want to z-normalize the data. -\end_layout - -\begin_layout Itemize - -\emph on -Filter Settings -\emph default -: We choose the default filter settings, which follow the recommendations - by -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2013aa" -literal "true" - -\end_inset - -: -\end_layout - -\begin_deeper -\begin_layout Itemize -first-order low-pass Butterworth filter with a cutoff frequency of 5 Hz -\end_layout - -\begin_layout Itemize -first-order high-pass Butterworth filter with a cutoff frequency of 0.05 - Hz -\end_layout - -\begin_layout Itemize -Data are resampled to 10 Hz. -\end_layout - -\begin_layout Itemize -The filter direction is unidirectional. -\end_layout - -\end_deeper -\begin_layout Standard -See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:firstlevel" - -\end_inset - - for a picture of the final batch editor. - Again, we recommend saving the batch and script for future use. - Run the batch. - A mat file with the specified name will be created in the specified folder. - -\end_layout - -\begin_layout Subsection -Review First-Level Model -\end_layout - -\begin_layout Standard -You can have a look at plots related to the first-level model in the batch - editor. -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - First Level -\begin_inset Formula $\rightarrow$ -\end_inset - - Review First-level Model -\emph default -. -\end_layout - -\begin_layout Itemize -Specify the Model file that you want to review. - Select the mat file containing the GLM (e.g., -\family typewriter -glm_25.mat -\family default -). -\end_layout - -\begin_layout Itemize -The -\emph on -Model Type -\emph default - is of course GLM in the current example. - You can set the following options to get different types of information: -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Enumerate - -\emph on -Design matrix -\emph default -: On the x-axis, you see the number of regressors in the model. - Here we have specified 7 regressors in total. - On the y-axis, you see the time course of the experiment. - Note that there are 7 regressors because the specification for the -\emph on -Basis Function -\emph default - was -\emph on -SCRF with time derivative -\emph default -. - That is, 3 (conditions times) x 2 (basis functions) + 1 (constant) = 7 - regressors. - You can see that neutral and aversive are intermixed and fall into three - blocks. - See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:review1" - -\end_inset - -. -\end_layout - -\begin_layout Enumerate - -\emph on -Orthogonality -\emph default -: On the x- and y-axes you see the specified regressors. - Regressor names are additionally specified along the y-axes. - The plot depicts the collinearity between regressors. - See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:review2" - -\end_inset - -. -\end_layout - -\begin_layout Enumerate - -\emph on -Predicted & Observed -\emph default -: You see the model fit including the observed response over the whole time - series, which you can visually compare to the predicted time series by - the specified model. - Note that the predicted data will never follow the observed data very closely, - because we estimated the average response per condition which will deviate - from the response in each individual trial. - See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:review3" - -\end_inset - -. -\end_layout - -\begin_layout Enumerate - -\emph on -Regressor names -\emph default -: The names of the regressors as specified in the -\emph on -Conditions File -\emph default - under -\emph on -Data & Design -\emph default - are written to the MATLAB command window. - The labels bf 1 and bf 2 refer to the two used basis functions ( -\emph on -SCRF with time derivative -\emph default -). -\end_layout - -\begin_layout Enumerate - -\emph on -Reconstructed -\emph default -: Here you see the estimated responses per condition for the first basis - function. - These are estimates of the true responses which contain noise. - The noise term can be negative but if all estimated responses across an - entire group are negative it is a good idea to look for confounds or correlatio -ns in the design. - See Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:review4" - -\end_inset - -. -\end_layout - -\end_deeper -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY41_review.png - scale 50 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Design matrix for sample participant. - On the x-axis, you see the number of regressors in the model. - There are 7 regressors (i.e., 3 (conditions times) x 2 (basis functions) - + 1 (constant)). - -\begin_inset CommandInset label -LatexCommand label -name "fig:review1" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY42_review.png - scale 35 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Design orthogonality plot for sample participant. - On the x- and y-axes you see the 7 specified regressors. - -\begin_inset CommandInset label -LatexCommand label -name "fig:review2" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY43_review.png - scale 35 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Model fit for sample participant. - You see the observed response and the predicted response according to the - model over the whole time series. - -\begin_inset CommandInset label -LatexCommand label -name "fig:review3" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status collapsed - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/YY44_review.png - scale 35 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Estimated responses per condition for sample participant. - You see the estimated responses per condition for the first basis function. - -\begin_inset CommandInset label -LatexCommand label -name "fig:review4" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection -First-Level Contrast Manager -\end_layout - -\begin_layout Standard -We want to compare the difference between aversive and neutral pictures - across participants (i.e., on the second level). - This can be tested in a paired t-test. - A paired t-test is a one-sample t-test on difference values between two - conditions. - The contrast manager allows you to compute such difference values, for - each participant (i.e., on the first level). -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - First-Level -\begin_inset Formula $\rightarrow$ -\end_inset - - First-Level Contrasts -\emph default -. -\end_layout - -\begin_layout Itemize - -\emph on -Model File(s) -\emph default -: Select the mat file containing the GLM (here -\family typewriter -glm_25.mat -\family default -). -\end_layout - -\begin_layout Itemize - -\emph on -Stats type -\emph default -: You can choose between 3 different options to set up the contrasts. - Here, we choose the option Condition, which specifies contrasts formulated - in terms of conditions and automatically uses only the first basis function - (i.e., without derivatives). -\end_layout - -\begin_layout Itemize - -\emph on -Contrast -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Contrast Name -\emph default -: Chose a name so that you can easily refer to the contrast (e.g., aversive>neutra -l) -\end_layout - -\begin_layout Itemize - -\emph on -Contrast Vector -\emph default -: Specify a vector of the contrast you want to test for. - Here, we are interested in the difference between aversive and neutral - pictures, i.e., the first and the second condition. - Therefore, specify the vector [-1, 1, 0]. - You could also leave out the last zero because trailing zeros are automatically - appended. - (But you could not leave out the first zero in a contrast such as [0 -1 - 1].) -\end_layout - -\end_deeper -\begin_layout Subsection -Export Statistics -\end_layout - -\begin_layout Standard -You can use this functionality to export all necessary parameters on the - screen or into an extra file, which allows you to analyze the data in the - statistics program of your choice. - For details see -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - First Level -\emph default - -\emph on - -\begin_inset Formula $\rightarrow$ -\end_inset - - Export Statistics -\emph default -. -\end_layout - -\begin_layout Subsection -Adapting scripts for multiple participants and second-level analyses -\end_layout - -\begin_layout Standard -For didactic purposes, we have so far only considered one participant. - But in most experiments, you want to analyze data from multiple subjects - (i.e., a second-level analysis). - For a description on how to do this see Chapters -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Adapting-scripts-for" - -\end_inset - - and -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Second-level-Contrast-Manager" - -\end_inset - -. - You can find a script that runs the above described analyses for multiple - participants at -\begin_inset CommandInset href -LatexCommand href -name "pspm.sourceforge.net" -target "http://pspm.sourceforge.net" -literal "false" - -\end_inset - - (import_trim_glm_contr_job_loop). - -\end_layout - -\begin_layout Section -Non-linear SCR tutorial: Delay fear conditioning data -\begin_inset CommandInset label -LatexCommand label -name "sec:Delay-fear-conditioning" - -\end_inset - - -\end_layout - -\begin_layout Standard -The example data set comprises SCR data from 20 participants, with 40 trials - each, which can be downloaded from -\begin_inset CommandInset href -LatexCommand href -name "https://bachlab.github.io/PsPM/software/" -target "https://bachlab.github.io/PsPM/software/" -literal "false" - -\end_inset - - together with the result files of the model inversion. - Participants underwent a differential delay fear conditioning paradigm - where coloured circles were presented for 4 seconds each. - Either the blue or orange coloured circles (balanced over participants) - were probabilistically paired with an electric stimulation (unconditioned - stimulus, US) that coterminated with the stimulus (conditioned stimulus, - CS+) while the CS- were always presented alone. -\end_layout - -\begin_layout Standard -Presenting the CS+ causes phasic sympathetic arousal in anticipation of - an electric shock. - This anticipatory reaction typically occurs with an unknown and variable - latency after stimulus onset. - For such cases, a GLM should not be used because it assumes that sympathetic - arousal follows the stimulus with a fixed latency. - In contrast, the non-linear model allows estimating (i) a variable onset - within a user-specified time window and (ii) a variable duration of a sympathet -ic response. - Additionally, the non-linear model includes estimation of spontaneous fluctuati -ons that occur between trials. -\end_layout - -\begin_layout Standard -In this tutorial, the non-linear model is estimated. - The estimated parameters can then be used to test the within-subject hypothesis - that the sympathetic arousal between CS+ and CS- are different on a group - level. -\end_layout - -\begin_layout Subsection -Setup the Non-Linear Model -\end_layout - -\begin_layout Standard -In this step you prepare the model estimation. - For this, you need to provide timing information about the experimental - events which can either be entered manually or as a Matlab file. - For large numbers of events as in this experiment, a timing file can easily - be created using a few lines of Matlab code. - Here we use timing information saved in the trimmed PsPM file. - In this file, a trigger was saved at every CS onset. - For timing information from other sources, the code has to be adapted according -ly. - Go to the Matlab command window and enter the following lines, but replace - -\family typewriter -[insert path!] -\family default - by the correct path where the filtered SCR data from -\begin_inset CommandInset href -LatexCommand href -name "pspm.sourceforge.net" -target "http://pspm.sourceforge.net" -literal "false" - -\end_inset - - is saved on your hard drive, e.g. - -\family typewriter -C: -\backslash -PsPM_Tutorial -\backslash -nonlinear -\backslash - -\family default -. -\end_layout - -\begin_layout Standard -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout -\noindent - -data_path = [insert path!]; % set the correct PsPM file path here! -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -p = 1; % the first participant -\end_layout - -\begin_layout Plain Layout -\noindent - -SOA = 3.5; % delay between CS and US onset in seconds -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% load events of CS onsets from trimmed scr data -\end_layout - -\begin_layout Plain Layout -\noindent - -pname = fullfile(data_path,sprintf('tpspm_s%i.mat',p)) -\end_layout - -\begin_layout Plain Layout -\noindent - -[sts, infos, data, filestruct] = pspm_load_data(pname,'events'); -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -CS_onset = data{1, 1}.data; % recorded triggers of CS onset in seconds -\end_layout - -\begin_layout Plain Layout -\noindent - -US_onset = data{1, 1}.data + SOA; % US starts 3.5 seconds after CS -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% variable latency for CS response between CS onset and US onset/omission -\end_layout - -\begin_layout Plain Layout -\noindent - -events{1} = [CS_onset US_onset]; % define an interval of 3.5 seconds for - each trial -\end_layout - -\begin_layout Plain Layout -\noindent - -% constant onset for US response -\end_layout - -\begin_layout Plain Layout -\noindent - -events{2} = US_onset; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -save(fullfile(data_path,sprintf('event_timings_s%i.mat',p)),'events') -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\noindent -\align left -The resulting file -\family typewriter -event_timings_s1.mat -\family default - contains the variable events with two cells. -\end_layout - -\begin_layout Itemize -The first cell -\emph on -events{1} -\emph default - is a 40 x 2 matrix with the onset and offset of a time window for each - trial in which we expect the response to the CS (both CS+ and CS- are treated - the same here). - We expect the response to the CS to occur with a variable onset in time. - Note that the window for the CS response ends when the US starts (or is - omitted), i.e. - after 3.5 seconds. -\end_layout - -\begin_layout Itemize -The second cell -\emph on -events{2} -\emph default - is a 40 x 1 vector that marks the onset of the electrical stimulation. - For this event we expect an evoked response with constant latency after - US occurrence. - Importantly, we provide timings -\emph on -both for the occurrence and the omission of the US -\emph default -. - Modelling an unconditioned response in all trials is necessary to get unbiased - estimates for the CS responses. - In general, the trial structure should always be the same for all trials, - across experimental conditions. -\end_layout - -\begin_layout Standard -Now the non-linear model estimation can be set up (Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:Prepare-a-batch" - -\end_inset - -). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status collapsed - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/Batch_nonlinear.png - scale 65 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Prepare a batch to set up a non linear model for SCR analysis. -\begin_inset CommandInset label -LatexCommand label -name "fig:Prepare-a-batch" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\emph default - -\begin_inset Formula $\rightarrow$ -\end_inset - - -\emph on - First Level -\family roman -\series medium -\shape up -\size normal -\emph off -\bar no -\strikeout off -\uuline off -\uwave off -\noun off -\color none - -\begin_inset Formula $\rightarrow$ -\end_inset - - -\family default -\series default -\shape default -\size default -\emph on -\bar default -\strikeout default -\uuline default -\uwave default -\noun default -\color inherit - SCR -\begin_inset Formula $\rightarrow$ -\end_inset - - Non-Linear Model -\end_layout - -\begin_layout Itemize - -\emph on -Model Filename -\emph default -: dcm_s1 -\end_layout - -\begin_layout Itemize - -\emph on -Output Directory -\emph default -: Specify a folder where the model will be saved -\end_layout - -\begin_layout Itemize - -\emph on -Chan -\emph default -nel: Default -\end_layout - -\begin_layout Itemize - -\emph on -Data & Design: -\begin_inset Formula $\rightarrow$ -\end_inset - -New: Session -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Data File -\emph default -: choose tpspm_s1.mat from your hard drive -\end_layout - -\begin_layout Itemize - -\emph on -Design -\begin_inset Formula $\rightarrow$ -\end_inset - -Timing File -\begin_inset Formula $\rightarrow$ -\end_inset - - -\emph default -Select the previously created -\family typewriter -event_timings_s1.mat -\family default - which was saved to your scr folder -\end_layout - -\begin_layout Itemize - -\emph on -Condition names: New Condition -\emph default - here we can define conditions that each trial belongs to. - Create three new conditions. - Note that we split CS+ trials in reinforced (CS+|US+) and non-reinforced - (CS+|US-) trials because CS+|US+ trials are excluded from some analyses. -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Condition -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Name: CS+|US- -\end_layout - -\begin_layout Itemize - -\emph on -Index: 6 7 11 14 16 18 26 29 38 40 -\end_layout - -\end_deeper -\begin_layout Itemize - -\emph on -Condition -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Name: CS+|US+ -\end_layout - -\begin_layout Itemize - -\emph on -Index: 13 17 19 20 21 24 28 31 32 37 -\end_layout - -\end_deeper -\begin_layout Itemize - -\emph on -Condition -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Name: CS- -\end_layout - -\begin_layout Itemize - -\emph on -Index: 1 2 3 4 5 8 9 10 12 15 22 23 25 27 30 33 34 35 36 39 -\end_layout - -\end_deeper -\end_deeper -\end_deeper -\begin_layout Itemize - -\emph on -Display Options -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Display Progress Window -\emph default -: If you plan to run the estimation in the background, you can turn off - the progress window with this option -\end_layout - -\end_deeper -\begin_layout Itemize - -\emph on -For the remaining fields you can keep the default settings -\end_layout - -\begin_layout Standard -Save the batch and script as -\family typewriter -batch_model_s1.m -\family default - and press run. - A window will be displayed that shows the progress of model estimation - for each trial. - The estimation for an entire session takes several minutes depending on - your system. - The file -\family typewriter -dcm_s1.mat -\family default - will be created. - If you want to, you can review the first-level model by clicking -\emph on -Review model -\emph default - in the PsPM user interface. - In the new window (Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:Use-Review-Model" - -\end_inset - -) add the non-linear model -\family typewriter -dcm_s1.mat -\family default - and choose -\emph on -Display All trials for one session -\emph default -. - A graphics window (Fig X) will display the original data (blue) together - with the model estimation (green). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/Review_1stmodel1.PNG - scale 50 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Use -\emph on -Review Model -\emph default - to inspect parameter estimation for one or multiple trials. -\begin_inset CommandInset label -LatexCommand label -name "fig:Use-Review-Model" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection -First-level Contrasts -\end_layout - -\begin_layout Standard -In this step you specify the hypothesis that a CS+ elicits a stronger sympatheti -c arousal than a CS- for an individual participant by providing a contrast - weight vector. -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - -First Level -\begin_inset Formula $\rightarrow$ -\end_inset - -First-level Contrasts -\end_layout - -\begin_layout Itemize - -\emph on -Model File(s): -\emph default - Select -\family typewriter -dcm_s1.mat -\end_layout - -\begin_layout Itemize - -\emph on -Specify Contrasts on Datatype: param -\end_layout - -\begin_layout Itemize - -\emph on -Contrasts: New Contrast -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Contrast -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Name: Fear Learning -\end_layout - -\begin_layout Itemize - -\emph on -Contrast Vector: -1 -1 -1 -1 -1 2 2 -1 -1 -1 2 -1 0 2 -1 2 0 2 0 0 0 -1 - -1 0 -1 2 -1 0 2 -1 0 0 -1 -1 -1 -1 0 2 -1 2 -\emph default - Note: A weight of +2 is assigned to the CS+|US- because we have twice as - many CS- and the contrast vector has to sum up to zero. -\end_layout - -\begin_layout Itemize - -\emph on -Name: Electric Stimulation -\emph default - We include this contrast optionally to check if the electrical stimulation - caused an increase in sympathetic arousal which is a premise for successful - fear conditioning. -\end_layout - -\begin_layout Itemize - -\emph on -Contrast Vector: -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 3 -1 3 3 - 3 -1 -1 3 -1 -1 -1 3 -1 -1 3 3 -1 -1 -1 -1 3 -1 -1 -1 -\end_layout - -\end_deeper -\end_deeper -\begin_layout Itemize - -\emph on -Delete: existing contrasts: No (default) -\end_layout - -\begin_layout Standard -Save the batch and script as -\family typewriter -batch_contrast_s1.m -\family default - and press run. - The model file of participant s1 now contains the contrast that can be - forwarded to a statistical test on group level. - Preparing analyses for more than one scr file is explained in Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Adapting-scripts-for" - -\end_inset - -. -\end_layout - -\begin_layout Subsection -Exporting statistics -\end_layout - -\begin_layout Standard -PsPM provides basic tools for statistical analysis on the estimates of the - non-linear model. - Alternatively you can export the results as a text file to use them in - different software applications. -\end_layout - -\begin_layout Itemize -In the batch editor go to SCR -\begin_inset Formula $\rightarrow$ -\end_inset - -First Level -\begin_inset Formula $\rightarrow$ -\end_inset - -Export Data -\end_layout - -\begin_layout Itemize - -\emph on -Model File(s): -\emph default -Select -\emph on -dcm_s1.mat -\end_layout - -\begin_layout Itemize - -\emph on -Specify Export on Datatype: param -\end_layout - -\begin_layout Itemize - -\emph on -Target -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Filename -\emph default -Enter -\emph on - -\family typewriter -\emph default -dcm_s01 -\end_layout - -\end_deeper -\begin_layout Itemize - -\emph on -Specify Delimiter for Output File -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Semicolon -\end_layout - -\end_deeper -\begin_layout Standard -The text file will be saved to Matlab’s current working directory. -\end_layout - -\begin_layout Section -Adapting scripts for multiple participants -\begin_inset CommandInset label -LatexCommand label -name "sec:Adapting-scripts-for" - -\end_inset - - -\end_layout - -\begin_layout Standard -In most experiments, you want to analyze data from multiple subjects, which - implies that you have to repeat model estimation several times. - There are two simple strategies to make this easier. -\end_layout - -\begin_layout Itemize -Use dependencies: You can specify all steps for one subject in one go. - At some points, you need to specify a file from a previous step (e.g., when - trimming you need the file containing the imported data). - In these cases, you can use the button “Dependency” to specify the correspondin -g file, but make sure the number of output files of the preceding module - corresponds with the allowed number of input files for this module. -\end_layout - -\begin_layout Itemize -Loop over participants in the script: You can easily adapt the scripts for - many subjects by including a loop and adapting the file names. - This is independent of whether or not you use dependencies. - To show you how this works, see the examples below. -\end_layout - -\begin_layout Subsection -Importing and trimming data -\end_layout - -\begin_layout Standard -Here, we create an example script for importing and trimming data. - We chose these steps since they are required in all types of analysis. - The current example is based on the Appraisal dataset described in Chapter - -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:tutorial_GLM" - -\end_inset - -. -\end_layout - -\begin_layout Itemize -In the batch editor specify all parameters in PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - Data Preparation -\begin_inset Formula $\rightarrow$ -\end_inset - - Import. -\end_layout - -\begin_layout Itemize -You do not need to specify the SCR Data File. - This will later be put in the script that loops over subjects. -\end_layout - -\begin_layout Itemize -In the batch editor specify all parameters in PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - - Data Preparation -\begin_inset Formula $\rightarrow$ -\end_inset - - Trim. -\end_layout - -\begin_layout Itemize -Use the dependency button to select the imported Data File. -\end_layout - -\begin_layout Itemize -Save batch and script. -\end_layout - -\begin_layout Itemize -Open the saved job script (e.g., -\family typewriter -batch_import_trim_job.m -\family default -) and build a loop around the lines of code that were saved. - In this loop, create a subject-specific filename (and make sure to include - the whole path to the files in the variable data_path). -\end_layout - -\begin_layout Standard -\noindent -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout -\noindent - -data_path = [insert path!]; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -for p = 25:39; % participants -\end_layout - -\begin_layout Plain Layout -\noindent - -% load participant-specific raw data -\end_layout - -\begin_layout Plain Layout -\noindent - -spike.datafile = {fullfile(data_path,sprintf('trsp_1_%i.smr',p))}; -\end_layout - -\begin_layout Plain Layout -\noindent - -spike.importtype{1}.scr.chan_nr.chan_nr_spec = 2; -\end_layout - -\begin_layout Plain Layout -\noindent - -spike.importtype{1}.scr.transfer.none = true; -\end_layout - -\begin_layout Plain Layout -\noindent - -spike.importtype{2}.marker.chan_nr.chan_nr_spec = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.prep{1}.import.datatype.spike = spike; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.prep{1}.import.overwrite = false; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{2}.pspm{1}.prep{1}.trim.datafile(1) = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -cfg_dep('Import: Output File', substruct('.', ... - -\end_layout - -\begin_layout Plain Layout -\noindent - -'val', '{}',{1}, '.','val', ... -\end_layout - -\begin_layout Plain Layout -\noindent - -'{}',{1}, '.','val', '{}',{1}), substruct('()',{':'})); -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{2}.pspm{1}.prep{1}.trim.ref.ref_mrk.from = 110; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{2}.pspm{1}.prep{1}.trim.ref.ref_mrk.to = 10; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{2}.pspm{1}.prep{1}.trim.ref.ref_mrk.mrk_chan.chan_def = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{2}.pspm{1}.prep{1}.trim.overwrite = false; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% run batch -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('initcfg'); -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('run', matlabbatch); -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -end -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\noindent -Run the script. - The folder -\family typewriter -data_path -\family default - now contains trimmed scr files for all subjects. -\end_layout - -\begin_layout Subsection -Inverting non-linear models -\end_layout - -\begin_layout Standard -Here we adapt the model inversion from Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Delay-fear-conditioning" - -\end_inset - - to multiple subjects. - We use similar loops as above to create timing files and PsPM batches. -\end_layout - -\begin_layout Standard -First, open the MATLAB script that created the timing file -\family typewriter -event_timings_s1.mat -\family default - and construct a loop around it for subjects 2 to 20. - Execute the script to obtain files containing timing information for subjects - 2 to 20. - Alternatively you can use the timing files for subjects 2 to 20 downloaded - from -\begin_inset CommandInset href -LatexCommand href -name "pspm.sourceforge.net" -target "http://pspm.sourceforge.net" -literal "false" - -\end_inset - -. -\end_layout - -\begin_layout Standard -Next, open the saved job script (e.g., -\family typewriter -batch_model_s1_job.m -\family default -) created in Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Delay-fear-conditioning" - -\end_inset - - and build a loop around the lines of code that were saved. - Make sure to include the whole path to the files in the variable -\family typewriter -data_path -\family default -. - You can use the following code as guideline. -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout -\noindent - -% set the path where you saved the scr data files -\end_layout - -\begin_layout Plain Layout -\noindent - -data_path = [insert path!]; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% set the path where you saved the model file of participant 1 -\end_layout - -\begin_layout Plain Layout -\noindent - -model_path = [insert path!]; % initiate PsPM pspm_init % loop through participan -ts 2 to 20 -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% initialize PsPM -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_init -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('initcfg') -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -for p = 2:20 -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -clear matlabbatch dcm -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.modelfile = ['dcm_s' num2str(p)]; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.outdir = {model_path}; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.chan.chan_def = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.datafile = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -{fullfile(data_path,['tpspm_s' num2str(p) '.mat'])}; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.timing.timingfile = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -{fullfile(data_path,['event_timings_s' num2str(p) '.mat'])}; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(1).name = 'CS+|US-'; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(1).index = [6 7 11 14 16 18 26 29 38 40]; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(2).name = 'CS+|US+'; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(2).index = [13 17 19 20 21 24 28 31 32 37]; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(3).name = 'CS-'; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.session.condition(3).index = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -[1 2 3 4 5 8 9 10 12 15 22 23 25 27 30 33 34 35 36 39]; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.data_options.norm = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.data_options.filter.def = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.resp_options.crfupdate = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.resp_options.indrf = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.resp_options.getrf = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.resp_options.rf = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.depth = 2; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.sfpre = 2; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.sfpost = 5; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.sffreq = 0.5; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.sclpre = 2; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.sclpost = 5; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.inv_options.ascr_sigma_offset = 0.1; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.disp_options.dispwin = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -dcm.disp_options.dispsmallwin = 0; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.scr{1}.dcm = dcm; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% run batch -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('run', matlabbatch); -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -end -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\noindent -Similarly to the previous step, the batch of the first-level Contrast of - participant 1 is adapted to participants 2 to 20. - Run the following code in MATLAB, but replace -\family typewriter - [insert path!] -\family default - with the path on your hard drive where you saved -\family typewriter -dcm_s1.mat -\family default -: -\begin_inset Newline newline -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout -\noindent - -% set the path where you saved the estimated non-linear model -\end_layout - -\begin_layout Plain Layout -\noindent - -model_path = [insert path!]; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% initialize PsPM -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_init -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('initcfg') -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% loop through participants 2 to 20 -\end_layout - -\begin_layout Plain Layout -\noindent - -for p = 2:20 -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -clear matlabbatch -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.modelfile = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -{fullfile(model_path,['dcm_s' num2str(p) '.mat'])}; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.datatype = 'param'; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.con(1).conname = 'Fear Learning'; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.con(1).convec = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -[-1 -1 -1 -1 -1 2 2 -1 -1 -1 2 -1 0 2 -1 2 0 2 ... -\end_layout - -\begin_layout Plain Layout -\noindent - -0 0 0 -1 -1 0 -1 2 -1 0 2 -1 0 0 -1 -1 -1 -1 0 2 -1 2]; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.con(2).conname = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -'Electric Stimulation'; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.con(2).convec = ... -\end_layout - -\begin_layout Plain Layout -\noindent - -[-1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 -1 3 -1 -1 -1 ... -\end_layout - -\begin_layout Plain Layout -\noindent - -3 -1 3 3 3 -1 -1 3 -1 -1 -1 3 -1 -1 3 3 -1 -1 -1 -1 3 -1 -1 -1]; -\end_layout - -\begin_layout Plain Layout -\noindent - -matlabbatch{1}.pspm{1}.first_level{1}.contrast.deletecon = true; -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -% run batch manually -\end_layout - -\begin_layout Plain Layout -\noindent - -pspm_jobman('run', matlabbatch); -\end_layout - -\begin_layout Plain Layout -\noindent - -\end_layout - -\begin_layout Plain Layout -\noindent - -end -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\noindent -Run the script. - The statistics for each contrast are now added to the model file. -\end_layout - -\begin_layout Section -Second-level Contrast Manager -\begin_inset CommandInset label -LatexCommand label -name "sec:Second-level-Contrast-Manager" - -\end_inset - - -\end_layout - -\begin_layout Standard -In most cases, we want to compare the difference between conditions across - participants on a group level (i.e., the second level in a hierarchical model). - Each participant represents one data point that goes into a one sample - t-test. -\end_layout - -\begin_layout Standard -Below we demonstrate how to set-up Second-level contrasts for GLM and non-linear - models. -\end_layout - -\begin_layout Subsection -GLM -\end_layout - -\begin_layout Standard -For the appraisal data of Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:tutorial_GLM" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection -Define Second-Level Model -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - -Second Level -\begin_inset Formula $\rightarrow$ -\end_inset - -Define Second-Level Model -\emph default -. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Test Type: One Sample T-Test -\end_layout - -\begin_layout Itemize - -\emph on -Model File(s) -\emph default -: Select the model files from all participants -\end_layout - -\begin_layout Itemize - -\emph on -Output Directory: -\emph default - Choose a location to save the group result -\end_layout - -\begin_layout Itemize - -\emph on -Filename for Output Model -\emph default -: Chose a name so that you can easily refer to the contrast -\end_layout - -\begin_layout Itemize - -\emph on -Define Contrast: Read from First Model File -\emph default -: Choose -\emph on -All Contrasts -\emph default -. - This will select the contrast(s) that we created in the first level (i.e., - in our case aversive>neutral) -\end_layout - -\end_deeper -\begin_layout Subsubsection -Report Second-Level Results -\end_layout - -\begin_layout Itemize -In the batch editor go to -\emph on -PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - -Second Level -\begin_inset Formula $\rightarrow$ -\end_inset - -Report Second-Level Results -\emph default -. -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize - -\emph on -Model File -\emph default -: Select the second level model file that you created in the previous step. -\end_layout - -\begin_layout Itemize - -\emph on -Contrast Vector -\emph default -: Leave empty because we want all contrasts to be reported. -\end_layout - -\end_deeper -\begin_layout Standard -Run the batch. - A figure appears that shows you a bar graph of the mean of the parameter - estimates and the statistics will be printed to the MATLAB command window. -\end_layout - -\begin_layout Subsection -Non-linear models -\end_layout - -\begin_layout Standard -Here, we test the difference in anticipatory sympathetic arousal elicited - by a CS+ vs CS- on a group level (see Chapter -\begin_inset CommandInset ref -LatexCommand ref -reference "sec:Delay-fear-conditioning" - -\end_inset - -). - As a supplementary hypothesis we want to check if the US+ indeed elicited - a stronger response than the US-. - From the 1st level contrast, eight statistics were generated for each model - file. - Use the -\emph on -Review Model -\emph default - utility from the PsPM main GUI to get a list of all contrasts. - In the -\emph on -First Level Review Manager -\emph default -, click on -\emph on -Add Model -\emph default -, choose any model file created previously and press -\emph on -Done -\emph default -. - Now press the Show button next to -\emph on -Contrast names in command window -\emph default - (Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:FLRM2" - -\end_inset - -) to get a list of all contrasts: -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 1: Fear Learning - Flexible response # 1: amplitude -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 2: Electric Stimulation - Flexible response # 1: amplitude -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 3: Fear Learning - Flexible response # 1: peak latency -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 4: Electric Stimulation - Flexible response # 1: peak latency -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 5: Fear Learning - Flexible response # 1: dispersion -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 6: Electric Stimulation - Flexible response # 1: dispersion -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 7: Fear Learning - Fixed response # 1 response amplitude -\end_layout - -\begin_layout Itemize - -\emph on -Contrast 8: Electric Stimulation - Fixed response # 1 response amplitude -\end_layout - -\begin_layout Standard -Our hypothesis is concerned only with the response amplitude of the flexible - event (anticipation of the CS) and the response amplitude of the fixed - event (electrical stimulation), which are the first and eighth contrasts. - The indices of these two contrasts are used for the setup of the Second-Level - model below. -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/reviewmodel.png - scale 35 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -The First Level Review Manager displays all contrasts that are stored in - a model file. -\begin_inset CommandInset label -LatexCommand label -name "fig:FLRM2" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Itemize -In the batch editor go to PsPM -\begin_inset Formula $\rightarrow$ -\end_inset - -Second Level -\begin_inset Formula $\rightarrow$ -\end_inset - -Define Second-Level Model -\end_layout - -\begin_layout Itemize -Test Type: One Sample T-Test -\end_layout - -\begin_layout Itemize -Model File(s): Select the model files from all participants -\end_layout - -\begin_layout Itemize -Output Directory: Choose a location to save the group result -\end_layout - -\begin_layout Itemize -Filename for Output Model: Fear_Learning -\end_layout - -\begin_layout Itemize -Define Contrast: Read from First Model File -\begin_inset Separator latexpar -\end_inset - - -\end_layout - -\begin_deeper -\begin_layout Itemize -Contrast Vector: [1, 8] -\end_layout - -\end_deeper -\begin_layout Itemize -Overwrite Existing File: No (default) -\end_layout - -\begin_layout Standard -Run the batch. - You can display the results of the second level contrasts by pressing -\emph on -Report 2nd level result -\emph default - in the PsPM user interface and choosing -\family typewriter -Fear_Learning.mat -\family default -. - A Figure displays the mean differences and standard error for the hypothesis - that the CS+ elicits a stronger sympathetic arousal than CS- and that an - electric stimulation results in an increase in sympathetic arousal (Figure - -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:Display-of-results" - -\end_inset - -). - Statistical parameters are printed in the MATLAB command window (Figure - -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:Statistics-from-one-sampled" - -\end_inset - -). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/2ndlvl_bars.PNG - scale 35 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Display of results from a group analysis (2nd level). - Left bar: difference in amplitude of sympathetic arousal (aSA) to CS+|US- - minus CS-. - Right bar: difference in aSA to US+ minus US- -\begin_inset CommandInset label -LatexCommand label -name "fig:Display-of-results" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Standard -\begin_inset Float figure -placement H -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/2ndlvl_table.PNG - scale 50 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -Statistics from one-sampled t-tests CS|US- minus CS- and US+ minus US- for - 20 participants. -\begin_inset CommandInset label -LatexCommand label -name "fig:Statistics-from-one-sampled" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Section -Calling PsPM functions directly from the Matlab command line -\end_layout - -\begin_layout Standard -All the above mentioned steps in this tutorial can also be done in the Matlab - command line without using the Matlabbatch syntax. - Calling PsPM functions allows fast analysis of the data, efficient processing - of multiple subject data and gives a lot more flexibility when it comes - to fine tuning. - However, this also requires knowledge about the Matlab command line and - about the PsPM functions used. - In this section we will revisit some examples from above and go through - them by calling PsPM functions directly. - -\end_layout - -\begin_layout Subsection* -Basic PsPM setup -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - Here we setup the command line environment. - This includes adding PsPM to the path as well as creating path variables - for other information such as the path where the tutorial data is located. - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% The path where the 'Tutorial_data_GLM' folder is located -\end_layout - -\begin_layout Plain Layout - -work_path = 'Path where the data is located'; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Where to find the tutorial data -\end_layout - -\begin_layout Plain Layout - -tutorial_data = [work_path filesep 'Tutorial_data_GLM']; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% The path where PsPM is located -\end_layout - -\begin_layout Plain Layout - -pspm_path = 'Path where PsPM is located'; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Add PsPM to the search path of matlab -\end_layout - -\begin_layout Plain Layout - -addpath(pspm_path); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% initialise PsPM -\end_layout - -\begin_layout Plain Layout - -pspm_init; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Change path to the working directory -\end_layout - -\begin_layout Plain Layout - -cd(work_path); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Define for which subject we want to execute this code: -\end_layout - -\begin_layout Plain Layout - -subject = 25; -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Import the data -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - Here we will import the data from an aquisition file into a PsPM-Matlab - file which we can later use to fit a GLM. - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% Compose name of datafile and combine with the path where to find it. -\end_layout - -\begin_layout Plain Layout - -data_file_name = sprintf('trsp_1_%i.smr', subject); -\end_layout - -\begin_layout Plain Layout - -data_file = [tutorial_data filesep data_file_name]; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% With the option overwrite you can tell whether to overwrite existing -\end_layout - -\begin_layout Plain Layout - -% files (=true) or not (=false). -\end_layout - -\begin_layout Plain Layout - -options = struct('overwrite', true); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Define which channels should be imported and what are the settings of -\end_layout - -\begin_layout Plain Layout - -% those. - This tells the function to import channel 2 as SCR channel -\end_layout - -\begin_layout Plain Layout - -% with transfer function disabled and a marker channel, which should be -\end_layout - -\begin_layout Plain Layout - -% found automatically (therefore no channel id is provided). -\end_layout - -\begin_layout Plain Layout - -import = { ... -\end_layout - -\begin_layout Plain Layout - - struct('type', 'scr', 'channel', 2, 'transfer', 'none'), ... -\end_layout - -\begin_layout Plain Layout - - struct('type', 'marker') ... -\end_layout - -\begin_layout Plain Layout - - }; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Call PsPM function to import the file. - 'spike' is the datatype of the -\end_layout - -\begin_layout Plain Layout - -% file. - You can check in pspm_init under defaults.import.chantypes -\end_layout - -\begin_layout Plain Layout - -% which datatypes are supported. - The function returns the path to the -\end_layout - -\begin_layout Plain Layout - -% imported file. -\end_layout - -\begin_layout Plain Layout - -imported_file = pspm_import(data_file, 'spike', import, options); -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Trim the data -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - Trimming allows to cut away the data which should not be used for further - analysis. - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% Set option to overwrite existing files. -\end_layout - -\begin_layout Plain Layout - -options = struct('overwrite', true); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Remove the 110s after the first marker and 10s after the last -\end_layout - -\begin_layout Plain Layout - -% marker. -\end_layout - -\begin_layout Plain Layout - -trimmed_file = pspm_trim(imported_file, 110, 10, 'marker', options); -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Fit GLM -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - Set the model settings and fit the GLM. - The model uses a separate timing file with timeunits 'markers'. - We also specify to normalise the data and set a custom response function. - Args is passed to the response function and the format of an argument therefore - depends on the specified response function itself. - Also we tell the function to overwrite existing files by passing options.overwri -te = true; -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% set option 'overwrite' to true -\end_layout - -\begin_layout Plain Layout - -options = struct('overwrite', true); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% set model settings -\end_layout - -\begin_layout Plain Layout - -model = struct('modelfile', [tutorial_data filesep sprintf('glm_%i', subject)], - ... -\end_layout - -\begin_layout Plain Layout - - 'datafile', trimmed_file, ... -\end_layout - -\begin_layout Plain Layout - - 'timing', [tutorial_data filesep sprintf('trSP_appraisal_01_%i_onsets_1.mat', - subject)], ... -\end_layout - -\begin_layout Plain Layout - - 'timeunits', 'markers', ... -\end_layout - -\begin_layout Plain Layout - - 'norm', 1, ... -\end_layout - -\begin_layout Plain Layout - - 'modelspec', 'scr', ... -\end_layout - -\begin_layout Plain Layout - - 'bf', struct('fhandle', @pspm_bf_scrf, 'args', 1) ... -\end_layout - -\begin_layout Plain Layout - - ); -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% run GLM fitting procedure -\end_layout - -\begin_layout Plain Layout - -glm = pspm_glm(model, options); -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Create First-Level contrasts -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - Here we want to find out if there is a difference between neutral and aversive - events. - Therefore we compare event type 1 with event type 2. - We are not interested event type 3. - This results in the contrast [1 -1 0]. - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% Set path to modelfile -\end_layout - -\begin_layout Plain Layout - -modelfile = [tutorial_data filesep sprintf('glm_%i', subject)]; -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\begin_layout Plain Layout - -% Call contrasts function (function has no output) -\end_layout - -\begin_layout Plain Layout - -pspm_con1(modelfile, {'neutral vs. - aversive'}, {[1 -1 0]}); -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Export parameter estimates -\end_layout - -\begin_layout Standard -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -begin{par} -\end_layout - -\end_inset - - If we are interested to do further analysis on the parameter estimates - we can export them to the screen or to a file. - -\begin_inset ERT -status collapsed - -\begin_layout Plain Layout - - -\backslash -end{par} -\end_layout - -\end_inset - - -\begin_inset VSpace 1em -\end_inset - - -\begin_inset listings -inline false -status open - -\begin_layout Plain Layout - -% export parameter estimates to screen -\end_layout - -\begin_layout Plain Layout - -pspm_exp(modelfile, 'screen', 'param'); -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Part -How to reference PsPM -\end_layout - -\begin_layout Standard -To justify our continued effort in the face of tight resources, we ask you - acknowledge PsPM when you use it: -\begin_inset Quotes eld -\end_inset - -Data were analysed using PsPM [version number], available at -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -http://bachlab.org/pspm -\end_layout - -\end_inset - -. -\begin_inset Quotes erd -\end_inset - - -\end_layout - -\begin_layout Standard -We suggest you reference our papers to justify your analysis steps and models - in the following way: -\end_layout - -\begin_layout Itemize -General PsPM reference: -\end_layout - -\begin_deeper -\begin_layout Itemize -Bach DR, & Friston KJ (2013). - Model-based analysis of skin conductance responses: Towards causal models - in psychophysiology. - Psychophysiology, 50, 15-22. -\end_layout - -\begin_layout Itemize -Bach DR, Castegnetti G, Korn CW, Gerster S, Melinscak F, Moser T (2018). - Psychophysiological modelling - current state and future directions. - Psychophysiology, 55, e13214. -\end_layout - -\end_deeper -\begin_layout Itemize -GLM for SCR -\end_layout - -\begin_deeper -\begin_layout Itemize -general reference: Bach DR, Flandin G, Friston KJ, & Dolan RJ (2009). - Time-series analysis for rapid event-related skin conductance responses. - Journal of Neuroscience Methods, 184, 224-234. - -\end_layout - -\begin_layout Itemize -canonical SCRF: Bach DR, Flandin G, Friston KJ, & Dolan RJ (2010). - Modelling event-related skin conductance responses. - International Journal of Psychophysiology, 75, 349-356. -\end_layout - -\begin_layout Itemize -assumptions of the model: Gerster S, Namer B, Elam M, Bach DR (2018). - Testing a linear time invariant model for skin conductance responses by - intraneural recording and stimulation. - Psychophysiology, 55, e12986. -\end_layout - -\begin_layout Itemize -optimised filter settings: Bach DR, Friston KJ, Dolan RJ (2013). - An improved algorithm for model-based analysis of evoked skin conductance - responses. - Biological Psychology, 94, 490-497. - -\end_layout - -\begin_layout Itemize -comparison with Ledalab and peak-scoring methods: Bach DR (2014). - A head-to-head comparison of SCRalyze and Ledalab, two model-based methods - for skin conductance analysis. - Biological Psychology, 103, 63-88. -\end_layout - -\end_deeper -\begin_layout Itemize -non-linear model for event-related SCR: -\end_layout - -\begin_deeper -\begin_layout Itemize -general reference: Bach DR, Daunizeau J, Friston KJ, & Dolan RJ (2010). - Dynamic causal modelling of anticipatory skin conductance responses. - Biological Psychology, 85, 163-70. -\end_layout - -\begin_layout Itemize -optimised filter settings: Staib M, Castegnetti G, Bach DR (2015). - Optimising a model-based approach to inferring fear learning from skin - conductance responses. - Journal of Neuroscience Methods, 255, 131-138. -\end_layout - -\begin_layout Itemize -optimised forward model for short SOA paradigms (see supplementary material): - Tzovara A, Korn CW & Bach DR (2018). - Human Pavlovian fear conditioning conforms to probabilistic learning. - PLOS Computational Biology, 14, e1006243. -\end_layout - -\end_deeper -\begin_layout Itemize -non-linear model for SF: -\end_layout - -\begin_deeper -\begin_layout Itemize -general reference: Bach DR, Daunizeau J, Kuelzow N, Friston KJ, & Dolan - RJ (2011). - Dynamic causal modelling of spontaneous fluctuations in skin conductance. - Psychophysiology, 48, 252-57. -\end_layout - -\begin_layout Itemize -canonical SCRF: Bach DR, Friston KJ, & Dolan RJ (2010). - Analytic measures for quantification of arousal from spontaneous skin conductan -ce fluctuations. - International Journal of Psychophysiology, 76, 52-55. -\end_layout - -\begin_layout Itemize -MP algorithm: Bach DR, Staib M (2015). - A matching pursuit algorithm for inferring tonic sympathetic arousal from - spontaneous skin conductance fluctuations. - Psychophysiology, 52, 1106-12. -\end_layout - -\end_deeper -\begin_layout Itemize -GLM for evoked HPR: Paulus PC, Castegnetti G, & Bach DR (2016). - Modeling event-related heart period responses. - Psychophysiology, 53, 837-846. - -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned HPR: Castegnetti G, Tzovara A, Staib M, Paulus - PC, Hofer N, & Bach DR (2016). - Modeling fear-conditioned bradycardia in humans. - Psychophysiology, 53, 930-939. - -\end_layout - -\begin_layout Itemize -GLM for evoked respiratory responses: Bach DR, Gerster S, Tzovara A, Castegnetti - G (2016). - A linear model for event-related respiration responses. - Journal of Neuroscience Methods, 270, 147-155. - -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned RAR: Castegnetti C, Tzovara A, Staib M, Gerster - S, Bach DR (2017). - Assessing fear memory via conditioned respiratory amplitude responses. - Psychophysiology, 54, 215-223. -\end_layout - -\begin_layout Itemize -GLM for illuminance-elicited PSR: Korn CW & Bach DR (2016). - A solid frame for the window on cognition: Modeling event-related pupil - responses. - Journal of Vision, 16, 28. - -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned PSR: Korn CW, Staib M, Tzovara A, Castegnetti G, - Bach DR (2017). - A pupil size response model to quantify fear conditioning. - Psychophysiology, 54, 330-343. -\end_layout - -\begin_layout Itemize -GLM for SEBR: Khemka S, Tzovara A, Gerster S, Quednow BB, Bach DR (2017). - Modeling startle eyeblink electromyogram to assess fear learning. - Psychophysiology, 54, 204-214. -\end_layout - -\begin_layout Itemize -Comparison of different measures: Xia Y, Gurkina A & Bach DR (2019). - Pavlovian-to-instrumental transfer after human threat conditioning. - Learning & Memory, in press. - -\end_layout - -\begin_layout Part -Release notes -\end_layout - -\begin_layout Section -PsPM Version 3 -\end_layout - -\begin_layout Subsection* -Version 3.0 -\end_layout - -\begin_layout Subsubsection* -Import -\end_layout - -\begin_layout Paragraph* -New data types were implemented -\end_layout - -\begin_layout Itemize -Noldus Observer compatible -\end_layout - -\begin_layout Itemize -Eyelink -\end_layout - -\begin_layout Paragraph* -Untested data types -\end_layout - -\begin_layout Standard -CNT data import has not been not tested – please contact the developers - with sample data files. - -\end_layout - -\begin_layout Subsubsection* -Filtering for SCR models -\end_layout - -\begin_layout Standard -Previous versions of PsPM have used a bi-directional high pass filter of - 0.0159 for all SCR analyses. - We have recently shown a better predictive validity for GLM with a unidirection -al filter of 0.05 Hz -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2013aa" -literal "true" - -\end_inset - -. - This also implies that different filters are used for different models. - These are now set as defaults, and the way the default settings are implemented - has changed. - It is now possible to alter the filter settings in the model definition, - although we discourage this. -\end_layout - -\begin_layout Subsubsection* -New SF method -\end_layout - -\begin_layout Standard -A matching pursuit algorithm is now implemented to approximate the number - of spontaneous fluctuations (SF) in skin conductance -\begin_inset CommandInset citation -LatexCommand cite -key "Bach:2015aa" -literal "true" - -\end_inset - -. -\end_layout - -\begin_layout Subsubsection* -General linear modelling (GLM) -\end_layout - -\begin_layout Paragraph -Parametric modulators -\end_layout - -\begin_layout Standard -Parametric modulators (pmods) are z-normalised before being entered into - the design matrix. - This is to account for possibly very large or very small numbers – a badly - scaled design matrix can cause induced instability in the inversion. - The parameter estimates of the pmods were not transformed back in previous - versions, i. - e. - the parameter estimates of the pmods were independent of the scaling of - the pmods. - This is appropriate as long as they are the same for all datasets, or if - analysis is done strictly on a within-subject level. - Some researchers have reported designs in which inference was to be drawn - on parameter estimates of pmods on a between-group level, and where the - pmods systematically differed between these groups. - To account for this possibility, the parameter estimates are now transformed - back, such that they refer to the pmods in their original scaling/units. - -\end_layout - -\begin_layout Paragraph* -Parametric confounds -\end_layout - -\begin_layout Standard -Previous versions of PsPM contained an option to include a parametric modulator - across all event types, to account for confounds across all conditions. - For example, in an experiment with 5 conditions, one could have included - 5 regressors, plus one reaction time confound across all events, without - including an associated regressor that contains the event onsets for all - these events. - This option was removed. - -\end_layout - -\begin_layout Paragraph* -Design matrix filtering -\end_layout - -\begin_layout Standard -Previous versions of PsPM filtered the design matrix after orthogonalisation - of basis sets. - This can introduce unwanted dependencies between regressors. - PsPM 3.0 filters the regressors first, then orthogonalises the basis sets. -\end_layout - -\begin_layout Subsubsection* -File format -\end_layout - -\begin_layout Standard -Some minor changes have been made to the data format. - In particular, marker channels from previous versions can not be read with - the current version - such data files have to be re-imported. - Model files have changed drastically, and model files from previous versions - can not be read with the current version of the software. -\end_layout - -\begin_layout Subsubsection* -VB inversion -\end_layout - -\begin_layout Standard -The VBA toolbox ( -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -http://mbb-team.github.io/VBA-toolbox/ -\end_layout - -\end_inset - -) was updated in October 2014 -\begin_inset CommandInset citation -LatexCommand cite -key "Daunizeau:2014aa" -literal "true" - -\end_inset - -. - This update incorporates bugfixes in this toolbox and slightly changed - the model estimates in our test models. - In terms of predictive validity, we noted that there was no consistent - benefit of the old or new version of this code (Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:VBA" - -\end_inset - -). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/Comparison_VBA.PNG - scale 85 - -\end_inset - - -\begin_inset Caption Standard - -\begin_layout Plain Layout -Model comparison between old and new versions of the VBA toolbox, based - on two delay fear conditioning datasets. - The log Bayes factor quantifies the difference between negative log likelihood - (nLL) of parameter estimates obtained from model inversion using the old - and new version of VBA. - A difference in nLL above 3 indicates significant differences in model - evidence which is not exceeded for either data set. - Analysis and figure contributed by Matthias Staib. - -\begin_inset CommandInset label -LatexCommand label -name "fig:VBA" - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsection* -Version 3.0.1 -\end_layout - -\begin_layout Subsubsection* -Import -\end_layout - -\begin_layout Paragraph* -New data types were implemented -\end_layout - -\begin_layout Itemize -DATAQ Windaq (no ActiveX needed) -\end_layout - -\begin_layout Itemize -European Data Format (EDF) -\end_layout - -\begin_layout Paragraph* -Tools -\end_layout - -\begin_layout Standard -'Preprocess respiration traces' replaces 'Convert Respiration to Respiration - Period'. - It supports conversions into the following datatypes: -\end_layout - -\begin_layout Itemize -Respiration preriod (old funtionality) -\end_layout - -\begin_layout Itemize -Respiration amplitude -\end_layout - -\begin_layout Itemize -Respiration line length -\end_layout - -\begin_layout Itemize -Respiration time stamp -\end_layout - -\begin_layout Subsubsection* -First level contrast -\end_layout - -\begin_layout Paragraph* -Z-score parameter estimates -\end_layout - -\begin_layout Standard -The function -\family typewriter -pspm_con1 -\family default - now supports z-scoring trial-by-trial parameter estimates. - If selected, all parameter estimates for the same event type, across all - trials, will be z-scored before computing the contrast. - This option is currently only available for non-linear models. -\end_layout - -\begin_layout Paragraph* -Review first level model -\end_layout - -\begin_layout Standard -Next to the regressors on the x- and y-axes, orthogonality plots newly display - regressor names along the y-axes. - -\end_layout - -\begin_layout Subsection* -Version 3.0.2 -\end_layout - -\begin_layout Subsubsection* -GLM -\end_layout - -\begin_layout Standard -Problem with multiple sessions in Design matrix fixed. -\end_layout - -\begin_layout Subsection* -Version 3.1 -\end_layout - -\begin_layout Subsubsection* -General linear modelling (GLM) -\end_layout - -\begin_layout Paragraph* -New modalities -\end_layout - -\begin_layout Standard -For the first time in PsPM, we introduce models for data types other than - SCR: -\end_layout - -\begin_layout Itemize -GLM for evoked HPR -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned HPR -\end_layout - -\begin_layout Itemize -GLM for evoked RA -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned RA -\end_layout - -\begin_layout Itemize -GLM for evoked RFR -\end_layout - -\begin_layout Itemize -GLM for evoked RP -\end_layout - -\begin_layout Itemize -GLM for fear-conditioned PS -\end_layout - -\begin_layout Subsubsection* -Tools & Data preprocessing -\end_layout - -\begin_layout Standard -Tools are split up into Tools & Data preprocessing. - The content of each section is listed below. - New functions are written in -\color green -green -\color inherit -. -\end_layout - -\begin_layout Paragraph* -Tools -\end_layout - -\begin_layout Itemize -Display data -\end_layout - -\begin_layout Itemize -Rename file -\end_layout - -\begin_layout Itemize -Split sessions -\end_layout - -\begin_layout Itemize -Artefact removal -\end_layout - -\begin_layout Itemize -Downsample data -\end_layout - -\begin_layout Itemize -Interpolate missing data -\end_layout - -\begin_layout Itemize - -\color green -Extract segments -\end_layout - -\begin_layout Itemize - -\color green -Segment mean -\end_layout - -\begin_layout Paragraph* -Data preprocessing -\end_layout - -\begin_layout Itemize - -\color green -Preprocess heart data -\end_layout - -\begin_layout Itemize - -\color green -Preprocess respiration data -\end_layout - -\begin_layout Itemize - -\color green -Prepare illuminance GLM -\end_layout - -\begin_layout Itemize - -\color green -Find valid fixations -\end_layout - -\begin_layout Itemize - -\color green -Convert pupil data -\end_layout - -\begin_layout Itemize - -\color green -Find startle sound onsets -\end_layout - -\begin_layout Subsubsection* -Data preparation -\end_layout - -\begin_layout Paragraph* -Import -\end_layout - -\begin_layout Standard -Support for Philips Scanphyslog files and for bioread-converted AcqKnowledge - files has been added to the import function. -\end_layout - -\begin_layout Section -PsPM Version 4 -\end_layout - -\begin_layout Subsection* -Version 4.0 -\end_layout - -\begin_layout Subsubsection* -Change from scr_ to pspm_ -\end_layout - -\begin_layout Standard -The prefix scr_ has been exchanged with pspm_. - This applies to all functions contained in PsPM. -\end_layout - -\begin_layout Subsubsection* -Updated toolboxes -\end_layout - -\begin_layout Standard -Matlabbatch ( -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -https://git.code.sf.net/p/matlabbatch/code-git -\end_layout - -\end_inset - -) and the VBA toolbox ( -\begin_inset Flex URL -status open - -\begin_layout Plain Layout - -https://github.com/MBB-team/VBA-toolbox -\end_layout - -\end_inset - -) were updated to the latest available versions (08.11.2016). - The updated VBA version fully supports newer Matlab versions and warning - messages in Matlab 2014 and newer do not appear anymore (during PsPM startup). - In terms of predictive validity, we noted that there was no consistent - benefit of the old or new version of this code (Figure -\begin_inset CommandInset ref -LatexCommand ref -reference "fig:VBA_compare_3.2" - -\end_inset - -). -\end_layout - -\begin_layout Standard -\begin_inset Float figure -wide false -sideways false -status open - -\begin_layout Plain Layout -\begin_inset Graphics - filename Figures/Comparison_VBA.PNG - lyxscale 75 - -\end_inset - - -\end_layout - -\begin_layout Plain Layout -\begin_inset Caption Standard - -\begin_layout Plain Layout -\begin_inset CommandInset label -LatexCommand label -name "fig:VBA_compare_3.2" - -\end_inset - -Model comparison between old and new versions of the VBA toolbox, based - on one delay fear conditioning dataset (Dataset 2, see earlier comparison). - The log Bayes factor quantifies the difference between negative log likelihood - (nLL) of parameter estimates obtained from model inversion using the old - and new version of VBA. - A difference in nLL above 3 indicates significant differences in model - evidence which is not exceeded for the used dataset. -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Plain Layout - -\end_layout - -\end_inset - - -\end_layout - -\begin_layout Subsubsection* -Subsessions in DCM models -\end_layout - -\begin_layout Standard -Until now, long periods of NaN values (which are just disregarded) could - cause problems for inversion of DCMs. - These periods are now split (according to threshold value) into subsessions. - The subsessions will be evaluated independently, while at the end the results - will be stacked together. - Therefore the output-format will not change and should be compatible with - earlier releases. -\end_layout - -\begin_layout Subsubsection* -Import -\end_layout - -\begin_layout Paragraph* -New import function for Labchart files -\end_layout - -\begin_layout Standard -The new import function allows direct import of raw labchart files without - exporting them to a suitable format (as was required to date). - The function is only available on Windows systems. -\end_layout - -\begin_layout Subsubsection* -General linear modeling (GLM) -\end_layout - -\begin_layout Paragraph* -New modalities -\end_layout - -\begin_layout Itemize -Startle eyeblink for EMG (SEB) -\end_layout - -\begin_layout Subsubsection* -Pupil Models -\end_layout - -\begin_layout Itemize -Blink channels were removed. - Periods during blinks and saccades are set to NaN already in the import - function. - This applies to all channels of the respective eye. - Accordingly, blink validation functionality was removed in the function - pspm_find_valid_fixations. - If needed, blinks and saccades can be imported as custom channels using - channel ids 7-10 (two eyes) or 4-5 (one eye), while blinks and left eye - come first. -\end_layout - -\begin_layout Itemize -Importing pupil channels now allows direct specification of a transfer function - to convert arbitrary units to mm. - -\end_layout - -\begin_layout Itemize -Importing of eyes which have not been recorded creates channels containing - NaN values, so that the same import batches can be used for groups of subjects, - even if one eye is missing in some of them. -\end_layout - -\begin_layout Itemize -Sessions in eyelink files (caused by interruption of recording) will be - concatenated according to the timing variable. -\end_layout - -\begin_layout Itemize -In pspm_find_valid_fixations -\end_layout - -\begin_deeper -\begin_layout Itemize -the use of software aspect ratio was replaced by resolution. - This allows to correctly map the gaze coordinates to the shapes mapped - by the stimulus software. -\end_layout - -\begin_layout Itemize -gaze coordinates can be plotted in order to verify the validation settings. -\end_layout - -\begin_layout Itemize -interpolation option was removed and should now be used independently. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Minor changes & Bugfixes -\end_layout - -\begin_layout Itemize -Version-Check bug during startup is now fixed. -\end_layout - -\begin_layout Itemize -Markerinfos will now according to marker channels be converted to an event-based - format. -\end_layout - -\begin_layout Itemize -The data editor (pspm_data_editor) now allows to specify an output file - using the command line. -\end_layout - -\begin_layout Itemize -pspm_split_sessions additionally allows to specify marker ids at which the - file should split. -\end_layout - -\begin_layout Itemize -Artefact correction was extended with a further function (Simple SCR quality - correction). -\end_layout - -\begin_layout Itemize -Convert pupil data becomes convert data and currently only allows area to - diameter conversion (arbitrary units to mm is integrated in the import - function) -\end_layout - -\begin_layout Subsection* -Version 4.0.1 -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Fix not working options in Matlabbatch module 'Preprocess heart data' -\end_layout - -\begin_layout Subsection* -Version 4.0.2 -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Fix error when calling 'Convert data' from GUI -\end_layout - -\begin_layout Itemize -Fix taking square root if pupil data is recorded in AREA -\end_layout - -\begin_layout Subsection* -Version 4.1.0 -\end_layout - -\begin_layout Subsubsection* -New Functions -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_convert_pixel2unit_core -\family default -: Allows to transfer gaze data from pixel to units. - This facilitates the use of pspm_find_valid_fixations which needs data - in unit values. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_convert_visual_angle_core -\family default -: Computes visual angle from gaze data. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_convert_visangle2sps -\family default -: Convert visual angles from Eyelink to Scanpath speed. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_bf_spsrf_box -\family default -: SPSRF basis function with box car. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_bf_spsrf_gamma -\family default -: SPSRF basis function with gamma function. -\end_layout - -\begin_layout Subsubsection* -New Features -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\family default - supports DCM files/structures. -\end_layout - -\begin_layout Itemize -GLM for SPS. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_find_valid_fixations -\family default - can now take a bitmap as input. -\end_layout - -\begin_layout Itemize -A new way to trim data: Start and end times can be chosen according to marker - name or value. -\end_layout - -\begin_layout Itemize -A new function to import SMI iView X EyeTracker files into PsPM. -\end_layout - -\begin_layout Itemize -A new function to import ViewPoint EyeTracker files into PsPM. -\end_layout - -\begin_layout Paragraph* -Changes -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_find_valid_fixations -\family default - now computes a circle around the fixation points when run in fixations - mode. -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Heart period response function (bf_hprf) coefficients are fixed according - to the manual -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\family default - bugfixes: -\end_layout - -\begin_deeper -\begin_layout Itemize -Fix bugs related to conditions appearing in different sessions. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_get_eyelink -\family default - now imports markers between two recording sessions (previously these markers - were -\begin_inset Quotes eld -\end_inset - -lost -\begin_inset Quotes erd -\end_inset - -) -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_convert_visual_angle_core -\family default -: Fix bug in range computation. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_ecg2hb -\family default -: Fix out of bounds error occurring for highly noisy data with many outliers. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_get_acq -\family default -: Fix incorrect linear transformation during ACQ import. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_convert_unit -\family default -: Fix incorrect transformations between metric units and inches. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_resp_pp -\family default -: Fix out of bounds error during convolution in cushion mode. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_pp -\family default - in 'simple_qa' mode now uses the default values specified in -\family typewriter -pspm_simple_qa -\family default -. -\end_layout - -\begin_layout Itemize -Various further bugfixes. -\end_layout - -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize -Blink and saccade channels can be imported with PsPM Eyelink import. -\end_layout - -\begin_layout Itemize -GLM structure holds the missing data percentage of each condition after - segment extraction. - Further, the decision to exclude conditions can be made depending on the - percentage of missing data. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\family default - now works both with GLM files and already loaded structures -\end_layout - -\begin_layout Itemize -PsPM now checks if SPM is already in MATLAB path. - If so, user is asked to remove it from path before initializing PsPM. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_load1 -\family default - now returns statistics about conditions with high NaN ratios. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\family default - now is able to use data stored in GLM/DCM structures instead of relying - the existence of original data files. -\end_layout - -\begin_layout Itemize -Multiple new tests to validate the correctness of the functions. -\end_layout - -\begin_layout Subsection* -Version 4.1.1 -\end_layout - -\begin_layout Standard -This is a hotfix release that fixes a few issues with 4.1.0 release. -\end_layout - -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_get_eyelink -\family default - now uses the scaling factor from -\begin_inset CommandInset citation -LatexCommand cite -key "Hayes:2015a" -literal "false" - -\end_inset - - for area based arbitrary units to milimeters conversion. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_get_smi -\family default - does not perform pixel to milimeters conversion for pupil data anymore. - Pupil values are returned as is in pixel units. -\end_layout - -\begin_layout Itemize -pspm_get_smi performs pixel to milimeters conversion for gaze data only - if the stimulus resolution in pixels are given as an extra option. -\end_layout - -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_get_viewpoint -\family default - is now able to import blink and saccade channels from sample files as well. - In order to enable this feature, event files must be stored asynchronously - in the datafile. - See ViewPoint EyeTracker section in this manual for further information. -\end_layout - -\begin_layout Subsection* -Version 4.2.0 -\end_layout - -\begin_layout Subsubsection* -New Functions -\end_layout - -\begin_layout Itemize -A new pupil data preprocessing function -\end_layout - -\begin_layout Itemize -A new pupil foreshortening error correction function -\end_layout - -\begin_layout Itemize -A new QRS detection algorithm for fMRI environments -\end_layout - -\begin_layout Subsubsection* -New Features -\end_layout - -\begin_layout Itemize -Previously, Eyelink import used to discard 50 ms worth of samples from each - side of every blink or saccade period. - This behaviour is preserved; however, sample discard duration can now be - set by the user. -\end_layout - -\begin_layout Itemize -Channel processing functions now store extensive historical data in PsPM - files. - This data can be printed in table format using the new utility -\family typewriter -function pspm_format_history_from_file -\end_layout - -\begin_layout Itemize -Pupil channel is now loaded according to a new precedence order. - Refer to GLM documentation in this manual to learn more. -\end_layout - -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize -Eyelink import now returns times and dates in a slightly different format. -\end_layout - -\begin_layout Itemize -Newest version of PsPM is now obtained from the version string in pspm.sourceforg -e.net, not from the download link zip file name -\end_layout - -\begin_layout Itemize -GLM now uses the -\series bold -LAST -\series default - channel of a specified modality in a PsPM file. -\end_layout - -\begin_layout Itemize -Nonlinear SCR model (DCM) now does not use the inter-trial interval duration - value (ITI) of the last trial when computing session specific minimum ITI - values. - Previously, using these last ITI values would lead to abnormally small - overall min ITI values in some input files, thereby causing the inference - and PCA sections to use less data for all trials. - Now, we prevent this from happening. -\end_layout - -\begin_layout Itemize -Eyelink import parameter blink/saccade edge discard factor default value - has been set to 0. - This means no extra samples are discarded around blinks/saccades. -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_extract_segments -\family default - where trial onsets were not assigned to conditions correctly -\end_layout - -\begin_layout Itemize -Fix a bug in Viewpoint import where files in DOS format were being parsed - incorrectly -\end_layout - -\begin_layout Itemize -Fix a bug in Eyelink import where blink/saccade periods where misaligned, - causing the function to discard useful data and return noise instead -\end_layout - -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize -New utility functions to make PsPM more compatible across different operating - systems -\end_layout - -\begin_layout Itemize -An optimized Eyelink import function that is significantly faster and more - memory efficient than previous versions -\end_layout - -\begin_layout Itemize -An optimized SMI event import function that is significantly faster than - the previous version -\end_layout - -\begin_layout Itemize -Multiple new tests to validate the correctness of the functions -\end_layout - -\begin_layout Itemize -API unification: Now all preprocessing functions use -\family typewriter -channel_action -\family default - variable to choose what to do with the new channel. -\end_layout - -\begin_layout Subsection* -Version 4.2.1 -\end_layout - -\begin_layout Paragraph* -New Functions -\end_layout - -\begin_layout Itemize -Three new tests (pspm_hb2hp_test.m, pspm_filtfilt_test.m, pspm_butter_test.m) -\end_layout - -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_display -\family default - and -\family typewriter -pspm_ecg_editor -\family default - do not perform filtering anymore. -\end_layout - -\begin_layout Itemize -Treatment of missing data in DCM is now the same regardless of whether they - are specified as NaN or via model.missing. -\end_layout - -\begin_layout Itemize -Eyelink import parameter blink/saccade edge discard factor default value - has been set to 0. - This means no extra samples are discarded around blinks/saccades. -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_hb2hp -\family default - where the function crashed when there is no heartbeat left after lower - and upper bound filtering of the heartbeat periods -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -import_eyelink -\family default - which imported more markers than the number of markers in the actual .asc - file -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_display -\family default - which crashed when trying to plot ECG signal that contains NaN -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_prepdata -\family default - which returned only NaN when input signal contained some NaN values -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_version -\family default - which crashed when MATLAB was invoked with -\family typewriter --nojvm -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_get_viewpoint -\family default - which returned '+,=,+' lines in the marker list and which crashed when - given a viewpoint data file containing multiple sessions separated with - '+,=' type of markers -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -import_viewpoint -\family default - which created a new session for every marker containing a '+' somewhere, - e.g.: 'CS+' -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_get_events -\family default - which was not able to locate a marker if it occured on the first or last - sample in a given datafile -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_filtfilt -\family default - which crashed when the filter parameters were of dimension one -\end_layout - -\begin_layout Subsection* -Version 4.3.0 -\end_layout - -\begin_layout Subsubsection* -New Features -\end_layout - -\begin_layout Itemize -In -\family typewriter -pspm_get_events -\family default -, -\family typewriter -import.flank -\family default - can be now set to -\family typewriter -'all' -\family default - what would import all markers and data related to them. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_display -\family default -allows now to display pupil size units and the gaze x & y coordinate units - on the y-axis. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\family default -can be used now with raw data and thus be called easily within another function. -\end_layout - -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_version -\family default - has a new url and thus do not send any warning about version checks anymore. -\end_layout - -\begin_layout Itemize - -\family typewriter -import_eyelink -\family default - do not import markers which are outside the session end time ( -\family typewriter -END -\family default - marker). -\end_layout - -\begin_layout Itemize - -\family typewriter -import_eyelink -\family default - sends a warning whenever two markers have the same timestamp. -\end_layout - -\begin_layout Itemize -In -\family typewriter -pspm_get_eyelink -\family default -, -\family typewriter -import.flank -\family default - set to -\family typewriter -'all' -\family default -. -\end_layout - -\begin_layout Itemize -The test of -\family typewriter -pspm_extract_segments -\family default - was adapted to the new feature. -\end_layout - -\begin_layout Itemize -External functions and libraries were regrouped in one folder called -\family typewriter -ext. -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Fix a bux in -\family typewriter -pspm_bf_lcrf_gm -\family default - and -\family typewriter -pspm_bf_ldrf_gm -\family default - where the offset was wrongly implemented. -\end_layout - -\begin_layout Itemize -Fix a bug in -\family typewriter -pspm_convert_visual_angle_core -\family default - where there was an error in the conversion factor of pixels wrt. - to mm. -\end_layout - -\begin_layout Section -PsPM Version 5 -\end_layout - -\begin_layout Subsection* -Version 5.0.0 -\end_layout - -\begin_layout Subsubsection* -New Features -\end_layout - -\begin_layout Itemize -Allow -\family typewriter -pspm_data_editor -\family default - to load an epoch file. -\end_layout - -\begin_layout Itemize -Allow -\family typewriter -pspm_simple_qa -\family default - to suppress classification of discretisation oscillations as artefacts, - to expand artefact windows, and to automatically remove small data islands - embedded in artefacts. -\end_layout - -\begin_layout Itemize -Allow -\family typewriter -pspm_simple_qa -\family default - to store the epochs of data that are filtered out into an output -\family typewriter -.mat -\family default - file. - The accompanying GUI editor is available under 'Artefact removal' in the - tools section. -\end_layout - -\begin_layout Itemize -Allow -\family typewriter -pspm_convert_gaze -\family default - to convert from distance units to degrees or scanpath speed. - The accompanying GUI editor is available under 'Gaze Convert' in the data - preprocessing section. -\end_layout - -\begin_layout Itemize -Add the possibility to select the flank in the -\family typewriter -Import -\family default - module of the GUI of PsPM. -\end_layout - -\begin_layout Itemize -Add the possibility to import DSV (delimiter separated values) as well as - CSV (comma separated values) data files. -\end_layout - -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize -Split the data convert functionality in tools into the 'Gaze Convert' and - 'Pupil Size convert' in the data preprocessing section. -\end_layout - -\begin_layout Itemize -Factor out blink/saccade edge filtering logic out of -\family typewriter -pspm_get_eyelink -\family default - to -\family typewriter -pspm_blink_saccade_filt -\family default -. -\end_layout - -\begin_layout Itemize -Deprecate edge filtering functionality in -\family typewriter -pspm_get_eyelink -\family default -. -\end_layout - -\begin_layout Itemize -Make -\family typewriter -pspm_pupil_correct_eyelink -\family default - use the last gaze channel when there are multiple gaze x (similarly y) - channels in the file. -\end_layout - -\begin_layout Itemize -Make -\family typewriter -pspm_extract_segments -\family default - return NaN percentages and not ratios. -\end_layout - -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -Scale DCM plot XTick by sample rate. -\end_layout - -\begin_layout Itemize -Correct index offset when dealing with the descending flank for continuous - markers. -\end_layout - -\begin_layout Itemize -Allow -\family typewriter -pspm_display -\family default - to plot any type of marker channels. -\end_layout - -\begin_layout Itemize -Fix -\family typewriter -pspm_display -\family default - behaviour when user tries to load data with less channels than the data - he/she is currently displaying. -\end_layout - -\begin_layout Itemize -Fix -\family typewriter -pspm_split_sessions -\family default - behaviour when the intertrial interval in the data is random. - Add an option -\family typewriter -randomITI -\family default - (0 or 1) which in the latter case it forces the function to evaluate the - mean marker distance using all the markers and not per session. - Default value: 0. -\end_layout - -\begin_layout Itemize -Remove -\family typewriter -startsWith -\family default - and -\family typewriter -endsWith -\family default - from all functions for a better backward compatibility. -\end_layout - -\begin_layout Itemize -Fix bug in -\family typewriter -pspm_trim -\family default - which was wrongly defining the starting trimming point index. -\end_layout - -\begin_layout Subsection* -Version 5.1.0 -\end_layout - -\begin_layout Subsubsection* -New Features -\end_layout - -\begin_layout Itemize -PsPM now has an improved GUI with a more eye-friendly colour and typeface. -\end_layout - -\begin_layout Itemize -PsPM now has an alternative GUI built by using .mlapp, which shows consistent - a more modern appearance across different platforms. -\end_layout - -\begin_layout Subsubsection* -New Functions -\end_layout - -\begin_layout Itemize -pspm_scr_pp -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_scr_pp -\family default - replaces the classic -\family typewriter -pspm_simple_qa -\family default -. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_scr_pp -\family default - now allows users to detect clipping, where the results can be exported - together with the original outcome. -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_scr_pp -\family default - now allows users to just write artefact epochs and leave data unchanged. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Changes -\end_layout - -\begin_layout Itemize -General -\end_layout - -\begin_deeper -\begin_layout Itemize -Dialogs have been rewritten for avoiding endless loops. -\end_layout - -\begin_layout Itemize - -\shape italic -Pre-processing -\shape default - menu has been reconstructed, where -\shape italic -pupil size convert -\shape default - and -\shape italic -gaze convert -\shape default - are now under -\shape italic -pupil and eye tracking -\shape default -. -\end_layout - -\begin_layout Itemize -PsPM now always generates test data inside the PsPM folder. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_interpolate -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_interpolate -\family default - now process data ending with -\family typewriter -NaN -\family default - well without throwing warnings. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_find_sounds -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_find_sounds -\family default - now throws warning when some data was excluded due to the strict parameter - setting. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_split_sessions -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\family default - is now using -\family typewriter -pspm_trim -\family default - for processing data. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Bugfixes -\end_layout - -\begin_layout Itemize -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that leads to the failure of selecting left/right eye has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_load1 and pspm_dcm -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that leads to the failure of exporting statistics has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_resp_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that leads to the failure of opening batch for respiration data processing - has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_scr_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that leads to incorrect matrix construction has been fixed. -\end_layout - -\end_deeper -\begin_layout Section -PsPM Version 6 -\end_layout - -\begin_layout Subsection* -Version 6.0.0 -\end_layout - -\begin_layout Standard -This is a major release and may have incompatibility with previous versions. -\end_layout - -\begin_layout Subsubsection* -New features -\end_layout - -\begin_layout Itemize -PsPM now support a develop mode, which allows -\end_layout - -\begin_deeper -\begin_layout Itemize -Minimised terminal output. -\end_layout - -\begin_layout Itemize -Automagical parameter selection for testing. -\end_layout - -\begin_layout Itemize -Always to overwrite files. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_extract_segments -\end_layout - -\begin_deeper -\begin_layout Itemize -now allows an optional -\shape italic -z -\shape default - - score for normalisation. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_find_valid_fixations -\end_layout - -\begin_deeper -\begin_layout Itemize -now allows processing preprocessed left/right/combined pupil data. - -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_gaze_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -now allows preprocessing gaze signals. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_overwrite -\end_layout - -\begin_deeper -\begin_layout Itemize -now handles the behaviour of overwrite if not defined by the user, and is - used where applicable. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_time2index -\end_layout - -\begin_deeper -\begin_layout Itemize -now processes adjustable conversion from time to index globally. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_update_chantype -\end_layout - -\begin_deeper -\begin_layout Itemize -now allows generalised behaviour of updating channel types. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Bug Fixes -\end_layout - -\begin_layout Itemize -General -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug which may lead to failure of pspm path searching has been fixed. -\end_layout - -\begin_layout Itemize -A bug which may display figures in the GUI has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_bf_spsrf_box -\end_layout - -\begin_deeper -\begin_layout Itemize -now uses correct parameter settings. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_convert_ppu2hb -\end_layout - -\begin_deeper -\begin_layout Itemize -now terminates if only one pulse is detected. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_data_editor -\end_layout - -\begin_deeper -\begin_layout Itemize -now able to show figures when import a datafile correctly. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_dcm -\end_layout - -\begin_deeper -\begin_layout Itemize -now handles missing epochs that start at 0 correctly. -\end_layout - -\begin_layout Itemize -now processes variables properly to make length consistent. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_display -\end_layout - -\begin_deeper -\begin_layout Itemize -now displays plots with correct x-axis ranges. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -now applies correct variable settings. -\end_layout - -\begin_layout Itemize -now produces results correctly when facing many short missing epochs. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_interpolate -\end_layout - -\begin_deeper -\begin_layout Itemize -now returns results correctly when applying forced extrapolation. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_resp_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -now allows replace as the channel action properly. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_scr_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -now uses inconsistent variables when delivering missing epochs. -\end_layout - -\begin_layout Itemize -now writes data out properly when epochs are removed. -\end_layout - -\begin_layout Itemize -now properly handles data if the first channel is not -\family typewriter -scr -\family default -. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_sf -\end_layout - -\begin_deeper -\begin_layout Itemize -now refer to model file correctly. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_split_sessions -\end_layout - -\begin_deeper -\begin_layout Itemize -now processes missing files with an epoch starting at 0 s properly. - -\end_layout - -\begin_layout Itemize -now properly catches edge cases. -\end_layout - -\end_deeper -\begin_layout Itemize -ValidSamplesModel -\end_layout - -\begin_deeper -\begin_layout Itemize -now properly throws warnings if histogram counts are zeros. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize -General -\end_layout - -\begin_deeper -\begin_layout Itemize -now supports loading -\family typewriter -ppg -\family default - data. -\end_layout - -\begin_layout Itemize -now displays improved terminal output text. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_con1 -\end_layout - -\begin_deeper -\begin_layout Itemize -now assesses the statistics in the arguments for throwing warnings when - detecting invalid values. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_data_editor -\end_layout - -\begin_deeper -\begin_layout Itemize -now displays the -\shape italic -x -\shape default - and -\shape italic -y -\shape default - axis label and text according to the input data. -\end_layout - -\begin_layout Itemize -now sorts the epoch list according to the start data point. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_get_marker -\end_layout - -\begin_deeper -\begin_layout Itemize -now detects and update the field -\family typewriter -flank -\family default - when applicable. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_import -\end_layout - -\begin_deeper -\begin_layout Itemize -now detects and update the field -\family typewriter -flank -\family default - when applicable. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_load_data -\end_layout - -\begin_deeper -\begin_layout Itemize -now checks whether the input has an empty channel. -\end_layout - -\begin_layout Itemize -now autofills some variables. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_pupil_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -now calls -\family typewriter -pspm_load_data -\family default - to load single channels. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_rev_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -now displays normalised data for visualisation purpose only. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_write_channel -\end_layout - -\begin_deeper -\begin_layout Itemize -now checks whether the input has an empty channel. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -GUI -\end_layout - -\begin_layout Itemize -"Edit defaults" in the GUI is now working properly. -\end_layout - -\begin_layout Itemize -GUI typeface is now generalised across the software. -\end_layout - -\begin_layout Subsubsection* -For Developers -\end_layout - -\begin_layout Itemize -General -\end_layout - -\begin_deeper -\begin_layout Itemize -PsPM now uses -\family typewriter -.editorconfig -\family default - to control the indent. -\end_layout - -\begin_layout Itemize -PsPM now uses UTF-8, LF, and MATLAB's soft tab indent as the standard code - formatting style. -\end_layout - -\begin_layout Itemize -PsPM now uses test data from the repository PsPM-data. -\end_layout - -\end_deeper -\begin_layout Itemize -pspm_get_text_test -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug, which leaves residual test files after code testing, has been fixed. -\end_layout - -\end_deeper -\begin_layout Subsection* -Version 6.1.0 -\end_layout - -\begin_layout Subsubsection* -General -\end_layout - -\begin_layout Itemize -Minimum version of MATLAB -\end_layout - -\begin_deeper -\begin_layout Itemize -The minimum version of MATLAB required for running PsPM is -\begin_inset CommandInset href -LatexCommand href -name "MATLAB 7.1" -target "https://uk.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release14-ServicePack3_SupportedCompilers.pdf" -literal "false" - -\end_inset - - or R14 Service Pack 3. -\end_layout - -\end_deeper -\begin_layout Itemize -Entering PsPM -\end_layout - -\begin_deeper -\begin_layout Itemize -Entering PsPM is now hybrid based on the version of MATLAB, namely through - AppDesigner or Guide. - PsPM will be entered through AppDesigner when supported and through Guide - for older versions of MATLAB. - To call PsPM, users should still use the command -\family typewriter -pspm -\family default - in the Command Window of MATLAB, where the appropriate way of entering - PsPM will be recognised automatically. -\end_layout - -\begin_layout Itemize -Users can still use their preferred way to enter PsPM. - To enter PsPM through AppDesigner, please type -\family typewriter -pspm_appdesigner -\family default -. - To enter PsPM through Guide, which is the classic entrance, please type - -\family typewriter -pspm_guide -\family default -. -\end_layout - -\begin_layout Itemize -The AppDesigner version of PsPM UI is newly introduced by MATLAB and the - encouraged way for launching PsPM, and it has no functionality difference - than the Guide version of PsPM UI. -\end_layout - -\begin_layout Itemize -Both AppDesigner and Guide are designed and tested for Windows, macOS (either - Intel or Apple Silicon) and Linux. - Issues of opening PsPM through either of the two UI systems are encouraged - to be reported to PsPM developing group at GitHub. -\end_layout - -\end_deeper -\begin_layout Itemize -Introducing -\family typewriter -pspm_options -\end_layout - -\begin_deeper -\begin_layout Itemize -A new function -\family typewriter -pspm_options -\family default - is introduced to PsPM for controlling the default and acceptable values - of the struct -\family typewriter -options -\family default - used by most PsPM functions. - The default values of the fields in the struct -\family typewriter -options -\family default - for various functions can be directly checked by searching in -\family typewriter -pspm_options -\family default -. -\end_layout - -\begin_layout Itemize -The default values in -\family typewriter -pspm_options -\family default - have been checked and tested for PsPM. - If preferred values are different from defaults, users can specify them - when calling the corresponding PsPM functions, and the corresponding functions - and -\family typewriter -pspm_options -\family default - will always respect the users' specification with the highest priority. - However, the user's specification needs to satisfy the condition set in - -\family typewriter -pspm_options -\family default -, and invalid values may be reported as errors. -\end_layout - -\end_deeper -\begin_layout Itemize -Help text -\end_layout - -\begin_deeper -\begin_layout Itemize -The help text has been updated for all PsPM functions. - -\end_layout - -\begin_layout Itemize -Help text can be checked by right clicking the functions and select -\begin_inset Quotes eld -\end_inset - -help text -\begin_inset Quotes erd -\end_inset - -. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -UI Improvements -\end_layout - -\begin_layout Itemize -The UI for the following features has been improved and tested -\end_layout - -\begin_deeper -\begin_layout Itemize -Launchpad (AppDesigner) -\end_layout - -\begin_layout Itemize -Launchpad (Guide) -\end_layout - -\begin_layout Itemize -Batch editor -\end_layout - -\begin_layout Itemize -Display data -\end_layout - -\begin_layout Itemize -Contrast manager -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Bug Fixes -\end_layout - -\begin_layout Itemize -UI -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that used to make PsPM crash when -\family typewriter -pupil size convert -\family default - and -\family typewriter -gaze convert -\family default - in -\family typewriter -Data Preprocessing -\family default - were selected has been fixed. - -\end_layout - -\begin_layout Itemize -A bug that leads to error when PsPM is started offline has been fixed. -\end_layout - -\begin_layout Itemize -A bug that leads to incorrect x labels in -\family typewriter -pspm_rev_dcm -\family default - has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_convert_... -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that leads PsPM to crash, which is caused by outdated UI calling for - -\family typewriter -pspm_convert_... - -\family default - functions, has been fixed. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_get_eyelink -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that causes issues when importing eye link data that is scanned at - both left and right sides has been fixed. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that incorrectly identifies the -\family typewriter -NaN -\family default -s in the input data has been fixed. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_sf -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that has lead to incorrect input datafile assigning has been fixed. -\end_layout - -\begin_layout Itemize -A bug that leads PsPM crash when -\family typewriter -pspm_sf -\family default - is analysing data with missing epochs has been fixed. -\end_layout - -\begin_layout Itemize -A bug that leads to error when -\family typewriter -pspm_sf -\family default - analyses data where -\family typewriter -time unit -\family default - is defined as -\family typewriter -marker -\family default - has been fixed. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\family default - now considers -\family typewriter -marker_chan_num -\family default - when calling -\family typewriter -pspm_trim -\family default -. - -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize - -\family typewriter -channel -\end_layout - -\begin_deeper -\begin_layout Itemize -We have generalised -\family typewriter -channel -\family default - related variables throughout PsPM, which are given as -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -chan/channel -\family default - to -\family typewriter -channel -\end_layout - -\begin_layout Itemize - -\family typewriter -chans/channels -\family default - to -\family typewriter -channels -\end_layout - -\begin_layout Itemize - -\family typewriter -channel_units -\family default -/ -\family typewriter -channels_units -\family default -/ -\family typewriter -chan_units -\family default -/ -\family typewriter -chans_units -\family default - to -\family typewriter -channel_units -\end_layout - -\begin_layout Itemize - -\family typewriter -chan_combine -\family default - to -\family typewriter -channel_combine -\end_layout - -\begin_layout Itemize - -\family typewriter -chan_action -\family default - to -\family typewriter -channel_action -\end_layout - -\begin_layout Itemize - -\family typewriter -channels_header -\family default - to -\family typewriter -channel_header -\end_layout - -\begin_layout Itemize - -\family typewriter -chantype -\family default - to -\family typewriter -channeltype -\family default - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -import_eyelink -\end_layout - -\begin_deeper -\begin_layout Itemize -Improved -\family typewriter -import_eyelink -\family default - for adding some support for importing eyelink data converted by higher - version of .EDF files. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_con2 -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_con2 -\family default - now uses -\family typewriter -pspm_overwrite -\family default -. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_dcm -\family default - and -\family typewriter -pspm_dcm_inv -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -.flexevents -\family default - and -\family typewriter -.fixevents -\family default - are now fields of -\family typewriter -model -\family default - instead of -\family typewriter -options -\family default -. - -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_dcm -\family default - now uses -\family typewriter -pspm_get_timing -\family default - to handle missing epochs. - -\end_layout - -\begin_layout Itemize -Improved missing epoch support -\end_layout - -\begin_deeper -\begin_layout Itemize -The field -\family typewriter -.missing -\family default - is now allocated from -\family typewriter -options -\family default - to -\family typewriter -model -\family default -. -\end_layout - -\begin_layout Itemize - -\family typewriter -.missing_data -\family default - is used to load missing epoch data that was loaded from dcm, as an optional - field. -\end_layout - -\end_deeper -\begin_layout Itemize -The index is update to keep the first event when it is at time 0 in session. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\end_layout - -\begin_deeper -\begin_layout Itemize -The first channel is always referred by -\family typewriter -marker_chan -\family default - as default. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -The fallback for -\family typewriter -options.exclude_missing -\family default - has been set for -\family typewriter -pspm_glm -\family default -, which is not to exclude any missing epochs. - -\end_layout - -\begin_layout Itemize -A bug that leads to incorrect missing epoch checking has been fixed. - -\end_layout - -\begin_layout Itemize - -\family typewriter -marker_chan_num -\family default - now refers to the first marker channel as default. - -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_glm -\family default - now uses -\family typewriter -pspm_get_timing -\family default - to handle missing epochs. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_interp1 -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_interp1 -\family default - now considers the data where no valid values are detected and interpolation - is not possible, and warnings will be reported in this case. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_merge -\end_layout - -\begin_deeper -\begin_layout Itemize -The first two channels will be merged as the default option. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_prepdata -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_prepdata -\family default - now uses interpolation to handle data with -\family typewriter -NaN -\family default -. -\end_layout - -\begin_layout Itemize -Data that begins and/or ends with -\family typewriter -NaN -\family default - will be filled with the first/last non- -\family typewriter -NaN -\family default - values in those positions. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_sf -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -N -\family default -ow supports missing epochs by allowing input with -\family typewriter -NaN -\family default - that indicates missing epochs. -\end_layout - -\begin_layout Itemize -Missing epochs can be specified with -\family typewriter -options.missing -\family default - or the automatic -\family typewriter -NaN -\family default - detection. -\end_layout - -\begin_layout Itemize -Missing epochs will be verified with -\family typewriter -options.missingthresh -\family default -. -\end_layout - -\begin_layout Itemize -When the missing epochs are longer than 2s, the result out will be converted - to -\family typewriter -[] -\family default -. -\end_layout - -\begin_layout Itemize -The UI of SF analysis now allows using missing epochs from files or not - to define any missing epochs. -\end_layout - -\begin_layout Itemize -Now uses -\family typewriter -pspm_get_timing -\family default - to handle missing epochs. -\end_layout - -\begin_layout Itemize -The field -\family typewriter -.marker_chan_num -\family default - now refers to the first marker channel as default. - -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_sf_dcm -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_sf_dcm -\family default - now uses -\family typewriter -pspm_interp1 -\family default - for interpolating data. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_text -\end_layout - -\begin_deeper -\begin_layout Itemize -The Matlab file that stores the information of help text -\family typewriter -pspm_text.mat -\family default - will be stored inside the source folder of PsPM and will be deleted when - PsPM is quit. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_trim -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -marker_chan_num -\family default - now refers to the first marker channel as default. - -\end_layout - -\end_deeper -\end_deeper -\begin_layout Subsubsection* -Minor Adjustments -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_sf -\family default -, -\family typewriter -pspm_glm -\family default - and -\family typewriter -pspm_dcm -\family default -. - -\end_layout - -\begin_deeper -\begin_layout Itemize -The option -\family typewriter -marker_chan_num_event -\family default - is removed. -\end_layout - -\begin_layout Itemize -In default, the first marker channel / event channel is always selected - and no users' customisation is allowed. -\end_layout - -\begin_layout Itemize -The last data channel / wave channel is always selected. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Reference document -\end_layout - -\begin_layout Itemize -Added a new document -\shape italic -PsPM Reference -\shape default - for checking the default values and restrictions of -\family typewriter -options -\family default - fields. -\end_layout - -\begin_layout Subsection* -Version 6.1.1 -\end_layout - -\begin_layout Subsubsection* -New features -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_bf_psrf_2_fc -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_bf_psrf_2_fc -\family default - now allows to set the time delay between CS and US. -\end_layout - -\begin_layout Itemize -Previously, -\family typewriter -pspm_bf_psrf_2_fc -\family default - used to set a basis function for the CS and for the US response with a - time delay of 3.5 s as standard. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_dcm -\end_layout - -\begin_deeper -\begin_layout Itemize -Missing data epochs from file and data can be combined. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_glm -\family default - now allows a two-element vector and construct the dictionary accordingly. -\end_layout - -\begin_layout Itemize -Previously -\family typewriter -pspm_glm -\family default - only allows scalar values in model.window. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -New functions -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_check_model -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_check_model -\family default - checks the fiels of models. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_combine_markerchannels -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_combine_markerchannels -\family default - allows users to use the GLM option "markervalues" to create onsets definition - from channels distributed across multiple channels. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_tam -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -TAM -\family default - stands for Trial Average Model. - -\family typewriter -pspm_tam -\family default - allows to fit models on trial-averaged data. - -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Adjustments -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_pupil_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -Now -\family typewriter -pspm_pupil_pp -\family default - creates channels of type -\family typewriter -pupil -\family default - rather than -\family typewriter -pupil_pp -\family default -. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\end_layout - -\begin_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\family default - no longer drops markers at beginning or end of file. - -\end_layout - -\end_deeper -\begin_layout Subsubsection* -Bug fixes -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_con -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug caused by the new varargout logic of -\family typewriter -pspm_load1 -\family default - has been fixed. +optimised forward model for short SOA paradigms (see supplementary material): + Tzovara A, + Korn CW & Bach DR (2018). + Human Pavlovian fear conditioning conforms to probabilistic learning. + PLOS Computational Biology, + 14, + e1006243. \end_layout \end_deeper \begin_layout Itemize - -\family typewriter -pspm_dcm +non-linear model for SF: \end_layout \begin_deeper \begin_layout Itemize -A bug that leads dropping sub-threshold missing data periods has been fixed. +general reference: + Bach DR, + Daunizeau J, + Kuelzow N, + Friston KJ, + & Dolan RJ (2011). + Dynamic causal modelling of spontaneous fluctuations in skin conductance. + Psychophysiology, + 48, + 252-57. \end_layout -\end_deeper \begin_layout Itemize - -\family typewriter -pspm_get_spike +canonical SCRF: + Bach DR, + Friston KJ, + & Dolan RJ (2010). + Analytic measures for quantification of arousal from spontaneous skin conductance fluctuations. + International Journal of Psychophysiology, + 76, + 52-55. \end_layout -\begin_deeper \begin_layout Itemize -A minor bug caused by a non-existing variable has been fxied. +MP algorithm: + Bach DR, + Staib M (2015). + A matching pursuit algorithm for inferring tonic sympathetic arousal from spontaneous skin conductance fluctuations. + Psychophysiology, + 52, + 1106-12. \end_layout \end_deeper \begin_layout Itemize - -\family typewriter -pspm_scr_pp -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that could change the original file if it saves epochs to -\family typewriter -missing_epoch.mat -\family default - has been fixed. +GLM for evoked HPR: + Paulus PC, + Castegnetti G, + & Bach DR (2016). + Modeling event-related heart period responses. + Psychophysiology, + 53, + 837-846. \end_layout -\end_deeper -\begin_layout Subsubsection* -Improvements -\end_layout - -\begin_layout Itemize - -\family typewriter -pspm_extract_segments -\end_layout - -\begin_deeper -\begin_layout Itemize -Now -\family typewriter -pspm_extract_segments -\family default - process the data after excluding the missing data information that is provided - in the model structure. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_dcm -\end_layout - -\begin_deeper -\begin_layout Itemize -Processed data are now initialised as data matrix with -\family typewriter -NaN -\family default - before inserting data of variable size. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_glm -\end_layout - -\begin_deeper -\begin_layout Itemize -A warning has been added if any duration in onset definition is above -\family typewriter -0 -\family default - and modality is not -\family typewriter -sps -\family default -. -\end_layout - -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_overwrite -\end_layout - -\begin_deeper -\begin_layout Itemize -The logic of overwriting files in PsPM has been updated. -\end_layout - -\begin_layout Itemize -Specifically, the overwriting operation is applicable only if there has - been a file with the proposed name of the outputfile. -\end_layout - \begin_layout Itemize -A warning will be provided if the user chooses not to overwrite the file, - since the output of PsPM will not be saved. +GLM for fear-conditioned HPR: + Castegnetti G, + Tzovara A, + Staib M, + Paulus PC, + Hofer N, + & Bach DR (2016). + Modeling fear-conditioned bradycardia in humans. + Psychophysiology, + 53, + 930-939. \end_layout -\end_deeper -\begin_layout Itemize - -\family typewriter -pspm_split_sessions -\end_layout - -\begin_deeper -\begin_layout Itemize -A misleading warning provided by -\family typewriter -pspm_split_sessions -\family default - when it processes a missing epoch file has been fixed. -\end_layout - -\begin_layout Itemize -The help text of -\family typewriter -split_sessions -\family default - in the GUI has been updated. -\end_layout - -\end_deeper -\begin_layout Subsubsection* -UI improvements -\end_layout - -\begin_layout Itemize -PsPM's UI in Linux environment has been improved. -\end_layout - -\begin_layout Subsection* -Version 6.1.2 -\end_layout - -\begin_layout Subsubsection* -Bug fixes -\end_layout - -\begin_layout Itemize -GUI -\end_layout - -\begin_deeper -\begin_layout Itemize -A bug that made channel actions in EMG pre-processing unrecognised has been - fixed. -\end_layout - \begin_layout Itemize -A bug, which sometimes made DCM not run from the GUI, has been fixed. +GLM for evoked respiratory responses: + Bach DR, + Gerster S, + Tzovara A, + Castegnetti G (2016). + A linear model for event-related respiration responses. + Journal of Neuroscience Methods, + 270, + 147-155. + \end_layout -\end_deeper \begin_layout Itemize - -\family typewriter -pspm_convert_hb2hp +GLM for fear-conditioned RAR: + Castegnetti C, + Tzovara A, + Staib M, + Gerster S, + Bach DR (2017). + Assessing fear memory via conditioned respiratory amplitude responses. + Psychophysiology, + 54, + 215-223. \end_layout -\begin_deeper \begin_layout Itemize -A bug, which incorrectly selected heart rate channels, has been fixed. +GLM for illuminance-elicited PSR: + Korn CW & Bach DR (2016). + A solid frame for the window on cognition: + Modeling event-related pupil responses. + Journal of Vision, + 16, + 28. + \end_layout -\end_deeper \begin_layout Itemize - -\family typewriter -pspm_dcm +GLM for fear-conditioned PSR: + Korn CW, + Staib M, + Tzovara A, + Castegnetti G, + Bach DR (2017). + A pupil size response model to quantify fear conditioning. + Psychophysiology, + 54, + 330-343. \end_layout -\begin_deeper \begin_layout Itemize -A bug, which could lead to a wrong sample rate being used if more than one - SCR channel existed in the file, has been fixed. +GLM for SEBR: + Khemka S, + Tzovara A, + Gerster S, + Quednow BB, + Bach DR (2017). + Modeling startle eyeblink electromyogram to assess fear learning. + Psychophysiology, + 54, + 204-214. \end_layout -\end_deeper \begin_layout Itemize - -\family typewriter -pspm_glm +GLM for scanpath speed: + Xia Y, + Melinščak F, + Bach DR (2020). + Saccadic scanpath length: + an index for human threat conditioning. + Behavior Research Methods, + 53, + 1426-1439. \end_layout -\begin_deeper \begin_layout Itemize -A bug, which leads to markers being taken from the first marker channel - but markervalues from the last, has been fixed. +Integration of different measures: + Mancinelli F*, + Sporrer JK*, + Myrov V, + Melinscak F, + Zimmermann J, + Huaiyu L, + Bach DR (2024). + Dimensionality and optimal combination of autonomic fear-conditioning measures in humans. + Behavior Research Methods, + 56, + 6119–6129. \end_layout -\end_deeper \begin_layout Part Acknowledgements \end_layout \begin_layout Standard -SCRalyze versions 1–2 were developed at the FIL, Wellcome Centre for Human - Neuroimaging, University College London, under the auspices of Karl J. - Friston and Raymond J. - Dolan. - Guillaume Flandin contributed to GLM, and Jean Daunizeau to DCM. - Eric Featherstone, Alfonso Reid, Oliver Josephs, and Chloe Hutton helped - with the import functions. - This development was funded by the Swiss National Science Foundation with - a personal grant to Dominik R. - Bach, and by the Wellcome Trust with a programme grant to Raymond J. - Dolan. +Beyond the authors named on this manual, + the following persons contributed to PsPM. \end_layout -\begin_layout Standard -\begin_inset VSpace defskip -\end_inset - - -\end_layout - -\begin_layout Standard -PsPM 3.0 was developed at the University of Zurich, funded by the University - of Zurich and by the Swiss National Science Foundation with a project grant. - The Matlabbatch GUI was written by Gabriel Gräni at University of Zurich. - Help texts and tutorial were developed by Christoph Korn and Matthias Staib. - The data display was written by Philipp C Paulus, University of Dresden. - The test environment was contributed by Linus Rüttimann, and extended by - Tobias Moser, both University of Zurich. +\begin_layout Itemize +Import functions: + Eric Featherstone, + Chloe Hutton, + Oliver Josephs, + Alfonso Reid. \end_layout -\begin_layout Standard -\begin_inset VSpace defskip -\end_inset - - +\begin_layout Itemize +Model development and model inversion: + Jean Daunizeau, + Guillaume Flandin, + Karl Friston. \end_layout \begin_layout Standard -Various models have been developed by different researchers. - These are: -\end_layout - -\begin_layout Itemize -Dominik R. - Bach: SCR models and GLM for evoked respiratory responses +PsPM uses code from the following toolboxes: \end_layout \begin_layout Itemize -Matthias Staib: Optimisation of non-linear SCR model +SON library for CED spike *.smr import (Malcolm Lidierth at King's College London) \end_layout \begin_layout Itemize -Philipp Paulus: GLM for evoked HPR +SPM physiology toolbox for CED spike *.smr import (Eric Featherstone, + Chloe Hutton) \end_layout \begin_layout Itemize -Giuseppe Castegnetti: GLM for fear-conditioned HPR and RAR +Biopac Acknowledge import (Sebastien Authier, + Vincent Finnertyat the University of Montreal) \end_layout \begin_layout Itemize -Christoph Korn: PSM models +FieldTrip for various import routines (Robert Oostenveldt at Radboud University Nijmegen) \end_layout -\begin_layout Itemize -Saurabh Khemka: GLM for SEBR +\begin_layout Standard +PsPM incorporates the following published toolboxes and/or methods: \end_layout \begin_layout Itemize -Yanfang Xia: GLM for ScanPath Speed -\end_layout +SCR quality control +\begin_inset CommandInset citation +LatexCommand cite +key "Kleckner:2017a" +literal "false" -\begin_layout Standard -\begin_inset Separator plain \end_inset \end_layout -\begin_layout Standard -Some PsPM functions depend on external scripts/libraries implemented by - other groups: -\end_layout - \begin_layout Itemize -For import of spike data, PsPM makes use of the SON library written by Malcolm - Lidierth at King's College London, and of functions provided by the SPM - physiology toolbox, written by Chloe Hutton and Eric Featherstone at the - FIL. -\end_layout +pupil preprocessing +\begin_inset CommandInset citation +LatexCommand cite +key "kret2018preprocessing" +literal "false" + +\end_inset -\begin_layout Itemize -Biopac AcqKnowledge import uses a routine created by Sebastien Authier and - Vincent Finnerty at the University of Montreal. -\end_layout -\begin_layout Itemize -The DCM inversion uses a variational Bayesian inversion scheme written by - Jean Daunizeau. \end_layout \begin_layout Itemize -Some SCR quality control functions use the method described in +pupil foreshortening error correction \begin_inset CommandInset citation LatexCommand cite -key "Kleckner:2017a" +key "Hayes:2015a" literal "false" \end_inset -. + \end_layout \begin_layout Itemize -Pupil preprocessing uses external scripts adapted from the implementations - by Mariska Kret and Elio Sjak-Shie at -\begin_inset Newline newline -\end_inset - - -\begin_inset CommandInset href -LatexCommand href -name "https://github.com/ElioS-S/pupil-size" -target "https://github.com/ElioS-S/pupil-size" -literal "false" - -\end_inset - -. - The original reference is +QRS detection for fMRI enviornments \begin_inset CommandInset citation LatexCommand cite -key "kret2018preprocessing" +key "liu2012statistical" literal "false" \end_inset -. + \end_layout \begin_layout Itemize -Pupil foreshortening error correction implements the method proposed in - +HeartPy toolbox for pulse oxymetry \begin_inset CommandInset citation LatexCommand cite -key "Hayes:2015a" +key "Gent:2019aa" literal "false" \end_inset - by Taylor Hayes and Alexander Petrov. + \end_layout \begin_layout Itemize -QRS detection for fMRI environment uses external scripts adapted from the - code by Zhongming Liu, Jacco A de Zwart, Peter van Gelderen, Li-Wei Kuo, - and Jeff H Duyn at -\begin_inset CommandInset href -LatexCommand href -name "https://www.amri.ninds.nih.gov/software.html" -target "https://www.amri.ninds.nih.gov/software.html" -literal "false" - -\end_inset - -. - The original reference is +VBA toolbox \begin_inset CommandInset citation LatexCommand cite -key "liu2012statistical" +key "Daunizeau:2014aa" literal "false" \end_inset -. + \end_layout \begin_layout Part diff --git a/doc/PsPM_Manual.pdf b/doc/PsPM_Manual.pdf index 3021aae31..f18f5827c 100644 Binary files a/doc/PsPM_Manual.pdf and b/doc/PsPM_Manual.pdf differ diff --git a/doc/PsPM_References.lyx b/doc/PsPM_options_documentation.lyx similarity index 98% rename from doc/PsPM_References.lyx rename to doc/PsPM_options_documentation.lyx index 998e5eef2..7679ecf56 100644 --- a/doc/PsPM_References.lyx +++ b/doc/PsPM_options_documentation.lyx @@ -1,5 +1,5 @@ -#LyX 2.3 created this file. For more info see http://www.lyx.org/ -\lyxformat 544 +#LyX 2.4 created this file. For more info see https://www.lyx.org/ +\lyxformat 620 \begin_document \begin_header \save_transient_properties true @@ -19,11 +19,11 @@ \setlist[itemize]{noitemsep} \end_preamble \use_default_options true -\maintain_unincluded_children false +\maintain_unincluded_children no \language english \language_package default \inputencoding utf8 -\fontencoding global +\fontencoding auto \font_roman "default" "default" \font_sans "default" "default" \font_typewriter "default" "default" @@ -31,7 +31,9 @@ \font_default_family default \use_non_tex_fonts false \font_sc false -\font_osf false +\font_roman_osf false +\font_sans_osf false +\font_typewriter_osf false \font_sf_scale 100 100 \font_tt_scale 100 100 \use_microtype false @@ -65,7 +67,9 @@ \suppress_date false \justification true \use_refstyle 1 +\use_formatted_ref 0 \use_minted 0 +\use_lineno 0 \index Index \shortcut idx \color #008000 @@ -82,23 +86,29 @@ \papercolumns 1 \papersides 1 \paperpagestyle default +\tablestyle default \listings_params "language=Matlab,float=hbp,basicstyle={\footnotesize\ttfamily},identifierstyle={\color{colIdentifier}},keywordstyle={\color{colKeys}},stringstyle={\color{colString}},commentstyle={\itshape\color{colComments}},columns=fixed,tabsize=2,extendedchars=true,showspaces=false,showstringspaces=false,captionpos=t,backgroundcolor={\color{white}},framexleftmargin=1pt,frame=l" \tracking_changes false \output_changes false +\change_bars false +\postpone_fragile_content false \html_math_output 0 \html_css_as_file 0 \html_be_strict false +\docbook_table_output 0 +\docbook_mathml_prefix 1 \end_header \begin_body \begin_layout Title -PsPM: Option References +PsPM: + Options documentation \end_layout \begin_layout Standard \align center -Version 6.1.2 +Version 7.0 \end_layout \begin_layout Standard @@ -116,8 +126,9 @@ status open \begin_layout Plain Layout \noindent -If you have comments on or error corrections to this documentation, please - send them to the PsPM team or post them on: +If you have comments on or error corrections to this documentation, + please send them to the PsPM team or post them on: + \begin_inset CommandInset href LatexCommand href name "bachlab.org/pspm" @@ -138,9 +149,23 @@ literal "false" \begin_layout Standard \align center -Dominik R Bach, Giuseppe Castegnetti, Laure Ciernik, Samuel Gerster, Saurabh - Khemka, Christoph Korn, Samuel Maxwell, Tobias Moser, Philipp C Paulus, - Ivan Rojkov, Matthias Staib, Eshref Yozdemir, Teddy Zhao and collaborators +Dominik R Bach, + Giuseppe Castegnetti, + Laure Ciernik, + Samuel Gerster, + Uzay Gökay, + Saurabh Khemka, + Christoph Korn, + Samuel Maxwell, + Tobias Moser, + Philipp C Paulus, + Ivan Rojkov, + Matthias Staib, + Bernhard Agoué von Raußendorf, + Yanfang Xia, + Eshref Yozdemir, + Teddy Zhao, + and collaborators \end_layout \begin_layout Standard @@ -176,7 +201,8 @@ Introduction \end_layout \begin_layout Standard -Since version 6.1, PsPM has started using +Since version 6.1, + PsPM has started using \family typewriter pspm_options \family default @@ -186,13 +212,9 @@ pspm_options pspm_options \family default and described in this document with their explanations wherever available. - The values of option fields have their own specification requirements and - should be set carefully if non-standard values are used. - Please check this document carefully about how to set values for the option - fields. - The errors which may appear when such variables have been set according - to this guideline should be sent to PsPM developer team for getting further - support. + The values of option fields have their own specification requirements and should be set carefully if non-standard values are used. + Please check this document carefully about how to set values for the option fields. + The errors which may appear when such variables have been set according to this guideline should be sent to PsPM developer team for getting further support. \end_layout \begin_layout Section @@ -209,7 +231,8 @@ A word written in bold means the name of a variable. \begin_deeper \begin_layout Itemize -Example: +Example: + \series bold channel \end_layout @@ -220,12 +243,13 @@ Data type \end_layout \begin_layout Standard -There are five basic kinds of data types used for the values of the fields - in PsPM, which are namely +There are five basic kinds of data types used for the values of the fields in PsPM, + which are namely \shape italic cell \shape default -, +, + \shape italic character \shape default @@ -233,15 +257,18 @@ character \shape italic char \shape default -), +), + \shape italic double \shape default -, +, + \shape italic logical \shape default -, and +, + and \shape italic struct \shape default @@ -250,7 +277,8 @@ struct \shape italic double \shape default -, there are some values required to be +, + there are some values required to be \shape italic integers \shape default @@ -259,7 +287,8 @@ integers \begin_inset Formula $1\times1$ \end_inset - size, and there are therefore denoted as + size, + and there are therefore denoted as \shape italic double (vector) \shape default @@ -268,7 +297,8 @@ double (vector) double (matrix) \shape default . - If unspecified, + If unspecified, + \shape italic double (vector) \shape default @@ -281,7 +311,8 @@ double (vector) \shape italic integers \shape default -, they will be specified as +, + they will be specified as \shape italic integer (vector) \shape default @@ -297,10 +328,8 @@ Unit \end_layout \begin_layout Standard -Content in this column demonstrates the unit of default and acceptable values - of this field. - This column will not be available for the tables when there are no variables - with physical meaning and units. +Content in this column demonstrates the unit of default and acceptable values of this field. + This column will not be available for the tables when there are no variables with physical meaning and units. \end_layout \begin_layout Subsection @@ -312,26 +341,28 @@ Default values are used if users have not customised the fields. \end_layout \begin_layout Itemize -A word written in typewritter format means a string that is used in the - code, typically the value of a variable. +A word written in typewritter format means a string that is used in the code, + typically the value of a variable. \end_layout \begin_deeper \begin_layout Itemize -Example: +Example: + \family typewriter add \end_layout \end_deeper \begin_layout Itemize -A number written in typewritter denotes a number used in the code, typically - the value of a variable. +A number written in typewritter denotes a number used in the code, + typically the value of a variable. \end_layout \begin_deeper \begin_layout Itemize -Example: +Example: + \family typewriter 1 \end_layout @@ -342,8 +373,10 @@ Acceptable values \end_layout \begin_layout Standard -Apart from the notations described above for the default values, two additional - terms, Any and Subset, are also used: +Apart from the notations described above for the default values, + two additional terms, + Any and Subset, + are also used: \end_layout \begin_layout Labeling @@ -552,8 +585,8 @@ add replace \family default The results will replace the old data in the corresponding channel. - If no corresponding channel is available, the results will be added as - a new channel. + If no corresponding channel is available, + the results will be added as a new channel. \end_layout \end_deeper @@ -1907,7 +1940,8 @@ Any \end_layout \begin_layout Subsection -Convert Electrocardiogram To Heart Beat, Advanced MRI +Convert Electrocardiogram To Heart Beat, + Advanced MRI \end_layout \begin_layout Standard @@ -2132,7 +2166,8 @@ bpm \begin_layout Plain Layout \family typewriter -[0.5, 40] +[0.5, + 40] \end_layout \end_inset @@ -2143,17 +2178,21 @@ bpm \begin_layout Plain Layout \family typewriter -[m, n] +[m, + n] \family default -: +: + \family typewriter m>0 \family default -, +, + \family typewriter n>0 \family default -, +, + \family typewriter n>m \end_layout @@ -2198,7 +2237,8 @@ bpm \begin_layout Plain Layout \family typewriter -[20, 200] +[20, + 200] \end_layout \end_inset @@ -2209,17 +2249,21 @@ bpm \begin_layout Plain Layout \family typewriter -[m, n] +[m, + n] \family default -: +: + \family typewriter m>0 \family default -, +, + \family typewriter n>0 \family default -, +, + \family typewriter n>m \end_layout @@ -2379,7 +2423,8 @@ auto \begin_layout Plain Layout \family typewriter -ecg, teo +ecg, + teo \end_layout \end_inset @@ -2422,7 +2467,8 @@ Hz \begin_layout Plain Layout \family typewriter -[8, 40] +[8, + 40] \end_layout \end_inset @@ -3323,7 +3369,8 @@ settings.lateral.char.b \begin_layout Plain Layout \family typewriter -settings.lateral.char.l, settings.lateral.char.r +settings.lateral.char.l, + settings.lateral.char.r \end_layout \end_inset @@ -5174,7 +5221,8 @@ param \begin_layout Plain Layout \family typewriter -cond, recon +cond, + recon \end_layout \end_inset @@ -5428,7 +5476,8 @@ none \begin_layout Plain Layout \family typewriter -screen, file output +screen, + file output \end_layout \end_inset @@ -5651,7 +5700,8 @@ seconds \begin_layout Plain Layout \family typewriter -samples, markers +samples, + markers \end_layout \end_inset @@ -5774,7 +5824,8 @@ none \begin_layout Plain Layout \family typewriter -add, replace +add, + replace \end_layout \end_inset @@ -6134,7 +6185,9 @@ double (vector) \begin_layout Plain Layout \family typewriter -[a, b]; a,b∈R +[a, + b]; + a,b∈R \end_layout \end_inset @@ -6435,7 +6488,8 @@ combined \begin_layout Plain Layout \family typewriter -left, right +left, + right \end_layout \end_inset @@ -6469,7 +6523,8 @@ double (vector) \begin_layout Plain Layout \family typewriter -[0.5, 0.5] +[0.5, + 0.5] \end_layout \end_inset @@ -6690,7 +6745,8 @@ double (vector) \begin_layout Plain Layout \family typewriter -[1, 1] +[1, + 1] \end_layout \end_inset @@ -6701,7 +6757,9 @@ double (vector) \begin_layout Plain Layout \family typewriter -[a, b]; a,b∈R +[a, + b]; + a,b∈R \end_layout \end_inset @@ -6824,7 +6882,9 @@ gaze_x_l \begin_layout Plain Layout \family typewriter -gaze_x_r, gaze_y_l, gaze_y_r +gaze_x_r, + gaze_y_l, + gaze_y_r \end_layout \end_inset @@ -6914,7 +6974,10 @@ none \begin_layout Plain Layout \family typewriter -gaze_x_l, gaze_x_r, gaze_y_l, gaze_y_r +gaze_x_l, + gaze_x_r, + gaze_y_l, + gaze_y_r \end_layout \end_inset @@ -8212,7 +8275,12 @@ NS \begin_layout Plain Layout \family typewriter -struct('segment_length', m, 'cutoff', n), m, n > 0 +struct('segment_length', + m, + 'cutoff', + n), + m, + n > 0 \end_layout \end_inset @@ -8726,7 +8794,11 @@ linear \begin_layout Plain Layout \family typewriter -pchip, nearest, spline, previous, next +pchip, + nearest, + spline, + previous, + next \end_layout \end_inset @@ -9096,7 +9168,8 @@ integer (vector) \begin_layout Plain Layout \family typewriter -[0, 0] +[0, + 0] \end_layout \end_inset @@ -9653,7 +9726,12 @@ double (vector) \begin_layout Plain Layout \family typewriter -[a, b, c]: a, b, c>0 +[a, + b, + c]: + a, + b, + c>0 \end_layout \end_inset @@ -10332,7 +10410,8 @@ double (vector) \begin_layout Plain Layout \family typewriter -[43.5, 29.9] +[43.5, + 29.9] \end_layout \end_inset @@ -10343,7 +10422,10 @@ double (vector) \begin_layout Plain Layout \family typewriter -[a, b]: a, b>0 +[a, + b]: + a, + b>0 \end_layout \end_inset @@ -10377,7 +10459,8 @@ double (vector) \begin_layout Plain Layout \family typewriter -[1920, 1080] +[1920, + 1080] \end_layout \end_inset @@ -10388,7 +10471,10 @@ double (vector) \begin_layout Plain Layout \family typewriter -[a, b]: a, b>0 +[a, + b]: + a, + b>0 \end_layout \end_inset @@ -10511,7 +10597,8 @@ pupil \begin_layout Plain Layout \family typewriter -pupil_l, pupil_r +pupil_l, + pupil_r \end_layout \end_inset @@ -10556,7 +10643,8 @@ none \begin_layout Plain Layout \family typewriter -pupil_l, pupil_r +pupil_l, + pupil_r \end_layout \end_inset @@ -10924,7 +11012,11 @@ cell \begin_layout Plain Layout \family typewriter -{rp, ra, rfr, rs, all} +{rp, + ra, + rfr, + rs, + all} \end_layout \end_inset @@ -11236,7 +11328,8 @@ add \begin_layout Plain Layout \family typewriter -replace, withdraw +replace, + withdraw \end_layout \end_inset @@ -11797,7 +11890,8 @@ none \begin_layout Plain Layout \family typewriter -downsample, interpolate +downsample, + interpolate \end_layout \end_inset @@ -12266,7 +12360,11 @@ double (vector) \begin_layout Plain Layout \family typewriter -[0.92, 3.92, 2.16, 1.53, 1.64] +[0.92, + 3.92, + 2.16, + 1.53, + 1.64] \end_layout \end_inset @@ -12334,7 +12432,8 @@ double \end_layout \begin_layout Subsection -Spontaneous Fluctuations — Dynamic Causal Modelling +Spontaneous Fluctuations — + Dynamic Causal Modelling \end_layout \begin_layout Standard @@ -12567,7 +12666,11 @@ double (vector) \begin_layout Plain Layout \family typewriter -[0.92, 3.92, 2.16, 1.53, 1.64] +[0.92, + 3.92, + 2.16, + 1.53, + 1.64] \end_layout \end_inset @@ -12635,7 +12738,8 @@ double \end_layout \begin_layout Subsection -Spontaneous Fluctuations — Matching Pursuit +Spontaneous Fluctuations — + Matching Pursuit \end_layout \begin_layout Standard @@ -12868,7 +12972,11 @@ double (vector) \begin_layout Plain Layout \family typewriter -[0.92, 3.92, 2.16, 1.53, 1.64] +[0.92, + 3.92, + 2.16, + 1.53, + 1.64] \end_layout \end_inset @@ -13773,7 +13881,8 @@ last \begin_layout Plain Layout \family typewriter -first, all +first, + all \end_layout \end_inset diff --git a/doc/PsPM_References.pdf b/doc/PsPM_options_documentation.pdf similarity index 56% rename from doc/PsPM_References.pdf rename to doc/PsPM_options_documentation.pdf index 0b801d72f..f066a7444 100644 Binary files a/doc/PsPM_References.pdf and b/doc/PsPM_options_documentation.pdf differ diff --git a/doc/PsPM_release_checklist.md b/doc/PsPM_release_checklist.md index 0a862b511..3e2e049df 100644 --- a/doc/PsPM_release_checklist.md +++ b/doc/PsPM_release_checklist.md @@ -2,10 +2,10 @@ This file contains the steps required for finalising a PsPM release. Many items at the beginning don't have to be followed sequentially. However, it is important that there aren't any revisions (commits) that implement/fix something new in the release branch, because we don't merge these branches back to trunk. Therefore, it is sensible to create the release branch after making absolutely sure that no new stuff will be implemented. - [ ] Update version number & date in - - [ ] `pspm_msg` + - [ ] `pspm_msg.txt` - [ ] `pspm_quit` - [ ] `pspm_ui` - - [ ] `pspm.fig`: Load `pspm.fig` into MATLAB using `openfig`, update `fig.Children(9).String` and save back to `pspm.fig` + - [ ] `pspm_ui_app` - [ ] Manual and Developers Guide: front pages - [ ] Make sure both manuals are updated - [ ] Add release notes section of the new version to manual (at the end) and release\_notes.tex @@ -23,3 +23,5 @@ This file contains the steps required for finalising a PsPM release. Many items - [ ] Add release message to GitHub - [ ] Change release number on lab webpage (gh-pages branch) - [ ] Add release message to lab webpage (gh-pages branch) +- [ ] Update `PsPM_installer` in `/src/helper` with the new version number and download link, and merge this pull request on the official release date. + diff --git a/doc/release_notes.pdf b/doc/release_notes.pdf index 43bc5ef2b..8ea8da02f 100644 Binary files a/doc/release_notes.pdf and b/doc/release_notes.pdf differ diff --git a/doc/release_notes.tex b/doc/release_notes.tex index 326b3a496..c0114a8d3 100644 --- a/doc/release_notes.tex +++ b/doc/release_notes.tex @@ -161,7 +161,8 @@ \subsection*{VB inversion} code (Figure \ref{fig:VBA}). \begin{figure} -\includegraphics[scale=0.85]{Figures/Comparison_VBA}\caption{Model comparison between old and new versions of the VBA toolbox, +\includegraphics[scale=0.85]{Figures/Comparison_VBA} +\caption{Model comparison between old and new versions of the VBA toolbox, based on two delay fear conditioning datasets. The log Bayes factor quantifies the difference between negative log likelihood (nLL) of parameter estimates obtained from model inversion using the old and @@ -619,7 +620,9 @@ \section{PsPM Version 5.0.0} \subsection*{New Features} \begin{itemize} \item Allow \texttt{pspm\_data\_editor} to load an epoch file. -\item Allow \texttt{pspm\_simple\_qa} to suppress classification of discretisation oscillations as artefacts, to expand artefact windows, and to automatically remove small data islands embedded in artefacts. +\item Allow \texttt{pspm\_simple\_qa} to suppress classification of discretisation + oscillations as artefacts, to expand artefact windows, and to automatically + remove small data islands embedded in artefacts. \item Allow \texttt{pspm\_simple\_qa} to store the epochs of data that are filtered out into an output \texttt{.mat} file. The accompanying GUI editor is available under 'Artefact removal' in the tools section. @@ -932,19 +935,41 @@ \subsection*{General} \begin{itemize} \item Minimum version of MATLAB \begin{itemize} - \item The minimum version of MATLAB required for running PsPM is \href{https://uk.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/sysreq/files/SystemRequirements-Release14-ServicePack3_SupportedCompilers.pdf}{MATLAB 7.1 or R14 Service Pack 3}. + \item The minimum version of MATLAB required for running PsPM is + \href{https://uk.mathworks.com/content/dam/mathworks/mathworks-dot-com/support/ + sysreq/files/SystemRequirements-Release14-ServicePack3_SupportedCompilers.pdf} + {MATLAB 7.1 or R14 Service Pack 3}. \end{itemize} \item Entering PsPM \begin{itemize} - \item Entering PsPM is now hybrid based on the version of MATLAB, namely through AppDesigner or Guide. PsPM will be entered through AppDesigner when supported and through Guide for older versions of MATLAB. To call PsPM, users should still use the command \texttt{pspm} in the Command Window of MATLAB, where the appropriate way of entering PsPM will be recognised automatically. - \item Users can still use their preferred way to enter PsPM. To enter PsPM through AppDesigner, please type \texttt{pspm\_appdesigner}. To enter PsPM through Guide, which is the classic entrance, please type \texttt{pspm\_guide}. - \item The AppDesigner version of PsPM UI is newly introduced by MATLAB and the encouraged way for launching PsPM, and it has no functionality difference than the Guide version of PsPM UI. - \item Both AppDesigner and Guide are designed and tested for Windows, macOS (either Intel or Apple Silicon) and Linux. Issues of opening PsPM through either of the two UI systems are encouraged to be reported to PsPM developing group at GitHub. + \item Entering PsPM is now hybrid based on the version of MATLAB, namely through + AppDesigner or Guide. PsPM will be entered through AppDesigner when supported + and through Guide for older versions of MATLAB. To call PsPM, users should + still use the command \texttt{pspm} in the Command Window of MATLAB, where + the appropriate way of entering PsPM will be recognised automatically. + \item Users can still use their preferred way to enter PsPM. To enter PsPM through + AppDesigner, please type \texttt{pspm\_appdesigner}. To enter PsPM through + Guide, which is the classic entrance, please type \texttt{pspm\_guide}. + \item The AppDesigner version of PsPM UI is newly introduced by MATLAB and the + encouraged way for launching PsPM, and it has no functionality difference + than the Guide version of PsPM UI. + \item Both AppDesigner and Guide are designed and tested for Windows, macOS (either + Intel or Apple Silicon) and Linux. Issues of opening PsPM through either of the two + UI systems are encouraged to be reported to PsPM developing group at GitHub. \end{itemize} \item Introducing \texttt{pspm\_options} \begin{itemize} - \item A new function \texttt{pspm\_options} is introduced to PsPM for controlling the default and acceptable values of the struct \texttt{options} used by most PsPM functions. The default values of the fields in the struct \texttt{options} for various functions can be directly checked by searching in \texttt{pspm\_options}. - \item The default values in \texttt{pspm\_options} have been checked and tested for PsPM. If preferred values are different from defaults, users can specify them when calling the corresponding PsPM functions, and the corresponding functions and \texttt{pspm\_options} will always respect the users' specification with the highest priority. However, the user's specification needs to satisfy the condition set in \texttt{pspm\_options}, and invalid values may be reported as errors. + \item A new function \texttt{pspm\_options} is introduced to PsPM for controlling + the default and acceptable values of the struct \texttt{options} used by most + PsPM functions. The default values of the fields in the struct \texttt{options} + for various functions can be directly checked by searching in \texttt{pspm\_options}. + \item The default values in \texttt{pspm\_options} have been checked and tested for + PsPM. If preferred values are different from defaults, users can specify them + when calling the corresponding PsPM functions, and the corresponding functions + and \texttt{pspm\_options} will always respect the users' specification with + the highest priority. However, the user's specification needs to satisfy the + condition set in \texttt{pspm\_options}, and invalid values may be reported + as errors. \end{itemize} \item UI Improvements \begin{itemize} @@ -959,24 +984,28 @@ \subsection*{General} \end{itemize} \item Help text \begin{itemize} - \item The help text has been updated for all PsPM functions. Help text can be checked by right clicking the functions. + \item The help text has been updated for all PsPM functions. Help text can be + checked by right clicking the functions. \end{itemize} \end{itemize} \subsection*{Bug Fixes} \begin{itemize} \item UI \begin{itemize} - \item A bug that used to make PsPM crash when \textit{Pupil size convert} and \textit{Gaze convert} in \textit{Data Preprocessing} were selected has been fixed. + \item A bug that used to make PsPM crash when \textit{Pupil size convert} and + \textit{Gaze convert} in \textit{Data Preprocessing} were selected has been fixed. \item A bug that leads to error when PsPM is started offline has been fixed. \item A bug that leads to incorrect x labels in \texttt{pspm\_rev\_dcm} has been fixed. \end{itemize} \item \texttt{pspm\_convert\_...} \begin{itemize} - \item A bug that leads PsPM to crash, which is caused by outdated UI calling for \texttt{pspm\_convert\_...} functions, has been fixed. + \item A bug that leads PsPM to crash, which is caused by outdated UI calling for + \texttt{pspm\_convert\_...} functions, has been fixed. \end{itemize} \item \texttt{pspm\_get\_eyelink} \begin{itemize} - \item A bug that causes issues when importing eye link data that is scanned at both left and right sides has been fixed. + \item A bug that causes issues when importing eye link data that is scanned at both + left and right sides has been fixed. \end{itemize} \item \texttt{pspm\_glm} \begin{itemize} @@ -985,12 +1014,15 @@ \subsection*{Bug Fixes} \item \texttt{pspm\_sf} \begin{itemize} \item A bug that has lead to incorrect input datafile assigning has been fixed. - \item A bug that leads PsPM crash when \texttt{pspm\_sf} is analysing data with missing epochs has been fixed. - \item A bug that leads to error when \texttt{pspm\_sf} analyses data where \texttt{time unit} is defined as \texttt{marker} has been fixed. + \item A bug that leads PsPM crash when \texttt{pspm\_sf} is analysing data with + missing epochs has been fixed. + \item A bug that leads to error when \texttt{pspm\_sf} analyses data where + \texttt{time unit} is defined as \texttt{marker} has been fixed. \end{itemize} \item \texttt{pspm\_split\_sessions} \begin{itemize} - \item \texttt{pspm\_split\_sessions} now considers \texttt{marker\_chan\_num} when calling \texttt{pspm\_trim}. + \item \texttt{pspm\_split\_sessions} now considers \texttt{marker\_chan\_num} when + calling \texttt{pspm\_trim}. \end{itemize} \end{itemize} @@ -1011,7 +1043,8 @@ \subsection*{Improvements} \end{itemize} \item \texttt{import\_eyelink} \begin{itemize} - \item Improved \texttt{import\_eyelink} for adding some support for importing eyelink data converted by higher version of .EDF files. + \item Improved \texttt{import\_eyelink} for adding some support for importing eyelink + data converted by higher version of .EDF files. \end{itemize} \item \texttt{pspm\_con2} \begin{itemize} @@ -1024,7 +1057,8 @@ \subsection*{Improvements} \item Improved missing epoch support \begin{itemize} \item The field \texttt{.missing} is now allocated from \texttt{options} to \texttt{model}. - \item \texttt{.missing\_data} is used to load missing epoch data that was loaded from dcm, as an optional field. + \item \texttt{.missing\_data} is used to load missing epoch data that was loaded + from dcm, as an optional field. \end{itemize} \item The index is changed so that the first event will not be excluded when at time 0 in session. \end{itemize} @@ -1034,7 +1068,8 @@ \subsection*{Improvements} \end{itemize} \item \texttt{pspm\_glm} \begin{itemize} - \item The fallback for \texttt{options.exclude\_missing} has been set for \texttt{pspm\_glm}, which is not to exclude any missing epochs. + \item The fallback for \texttt{options.exclude\_missing} has been set for \texttt{pspm\_glm}, + which is not to exclude any missing epochs. \item A bug that leads to incorrect missing epoch checking has been fixed. \item Help text was updated. \item \texttt{marker\_chan\_num} now refers to the first marker channel as default. @@ -1042,7 +1077,8 @@ \subsection*{Improvements} \end{itemize} \item \texttt{pspm\_interp1} \begin{itemize} - \item \texttt{pspm\_interp1} now considers the data where no valid values are detected and interpolation is not possible, and warnings will be reported in this case. + \item \texttt{pspm\_interp1} now considers the data where no valid values are + detected and interpolation is not possible, and warnings will be reported in this case. \end{itemize} \item \texttt{pspm\_merge} \begin{itemize} @@ -1074,7 +1110,9 @@ \subsection*{Improvements} \end{itemize} \item \texttt{pspm\_text} \begin{itemize} - \item The Matlab file that stores the information of help text \texttt{pspm\_text.mat} will be stored inside the source folder of PsPM and will be deleted when PsPM is quit. + \item The Matlab file that stores the information of help text + \texttt{pspm\_text.mat} will be stored inside the source folder of PsPM + and will be deleted when PsPM is quit. \end{itemize} \item \texttt{pspm\_trim} \begin{itemize} @@ -1087,13 +1125,15 @@ \subsection*{Minor Adjustments} \item \texttt{pspm\_sf}, \texttt{pspm\_glm} and \texttt{pspm\_dcm}. \begin{itemize} \item The option \texttt{marker\_chan\_num\_event} is removed. - \item In default, the first marker channel / event channel is always selected and no users' customisation is allowed. + \item In default, the first marker channel / event channel is always selected and + no users' customisation is allowed. \item The last data channel / wave channel is always selected. \end{itemize} \end{itemize} \subsection*{Reference document} \begin{itemize} - \item New document \textit{PsPM Reference} for checking the default values and restrictions of \texttt{options} fields. + \item New document \textit{PsPM Reference} for checking the default values and + restrictions of \texttt{options} fields. \end{itemize} \section{PsPM Version 6.1.1} @@ -1214,7 +1254,7 @@ \subsection*{UI improvements} \end{itemize} -\section{PsPM Version 6.1.2 } +\section{PsPM Version 6.1.2} \subsection*{Bug fixes} \begin{itemize} \item GUI @@ -1229,7 +1269,8 @@ \subsection*{Bug fixes} \end{itemize} \item \texttt{pspm\_dcm} \begin{itemize} -\item A bug, which could lead to a wrong sample rate being used if more than one SCR channel existed in the file, has been fixed. +\item A bug, which could lead to a wrong sample rate being used if more than one SCR + channel existed in the file, has been fixed. \end{itemize} \item \texttt{pspm\_glm} \begin{itemize} @@ -1238,6 +1279,375 @@ \subsection*{Bug fixes} \end{itemize} \end{itemize} +\section{PsPM Version 7.0.0} +\subsection*{General} +\begin{itemize} +\item PsPM now has an online reference. + +\item The default path will be automatically added when running pspm\_init. + +\item The help text in PsPM has been reviewed and updated. + +\item The consistency of PsPM logic has been reviewed and improved. + +\item Data importing features were reviewed and improved. +\end{itemize} + +\subsection*{GUI} + +\begin{itemize} +\item Description text of functions for improving readability. + +\item Channel processing is now done by universal functions for improving robustness and consistency. + +\item GUI has been updated for compatibility with MATLAB version 2019--2024. + +\item Deprecated modules have been removed. + +\item Now PsPM can be started up at MATLAB 2019--2024 smoothly without issues. + +\item Now PsPM's main GUI is displaying properly. Previously the GUI colour was not displaying. + +\item Now the ACQ importing feature is organised consistently to other importing features. + +\item GUI functions have been updated to keep consistency. + +\item Plots are now consistently using the label style "measurement [unit]". + +\item The text in the input blocks for pspm\_display is now displaying properly. + +\item Unexpected blank lines in help text are now removed. + +\item GUI functions (display, data\_editor, ecg\_editor, review) are reviewed for improving consistency. +\end{itemize} + +\subsection*{New Features} + +\begin{itemize} +\item New HPR model based on Xia, Liu et al. + +\item Provided as pspm\_bf\_hprf\_rew. +\end{itemize} + +\subsection*{Improvements} +\begin{itemize} +\item General + +\begin{itemize} +\item New helper function for processing multiple data channel simultaneously. + +\item Functions always work on one data file only unless explicitly designed to work on multiple files. + +\item Functions that write data into channels always return [sts, channel\_index] and potentially further output arguments, and functions that create new files always return [sts, newfilename] and potentially further output arguments. + +\end{itemize} + +\item pspm\_check\_data + +\begin{itemize} +\item A new function for checking input data, now used by pspm\_load\_data and pspm\_write\_channel. + +\item pspm\_check\_python, pspm\_check\_python\_modules, pspm\_find\_python + +\item New functions checking python modules for calling corresponding packages. +\end{itemize} + +\item pspm\_combine\_markerchannels + +\begin{itemize} +\item Now pspm\_combine\_markerchannels only process one specific data file or data channel. +\end{itemize} + +\item pspm\_convert\_hb2hp + +\begin{itemize} +\item Improved interpolation by using nearest neighbour instead of linear extrapolation (including a new regression test). +\end{itemize} + +\item pspm\_dcm + +\begin{itemize} +\item Now the option depth has been implemented. The option can invert an entire session at the same time. +\end{itemize} + +\item pspm\_extract\_segments + +\begin{itemize} +\item Updated missing epoch checking. + +\item Incomplete options will no longer give warnings, instead, it will use the default values. + +\item GUI has been updated for corresponding the function updates. + +\item Compatibility with pspm\_glm has been improved. +\end{itemize} + +\item pspm\_get\_eyelink + +\begin{itemize} +\item Now it will import not only ethernet ('msg') but also parallel/serial ('input') input to Eyelink eyetracker. +\end{itemize} + +\item pspm\_get\_timing + +\begin{itemize} +\item Now catches an edge case in epoch definition (negative epoch onsets). +\end{itemize} + +\item pspm\_glm + +\begin{itemize} +\item Unnecessary and impossible orthogonalisation in edge case has been removed. + +\item Now allows saving events. + +\item Computation of events in case of edge cases were corrected. + +\item The output now includes time stamps for troubleshooting. +\end{itemize} + +\item pspm\_import + +\begin{itemize} +\item Now only one data file is allowed to be processed by this function. +\end{itemize} + +\item pspm\_interpolate + +\begin{itemize} +\item Only one data file is allowed to be processed, and multiple data files are no longer supported. + +\item One or all data channel(s) are accepted, and multiple selected data channels are no longer supported. Correspondingly, pspm\_load\_channel and pspm\_select\_channels are used for handling a single channel or all channels, respectively. To select all the data channels, the channel specification needs to be all. + +\item An input as struct is no longer supported. + +\item Extrapolation has been improved by avoiding adding unsolicited 1 in the beginning. +\end{itemize} + +\item pspm\_load\_channel + +\begin{itemize} +\item Updated to allow detecting whether a channel is a wave or events channel. + +\item Function will no longer terminate if wrong channel type is provided, instead, it will give a warning and continue processing. +\end{itemize} + +\item pspm\_logical2epochs + +\begin{itemize} +\item New function that processes index values. +\end{itemize} + +\item pspm\_merge + +\begin{itemize} +\item Now only one data file is allowed to be processed by this function. +\end{itemize} + +\item pspm\_options + +\begin{itemize} +\item Updated for pspm\_interpolate to deal with the larger number of methods allowed. +\end{itemize} + +\item pspm\_pupil\_pp + +\begin{itemize} +\item Improved by using a different criterion for the decision on whether to combine pupils. +\end{itemize} + +\item pspm\_rename + +\begin{itemize} +\item The function, previously known as pspm\_ren, has been renamed for enhanced transparency. + +\item pspm\_rename now uses pspm\_load\_data to save data and checks whether new file already exist. +\end{itemize} + +\item pspm\_resp\_pp + +\begin{itemize} +\item Improved interpolation by using nearest neighbour instead of linear extrapolation (including a new regression test). +\end{itemize} + +\item pspm\_scr\_pp + +\begin{itemize} +\item Now only one data file is allowed to be processed by this function. +\end{itemize} + +\item pspm\_select\_channel + +\begin{itemize} +\item pupil and pupil\_missing are no longer confused. +\end{itemize} + +\item pspm\_split\_sessions + +\begin{itemize} +\item Now uses pspm\_trim. +\end{itemize} + +\item pspm\_trim + +\begin{itemize} +\item Now only one data file is allowed to be processed by this function. + +\item Now able to trim missing epoch files. + +\item Now uses pspm\_load\_channel for data processing. + +\item Now catch an edge case in epoch definition (negative epoch onsets). +\end{itemize} + +\item pspm\_write\_channel + +\begin{itemize} +\item pspm\_write\_channel now uses pspm\_select\_channels for checking channels. +\end{itemize} + +\subsection*{Bug fixes} + +\item General + +\begin{itemize} +\item Data channel index handling has been updated. +\end{itemize} + +\item GUI + +\begin{itemize} +\item Buttons, which previously did not respond when being clicked, have been working properly now. + +\item Main GUI colour profile has been reviewed and re-adjusted. + +\item The feature artefact removal now displays the option change data. + +\item The Data convert item appears under Tools in the main GUI, which was previously non-selectable, is now working properly. + +\item The pspm\_display GUI, previously threw a warning when called with full file path, has been working properly now. + +\item The pspm\_data\_editor GUI, previously did not show the output file when specified, has been working properly now. + +\item An issue that appears when PsPM starts up, which is related to path, has been fixed. + +\item An issue that causes GUI colour missing has been fixed. +\end{itemize} + +\item pspm\_check\_data + +\begin{itemize} +\item Ensure backwards data file compatibility by modifying wrong markerinfo handling. +\end{itemize} + +\item pspm\_combine\_markerchannels + +\begin{itemize} +\item Incorrect processing for markerinfo.name, which previously created a char rather than a cell array, has been fixed. +\end{itemize} + +\item pspm\_data\_editor + +\begin{itemize} +\item A bug causing incorrect Y axis display has been fixed. + +\item A bug causing unsuccessful initialisation of handles.options has been fixed. +\end{itemize} + +\item pspm\_dcm / pspm\_dcm\_inv + +\begin{itemize} +\item A bug, which makes inf not recognised properly by pspm\_options, has been fixed. +\end{itemize} + +\item pspm\_display + +\begin{itemize} +\item An issue, which caused failure of running pspm\_display, has been fixed. +\end{itemize} + +\item pspm\_extract\_segments + +\begin{itemize} +\item A bug, which improperly normalised with missing value, has been fixed. +\end{itemize} + +\item pspm\_get\_eyelink + +\begin{itemize} +\item A bug causing marker importing has been fixed. +\end{itemize} + +\item pspm\_get\_markerinfo + +\begin{itemize} +\item Function is updated by improving data checking for avoiding importing bugs. +\end{itemize} + +\item pspm\_get\_timing + +\begin{itemize} +\item The function used to cause problem running GLM with conditions created from marker info, now it is fixed. +\end{itemize} + +\item pspm\_glm + +\begin{itemize} +\item A GUI issue has been fixed. + +\item An issue, which caused incorrect trial exclusion, has been addressed. + +\item An issue, which was caused by pmod setting, has been fixed. + +\item The option overwrite is now adjustable through GUI. + +\item GLM for SPS now parse the modelling properly if "best eye" is selected. + +\item A bug related to incorrect sample rate has been fixed. +\end{itemize} + +\item pspm\_init + +\begin{itemize} +\item Duplicated path removal has been removed. +\end{itemize} + +\item pspm\_multi2index + +\begin{itemize} +\item A bug related to missing index for a vector has been fixed. +\end{itemize} + +\item pspm\_options + +\begin{itemize} +\item A bug that caused incorrect function calling has been fixed. + +\item Argument updates for some functions, pspm\_pp. +\end{itemize} + +\item pspm\_process\_illuminance + +\begin{itemize} +\item options.missing, when specified as "no missing epochs", can allow processing as expected and no longer give warnings. +\end{itemize} + +\item pspm\_scr\_pp + +\begin{itemize} +\item A bug that causes unsuccessful data loading has been fixed. +\end{itemize} + +\item pspm\_trim +\begin{itemize} +\item pspm\_trim` no longer exits if the missing epochs are empty. +\end{itemize} +\end{itemize} +\subsubsection*{New test functions} +\begin{itemize} +\item New test functions for Python package calling have been added. +\end{itemize} + \bibliographystyle{pnas2009} \bibliography{PsPM} diff --git a/src/f_SCR.m b/src/f_SCR.m index 7adb76f2a..192f6802b 100644 --- a/src/f_SCR.m +++ b/src/f_SCR.m @@ -18,14 +18,14 @@ % ● Format % [fx, dfdx, dfdP] = f_SCR(Xt,Theta,ut,in) % ● Arguments -% Theta: 4 ER constants (3 ODE params + time) +% * Theta: 4 ER constants (3 ODE params + time) % 3 SF constants (3 ODE params) % 3 values per aSCR (invsigma(peaktime), invsigma(std), % log(amplitude)) % 1 value per eSCR (log(amplitude)) % 2 values per SF (invsigma(peaktime), log(amplitude)) % 2 values per SCL change (invsigma(time), amplitude) -% ut: row 1 - time (after cue onset) +% * ut: row 1 - time (after cue onset) % row 2 - number of aSCR % row 3 - number of eSCR % row 4 - number of SF @@ -89,15 +89,15 @@ [s, dsdx(k)] = sigm(aTheta(k, 2), sig); aTheta(k, 2) = s + sigma_offset; aTheta(k, 3) = exp(aTheta(k, 3)); - end; + end if any(isinf(aTheta(:, 3))) aTheta(isinf(aTheta(:, 3)), 3) = 1e200; % an arbitrary value way below realmax - end; + end clear sig m s else aTheta = []; aSCR_s = 5; -end; +end % - event-related responses if ut(3) > 0 @@ -109,11 +109,11 @@ eTheta(:, 3) = exp(Theta((Theta_n + 3 * ut(2)) + (1:ut(3)))); if any(isinf(eTheta(:, 3))) eTheta(isinf(eTheta(:, 3)), 3) = 1e200; - end; + end else eTheta = []; eSCR_o = aSCR_s(end); -end; +end % - spontaneous fluctuations if ut(4) > 0 @@ -125,13 +125,13 @@ sig.G0 = ut(SF_ub(k)) - ut(SF_lb(k)); [t, dtdx(k)] = sigm(Theta(Theta_n + 3 * ut(2) + ut(3) + (k - 1) * 2 + 1), sig); sfTheta(k, 1) = ut(SF_lb(k)) + t; % lower bound plus parameter vaue - end; + end sfTheta(:, 2) = sigma; sfTheta(:, 3) = exp(Theta((Theta_n + 3 * ut(2) + ut(3)) + (2:2:(2 * ut(4))))); else sfTheta = []; SF_ub = eSCR_o; -end; +end % - SCL changes if ut(5) > 0 @@ -143,12 +143,12 @@ sig.G0 = ut(SCL_ub(k)) - ut(SCL_lb(k)); [t, dtscldx(k)] = sigm(Theta(Theta_n + 3 * ut(2) + ut(3) + 2 * ut(4) + (k - 1) * 2 + 1), sig); SCLtheta(k, 1) = ut(SCL_lb(k)) + t; % lower bound plus parameter vaue - end; + end SCLtheta(:, 2) = sigma_SCL; SCLtheta(:, 3) = Theta((Theta_n + 3 * ut(2) + ut(3)) + 2 * ut(4) + (2:2:(2 * ut(5)))); else SCLtheta = []; -end; +end % ODE % ------------------------------------------------------------------------ @@ -190,33 +190,33 @@ Jp(3, 7 + (1:3:(3 * ut(2)))) = gu(ut(1), aTheta, 0) .* (ut(1) - aTheta(:, 1)) .* (aTheta(:, 2)).^-2 .* dmdx; Jp(3, 7 + (2:3:(3 * ut(2)))) = gu(ut(1), aTheta, 0) .* (ut(1) - aTheta(:, 1)).^2 .* (aTheta(:, 2)).^-3 .* dsdx; Jp(3, 7 + (3:3:(3 * ut(2)))) = gu(ut(1), aTheta, 0); - end; + end if ~isempty(eTheta) Jp(3, (7 + 3 * ut(2)) + (1:ut(3))) = gu(ut(1), eTheta, 0); -end; +end if ~(isempty(eTheta) && isempty(aTheta)) allTheta = [eTheta; aTheta]; Jp(3, 4) = sum(gu(ut(1), allTheta, 0) .* 1./(allTheta(:, 2).^2) .* (ut(1) - allTheta(:, 1)) .* exp(Theta(4))); -end; +end if ~isempty(sfTheta) Jp(6, (7 + 3 * ut(2) + ut(3)) + (1:2:(2 * ut(4)))) = gu(ut(1), sfTheta, 0) .* (ut(1) - sfTheta(:, 1)) .* sfTheta(:, 2).^-2 .* dtdx; Jp(6, (7 + 3 * ut(2) + ut(3)) + (2:2:(2 * ut(4)))) = gu(ut(1), sfTheta, 0); -end; +end if ~isempty(SCLtheta) Jp(7, (7 + 3 * ut(2) + ut(3)) + 2 * ut(4) + (1:2:(2 * ut(5)))) = gu(ut(1), SCLtheta, 0) .* 1./(sigma_SCL.^2) .* (ut(1) - SCLtheta(:, 1)) .* dtscldx; SCLtheta(:, 3) = 1; % we don't take the exp(amp) here, so dSCLdamp = gu for unit amplitude Jp(7, (7 + 3 * ut(2) + ut(3)) + 2 * ut(4) + (2:2:(2 * ut(5)))) = gu(ut(1), SCLtheta, 0); -end; +end dfdP = dt .* Jp'; -if any(isweird(fx(:))), error('Weird values in f_SCR'); end; -if any(isweird(dfdx(:))), error('Weird values in f_SCR'); end; -if any(isweird(dfdP(:))), error('Weird values in f_SCR'); end; +if any(isweird(fx(:))), error('Weird values in f_SCR'); end +if any(isweird(dfdx(:))), error('Weird values in f_SCR'); end +if any(isweird(dfdP(:))), error('Weird values in f_SCR'); end return; @@ -237,10 +237,10 @@ gu = a .* exp(-(ut - mu).^2 ./ (2 .* sigma.^2)); if f gu = sum(gu); - end; + end else gu = 0; -end; +end return; % ========================================================================= diff --git a/src/f_SF.m b/src/f_SF.m index cbd90acbb..cb4b061ad 100644 --- a/src/f_SF.m +++ b/src/f_SF.m @@ -13,17 +13,17 @@ % ● Format % [fx, dfdx] = f_SF(Xt,Theta,ut,in) % ● Arguments -% Theta: 3 general constants -% 2 value per SF (time, log(amplitude)) -% ut: row 1 - time (after cue onset) -% row 2 - number of SF +% * Theta: 3 general constants +% 2 value per SF (time, log(amplitude)) +% * ut: row 1 - time (after cue onset) +% row 2 - number of SF % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) %% initialise global settings; -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end % settings Theta_n = 3; % number of parameters for the peripheral function (the rest is for the neural function) try @@ -45,10 +45,10 @@ sfTheta(n, 1) = Theta((n - 1) * 2 + Theta_n + 1); sfTheta(n, 2) = sigma; sfTheta(n, 3) = exp(Theta((n - 1) * 2 + Theta_n + 2)); - end; + end else sfTheta = []; -end; +end % ODE 3rd order + gaussian xdot = [Xt(2) Xt(3) @@ -72,8 +72,8 @@ gu = a .* exp(-(ut - mu).^2 ./ (2 .* sigma.^2)); if f gu = sum(gu); - end; + end else gu = 0; -end; +end return; \ No newline at end of file diff --git a/src/g_SCR.m b/src/g_SCR.m index 8e2011969..dbd2c8429 100644 --- a/src/g_SCR.m +++ b/src/g_SCR.m @@ -1,20 +1,24 @@ function [gx,dgdx,dgdPhi] = g_SCR(Xt,Phi,ut,inG) % ● Description -% TBA. +% This is the SCR observation function required by the VBA toolbox. It +% adds the three generative processes (phasic SCR, SF, SCL) modelled in +% f_SCR. +% ● Format +% [gx,dgdx,dgdPhi] = g_SCR(Xt,Phi,ut,inG) % ● Arguments -% Xt: -% Phi: -% ut: -% inG: +% Xt: a 7-element vector +% Phi: input required by VBA, ignored +% ut: input required by VBA, ignored +% inG: input required by VBA, ignored % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) global settings; -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end gx = Xt(1) + Xt(4) + Xt(7); dgdx = zeros(size(Xt,1),1); dgdx([1;4;7]) = 1; dgdPhi = []; -if any(isnan(gx)|isinf(gx)), keyboard; end; -if any(isnan(dgdx)|isinf(dgdx)), keyboard; end; +if any(isnan(gx)|isinf(gx)), keyboard; end +if any(isnan(dgdx)|isinf(dgdx)), keyboard; end diff --git a/src/helper/PsPM_installer.m b/src/helper/PsPM_installer.m index e28e71a7d..e258df1b1 100644 --- a/src/helper/PsPM_installer.m +++ b/src/helper/PsPM_installer.m @@ -1,7 +1,7 @@ % This is a convenience PsPM installer. As an alternative, download the % lastest release from https://github.com/bachlab/PsPM, or clone the % develop branch. -% Uzay Gökay & Dominik Bach, 2024 +% Uzay Gökay & Dominik Bach, 2025 fprintf('Welcome to the PsPM installer.\n'); [indx,tf] = listdlg('ListString',{'Latest PsPM release', 'GLM tutorial dataset', 'DCM tutorial dataset'}, ... @@ -20,9 +20,9 @@ if ismember(1, indx) % GitHub release URL for PsPM and the desired version - githubReleaseURL = 'https://github.com/bachlab/PsPM/releases/download'; - version = 'v6.1.2'; - packageName = 'PsPM_v6.1.2'; + githubReleaseURL = 'https://github.com/bachlab/PsPM/releases/download'; + version = 'v7.0.0'; + packageName = 'PsPM_v7.0.0'; % Create the destination folder if it does not exist if ~exist(destinationFolder, 'dir') diff --git a/src/pspm.m b/src/pspm.m index 07172b02e..dd74e6101 100644 --- a/src/pspm.m +++ b/src/pspm.m @@ -1,7 +1,7 @@ function pspm(varargin) % ● Description % pspm.m handles the main GUI for PsPM -% ● Developer's notes +% ● Developer % PsPM will no longer support GUIDE and only use App Designer for UI. % App Designer is available for MATLAB that is later than version R2016a (9.0). % ● History diff --git a/src/pspm_align_channels.m b/src/pspm_align_channels.m index b7a903414..08e5667bb 100644 --- a/src/pspm_align_channels.m +++ b/src/pspm_align_channels.m @@ -9,7 +9,7 @@ % ● Arguments % * data : [struct] the input data to be processed, in PsPM data format. % * induration : [double] the duration of the input data. -% ● Copyright +% ● History % Introduced in PsPM 3.1 % Written in 2008-2016 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) % Maintained in 2022 by Teddy diff --git a/src/pspm_appdesigner.mlapp b/src/pspm_appdesigner.mlapp index 141a68971..33d1ee786 100644 Binary files a/src/pspm_appdesigner.mlapp and b/src/pspm_appdesigner.mlapp differ diff --git a/src/pspm_appdesigner2019.mlapp b/src/pspm_appdesigner2019.mlapp index 26af34b38..686e883f4 100644 Binary files a/src/pspm_appdesigner2019.mlapp and b/src/pspm_appdesigner2019.mlapp differ diff --git a/src/pspm_bf_FIR.m b/src/pspm_bf_FIR.m index 79d2b1498..9ee13e22b 100644 --- a/src/pspm_bf_FIR.m +++ b/src/pspm_bf_FIR.m @@ -17,7 +17,7 @@ %% Check input arguments if nargin==0 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; -end; +end n = 30; d = 1; td = varargin{1}(1); @@ -25,21 +25,21 @@ n = varargin{1}(2); if numel(varargin{1}) >= 3 d = varargin{1}(3); - end; + end elseif nargin > 1 if nargin >= 2 n = varargin{2}(1); - end; + end if nargin >= 3 d = varargin{3}(1); - end; -end; + end +end if td > d warning('ID:invalid_input', 'Time resolution is larger than duration of the function.'); return; elseif td == 0 warning('ID:invalid_input', 'Time resolution must be larger than 0.'); return; -end; +end % initialise FIR FIR = [zeros(1, n); zeros(round((d*n/td)), n);]; % generate timestamps @@ -50,5 +50,5 @@ stops=(d*reg)/td; FIR(starts:stops, reg)=1; starts=stops+1; -end; +end return diff --git a/src/pspm_bf_hprf_e.m b/src/pspm_bf_hprf_e.m index 39f942b7d..961cb68cd 100644 --- a/src/pspm_bf_hprf_e.m +++ b/src/pspm_bf_hprf_e.m @@ -8,7 +8,7 @@ % ● Arguments % * td : time resolution in second. % * b : number of basis functions. Default as 1:6. -% ● Developer's Notes +% ● Developer % Basis functions will be orthogonalized using spm_orth by default. Onsets % pspm_glm must be shifted by 5 s to account for the pre-event epoch. % Put in values 1:6 for b in order to get following basis functions: @@ -25,10 +25,10 @@ %% input checks global settings; -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end if nargin < 1 errmsg = 'No sampling interval stated'; warning('ID:invalid_input', errmsg); return; -end; +end varargin = cell2mat(varargin); if length(varargin)==1 b=1:6; @@ -48,7 +48,7 @@ warning('ID:invalid_input', 'Time resolution is larger than duration of the function.'); return; elseif td == 0 warning('ID:invalid_input', 'Time resolution must be larger than 0.'); return; -end; +end x = (0:td:50-td); bf=[]; diff --git a/src/pspm_bf_hprf_fc_f.m b/src/pspm_bf_hprf_fc_f.m index f2f4a8be4..c0c0b6a42 100644 --- a/src/pspm_bf_hprf_fc_f.m +++ b/src/pspm_bf_hprf_fc_f.m @@ -12,13 +12,13 @@ %% initialise global settings; -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end if nargin < 1 errmsg = 'No sampling interval stated'; warning('ID:invalid_input',errmsg); return; -end; +end if nargin < 2 soa = 3.5; -end; +end if nargin < 3 % table 2 row 3 in Castegnetti et al. 2016 %p=[43.2180170215633,0.195621916215104,-6.9671,81.0383536117737]; @@ -30,7 +30,7 @@ % before % amplitude does not matter because it will be downscaled to 1 by the % calling function -end; +end x0 = p(3); b = p(2); a = p(1); @@ -49,7 +49,7 @@ elseif soa > 8 warning(['SOA longer than 8s is not recommended. ', ... 'Use at own risk.']); -end; +end shift = soa + x0; x = (start:td:stop-td)'; % try not to use stats toolbox, but stats toolbox has very good diff --git a/src/pspm_bf_hprf_rew.m b/src/pspm_bf_hprf_rew.m index 1e9f8681c..e964e54a1 100644 --- a/src/pspm_bf_hprf_rew.m +++ b/src/pspm_bf_hprf_rew.m @@ -7,7 +7,7 @@ % [bs, x] = pspm_bf_hprf_fc(TD) % ● Arguments % * td : time resolution in second. -% ● References: +% ● References % GLM for reward-conditioned bradycardia: % Xia Y, Liu H, Kälin OK, Gerster S, Bach DR (2024). Measuring % human Pavlovian appetitive conditioning and memory retention. diff --git a/src/pspm_bf_ldrf_gm.m b/src/pspm_bf_ldrf_gm.m index 3158af415..bf9883feb 100644 --- a/src/pspm_bf_ldrf_gm.m +++ b/src/pspm_bf_ldrf_gm.m @@ -14,7 +14,7 @@ % * a : Shape of the function. % * b : Scale of the function. % * A : Quantifier or amplitude of the function. -% ● Reference +% ● References % Korn, C. W., & Bach, D. R. (2016). A solid frame for the window on % cognition: Modeling event-related pupil responses. Journal of Vision, % 16(3), 28. https://doi.org/10.1167/16.3.28 diff --git a/src/pspm_bf_ldrf_gu.m b/src/pspm_bf_ldrf_gu.m index 87479a5ce..f5cb17cf0 100644 --- a/src/pspm_bf_ldrf_gu.m +++ b/src/pspm_bf_ldrf_gu.m @@ -16,7 +16,7 @@ % * p2 : Scale for Gaussian response function, or b, default as 2.04. % * p3 : Parameter for Gaussian response function, or x0, default as 1.48. % * p4 : Quantifier or amplitude for Gaussian response function, or A, default as 0.004. -% ● Reference +% ● References % Korn, C. W., & Bach, D. R. (2016). A solid frame for the window on % cognition: Modeling event-related pupil responses. Journal of Vision, % 16(3), 28. https://doi.org/10.1167/16.3.28 @@ -27,7 +27,7 @@ %% initialise global settings -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% set defaults p = [0.27, 2.04, 1.48, 0.004]; % p = [sigma lambda1 lambda2 a] n = 20; @@ -40,21 +40,21 @@ elseif nargin == 1 n_el = numel(varargin{1}); td = varargin{1}(1); - if n_el > 1, n = varargin{1}(2); end; - if n_el > 2, offset = varargin{1}(3); end; - if n_el > 3, p(1) = varargin{1}(4); end; - if n_el > 4, p(2) = varargin{1}(5); end; - if n_el > 5, p(3) = varargin{1}(6); end; - if n_el > 6, p(4) = varargin{1}(7); end; + if n_el > 1, n = varargin{1}(2); end + if n_el > 2, offset = varargin{1}(3); end + if n_el > 3, p(1) = varargin{1}(4); end + if n_el > 4, p(2) = varargin{1}(5); end + if n_el > 5, p(3) = varargin{1}(6); end + if n_el > 6, p(4) = varargin{1}(7); end elseif nargin > 1 td = varargin{1}; n = varargin{2}; - if nargin > 2, offset = varargin{3}; end; - if nargin > 3, p(1) = varargin{4}; end; - if nargin > 4, p(2) = varargin{5}; end; - if nargin > 5, p(3) = varargin{6}; end; - if nargin > 5, p(4) = varargin{7}; end; -end; + if nargin > 2, offset = varargin{3}; end + if nargin > 3, p(1) = varargin{4}; end + if nargin > 4, p(2) = varargin{5}; end + if nargin > 5, p(3) = varargin{6}; end + if nargin > 5, p(4) = varargin{7}; end +end if td > n warning('ID:invalid_input', 'Time resolution is larger than or equal to the duration of the function.'); return; elseif td == 0 @@ -63,7 +63,7 @@ warning('ID:invalid_input', 'Offset has to be a positive number.'); return; elseif n <= 0 warning('ID:invalid_input', 'Duration has to be a number larger then 0.'); return; -end; +end %% check if offset is in a valid range or correct it if it is to small if offset ~= 0 r = td/offset; @@ -73,9 +73,9 @@ offset = 0; elseif r <= 2 offset = td; - end; - end; -end; + end + end +end %% create x axis bf_dur = n; n_bf = round((bf_dur)/td); diff --git a/src/pspm_bf_psrf_erl.m b/src/pspm_bf_psrf_erl.m index c9c5adadc..11298603a 100755 --- a/src/pspm_bf_psrf_erl.m +++ b/src/pspm_bf_psrf_erl.m @@ -8,7 +8,7 @@ % * td : Time resolution. % * n : Number of layers / boxes. % * tmax : t of the maximum amplitude in seconds. -% ● Reference +% ● References % Hoeks, B., & Levelt, W.J.M. (1993). % Pupillary Dilation as a Measure of Attention - a Quantitative System-Analysis. % Behavior Research Methods Instruments & Computers, 25, 16-26. diff --git a/src/pspm_bf_psrf_fc.m b/src/pspm_bf_psrf_fc.m index c26eec64d..cb104f7e2 100644 --- a/src/pspm_bf_psrf_fc.m +++ b/src/pspm_bf_psrf_fc.m @@ -10,7 +10,7 @@ % * cs_d : Derivative of CS-evoked response in the basis set. Acceptable values are 0 and 1. Default as 0. % * us : US-evoked response in the basis set. Acceptable values are 0 and 1. Default as 0. % * us_shift : CS-US SOA in seconds. Ignored if us == 0. Default as 3.5. -% ● Reference +% ● References % Christoph W. Korn, Matthias Staib, Athina Tzovara, Giuseppe Castegnetti, % and Dominik R. Bach (2017) A pupil size response model to assess fear learning. % Psychophysiology, 54, 330-343, DOI: 10.1111/psyp.12801 diff --git a/src/pspm_bf_rarf_e.m b/src/pspm_bf_rarf_e.m index fddaa63b5..87c38cae2 100644 --- a/src/pspm_bf_rarf_e.m +++ b/src/pspm_bf_rarf_e.m @@ -8,7 +8,7 @@ % * td: The time the response function should have. % * bf_type: Can be either 0 or 1. If 0, returns the response function only. % If 1, (default) returns the response function and the time derivative. -% ● Reference +% ● References % Dominik R. Bach, Samuel Gerster, Athina Tzovara, Giuseppe Castegnetti, % A linear model for event-related respiration responses, % Journal of Neuroscience Methods, Volume 270, 1 September 2016, Pages 147-155, @@ -19,11 +19,11 @@ %% initialise global settings -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% check input arguments if nargin==0 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; -end; +end %% load arguments/parameters td = varargin{1}(1); if numel(varargin{1}) == 1 && nargin == 1 @@ -32,11 +32,11 @@ bf_type = varargin{1}(2); else bf_type = varargin{2}(1); -end; +end %% fix value of bf_type if (bf_type<0)||(bf_type>1) bf_type = 1; -end; +end %% other variables mu = 8.07; sigma = 3.74; @@ -48,12 +48,12 @@ elseif td == 0 warning('ID:invalid_input', 'Time resolution must be larger than 0.'); return; -end; +end x = (start:td:stop-td)'; bs = exp(-(x-mu).^2./(2*sigma^2)); if bf_type == 1 bs = [bs [diff(bs); 0]]; -end; +end %% orthogonalise bs = spm_orth(bs); % normalise diff --git a/src/pspm_bf_rfrrf_e.m b/src/pspm_bf_rfrrf_e.m index f3ad23c32..f01838cac 100644 --- a/src/pspm_bf_rfrrf_e.m +++ b/src/pspm_bf_rfrrf_e.m @@ -9,7 +9,7 @@ % * bf_type: Type of the basis function, can be either 0 or 1. Default as 1. % If 0, returns the response function only. % If 1, returns the response function and the time derivative. -% ● Reference +% ● References % Dominik R. Bach, Samuel Gerster, Athina Tzovara, Giuseppe Castegnetti, % A linear model for event-related respiration responses, % Journal of Neuroscience Methods, Volume 270, 1 September 2016, Pages 147-155, diff --git a/src/pspm_bf_rprf_e.m b/src/pspm_bf_rprf_e.m index d68dadeaf..745532e18 100644 --- a/src/pspm_bf_rprf_e.m +++ b/src/pspm_bf_rprf_e.m @@ -9,7 +9,7 @@ % * bf_type: Type of the basis function, can be either 0 or 1. Default as 0. % If 0, returns the response function only. % If 1, returns the response function and the time derivative. -% ● Reference +% ● References % Dominik R. Bach, Samuel Gerster, Athina Tzovara, Giuseppe Castegnetti, % A linear model for event-related respiration responses, % Journal of Neuroscience Methods, Volume 270, 1 September 2016, Pages 147-155, @@ -21,11 +21,11 @@ %% initialise global settings -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% check input arguments if nargin==0 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; -end; +end %% load arguments/parameters td = varargin{1}(1); if numel(varargin{1}) == 1 && nargin == 1 @@ -34,11 +34,11 @@ bf_type = varargin{1}(2); else bf_type = varargin{2}(1); -end; +end %% fix value of bf_type if (bf_type<0)||(bf_type>1) bf_type = 0; -end; +end %% other variables mu = 4.2; sigma = 1.65; diff --git a/src/pspm_bf_scrf.m b/src/pspm_bf_scrf.m index bd12de1bc..806f4f08e 100644 --- a/src/pspm_bf_scrf.m +++ b/src/pspm_bf_scrf.m @@ -8,7 +8,7 @@ % ● Arguments % * td : Time resolution in second. % * d : Number of derivatives. Default as 0. -% ● Reference +% ● References % Bach DR, Flandin G, Friston KJ, Dolan RJ (2010). Modelling event-related % skin conductance responses. International Journal of Psychophysiology, % 75, 349-356. @@ -19,11 +19,11 @@ %% initialise global settings -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% check input arguments if nargin==0 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; -end; +end td = varargin{1}(1); if numel(varargin{1}) == 1 && nargin == 1 d = 0; @@ -31,24 +31,24 @@ d = varargin{1}(2); else d = varargin{2}(1); -end; +end if td > 90 warning('ID:invalid_input', 'Time resolution is larger than duration of the function.'); return; elseif td == 0 warning('ID:invalid_input', 'Time resolution must be larger than 0.'); return; -end; -if (d<0)||(d>2), d=0; end; +end +if (d<0)||(d>2), d=0; end %% get parameters and basis function [bs(:, 1), p, x] = pspm_bf_scrf_f(td); if d>0 bs(:, 2) = [0; diff(bs(:,1))]; bs(:, 2) = bs(:,2)/sum(abs(bs(:,2))); -end; +end if d>1 p(2) = 1.8 * p(2); bs(:, 3) = bs(:, 1) - pspm_bf_scrf_f(td, p); bs(:, 3) = bs(:, 3)/sum(abs(bs(:, 3))); -end; +end % orthogonalize bs=spm_orth(bs); % normalise diff --git a/src/pspm_bf_scrf_f.m b/src/pspm_bf_scrf_f.m index 797b85abe..303bf5160 100644 --- a/src/pspm_bf_scrf_f.m +++ b/src/pspm_bf_scrf_f.m @@ -8,7 +8,7 @@ % * td : Time resolution in s. % * p : An array with variables as (1) Time to peak; (2) Variance of rise defining % gaussian; and (3--4) Decay constants. -% ● Reference +% ● References % Bach DR, Flandin G, Friston KJ, Dolan RJ (2010). Modelling event-related skin % conductance responses. International Journal of Psychophysiology, 75, 349-356. % ● History @@ -17,7 +17,7 @@ %% initialise global settings; -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% processing if nargin < 1 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; diff --git a/src/pspm_bf_sebrf.m b/src/pspm_bf_sebrf.m index 58d939f79..671a6551e 100644 --- a/src/pspm_bf_sebrf.m +++ b/src/pspm_bf_sebrf.m @@ -9,7 +9,7 @@ % * td : Time resolution in s. % * d : Whether first derivative should be included (1) or not (0). Default as 0. % * g : Whether gaussian to model the tail should be included (1) or not (0). Default as 0. -% ● Reference +% ● References % Khemka S, Tzovara A, Gerster S, Quednow B and Bach DR (2016) % Modeling Startle Eyeblink Electromyogram to Assess Fear Learning. % Psychophysiology. 2017 Feb; 54(2): 204–214. diff --git a/src/pspm_bf_spsrf_box.m b/src/pspm_bf_spsrf_box.m index b1964061a..4f109d80e 100644 --- a/src/pspm_bf_spsrf_box.m +++ b/src/pspm_bf_spsrf_box.m @@ -26,7 +26,7 @@ elseif nargin == 1 n_el = numel(varargin{1}); td = varargin{1}(1); - if n_el > 1, soa = varargin{1}(2); else , soa=3.5; end; + if n_el > 1, soa = varargin{1}(2); else , soa=3.5; end elseif nargin > 1 td = varargin{1}; soa = varargin{2}; @@ -51,7 +51,7 @@ elseif soa > 8 warning(['SOA longer than 8s is not recommended. ', ... 'Use at own risk.']); -end; +end x = (0:td:stop-td)'; bs = zeros(stop_idx,1); bs(start_idx:stop_idx) = 1; diff --git a/src/pspm_bf_spsrf_gamma.m b/src/pspm_bf_spsrf_gamma.m index 692d2cb0b..6606118f5 100644 --- a/src/pspm_bf_spsrf_gamma.m +++ b/src/pspm_bf_spsrf_gamma.m @@ -9,7 +9,7 @@ % ● Arguments % * td : time resolution in second. % * p : An array of A, x0, a, and b (in order). -% ● Reference +% ● References % Xia Y, Melinscak F, Bach DR (2020) % Saccadic Scanpath Length: An Index for Human Threat Conditioning % Behavioral Research Methods 53, pages 1426–1439 (2021) @@ -19,24 +19,24 @@ %% initialize global settings -if isempty(settings), pspm_init; end; +if isempty(settings), pspm_init; end %% check input arguments if nargin==0 errmsg='No sampling interval stated'; warning('ID:invalid_input', errmsg); return; elseif nargin == 1 n_el = numel(varargin{1}); td = varargin{1}(1); - if n_el > 1, soa = varargin{1}(2); else , soa=3.5; end; - if n_el > 2, p = varargin{1}(3:end); else , p = NaN; end; + if n_el > 1, soa = varargin{1}(2); else , soa=3.5; end + if n_el > 2, p = varargin{1}(3:end); else , p = NaN; end elseif nargin > 1 td = varargin{1}; soa = varargin{2}; - if nargin > 2, p = varargin{3}; else , p=NaN; end; -end; + if nargin > 2, p = varargin{3}; else , p=NaN; end +end %% Check td if td > 10 warning('ID:invalid_input', 'Time resolution is larger than duration of the function.'); return; -end; +end %% Check soa if ~isnumeric(soa) warning('The SOA should be a numeric value.'); return; @@ -50,7 +50,7 @@ if ~isnan(p) p = varargin{3}; errmsg = 'Basis function parameter must be a numeric vector with 4 elements.'; - if ~isnumeric(p) || numel(p)~=4, warning('ID:invalid_input', errmsg); return; end; + if ~isnumeric(p) || numel(p)~=4, warning('ID:invalid_input', errmsg); return; end else % parameters obtained by fitting a gamma function to smoothed test data p = [-0.00953999201164847,-1.90202591900308,10.0912982464000,0.421253777432825]; diff --git a/src/pspm_butter.m b/src/pspm_butter.m index d9d498ebf..591e192bf 100644 --- a/src/pspm_butter.m +++ b/src/pspm_butter.m @@ -8,7 +8,7 @@ % ● Arguments % * order: the order of the Butterworth filter to be designed % * freqratio: the cut-off frequency of the Butterworth filter to be designed -% ● Output +% ● Outputs % * sts: -1 if non-standard filters are requested % ● History % Introduced in PsPM 3.0 @@ -30,11 +30,11 @@ pass = 'low'; elseif ~(any(strcmpi(pass, {'high', 'low'}))) warning('ID:invalid_input','%s is not a valid argument.', pass); return; -end; +end if ~settings.signal && order ~= 1 warning('ID:toolbox_missing','This function can only create 1st order filters - %s', errmsg); return; -end; +end %% filters if settings.signal [b, a] = butter(order, freqratio, pass); @@ -45,7 +45,7 @@ f = F.filt{1}; case 'high' f = F.filt{2}; - end; + end d = abs([f.freqratio] - freqratio); n = find(d < .0001); if isempty(n) @@ -53,10 +53,10 @@ else if numel(n) > 1 [foo, n] = min(d); - end; + end a = f(n).a; b = f(n).b; - end; + end end sts = 1; return @@ -68,11 +68,11 @@ % for n = 1:numel(freqratio) % [filt{1}(n).b filt{1}(n).a] = butter(1, freqratio(n)); % filt{1}(n).freqratio = freqratio(n); -% end; +% end % % highpass (standard filter DCM, standard filter GLM) % freqratio = [0.0159./([4.5 5:5:500]), 0.05./([4.5 5:5:500])]; % for n = 1:numel(freqratio) % [filt{2}(n).b filt{2}(n).a] = butter(1, freqratio(n), 'high'); % filt{2}(n).freqratio = freqratio(n); -% end; +% end % save([settings.path, 'pspm_butter.mat'], 'filt'); diff --git a/src/pspm_cfg/pspm_cfg_pupil_preprocess.m b/src/pspm_cfg/pspm_cfg_pupil_preprocess.m index 452242f5b..2d7afcc2d 100644 --- a/src/pspm_cfg/pspm_cfg_pupil_preprocess.m +++ b/src/pspm_cfg/pspm_cfg_pupil_preprocess.m @@ -133,9 +133,9 @@ % Residual filter for lowpass cut-off ResdFiltLPCF = cfg_entry; ResdFiltLPCF.name = 'Butterworth cutoff frequency (Hz)'; -ResdFiltLPCF.tag = 'residualsFilter_interpFs'; +ResdFiltLPCF.tag = 'residualsFilter_lowpassCF'; ResdFiltLPCF.num = [1 1]; -ResdFiltLPCF.val = {100}; +ResdFiltLPCF.val = {16};% ResdFiltLPCF.help = pspm_cfg_help_format('pspm_pupil_pp_options', 'raw.residualsFilter_lowpassCF'); % Keep filter data diff --git a/src/pspm_cfg/pspm_cfg_resp_pp.m b/src/pspm_cfg/pspm_cfg_resp_pp.m index d87d47157..0c18dd325 100644 --- a/src/pspm_cfg/pspm_cfg_resp_pp.m +++ b/src/pspm_cfg/pspm_cfg_resp_pp.m @@ -1,13 +1,13 @@ function resp_pp = pspm_cfg_resp_pp % Coversion of continuous respiration data various respiration data types + %% Standard items datafile = pspm_cfg_selector_datafile; channel = pspm_cfg_selector_channel('respiration'); channel_action = pspm_cfg_selector_channel_action; %% Specific items - sr = cfg_entry; sr.name = 'Sample Rate'; sr.tag = 'sr'; diff --git a/src/pspm_cfg/pspm_cfg_selector_channel.m b/src/pspm_cfg/pspm_cfg_selector_channel.m index bf6ba8ac6..e32a0fe80 100644 --- a/src/pspm_cfg/pspm_cfg_selector_channel.m +++ b/src/pspm_cfg/pspm_cfg_selector_channel.m @@ -182,7 +182,7 @@ function out = pupil_chan(menu_set, menu_default) labels = {'Combined pupil channel', 'Both pupil channels', 'Left pupil', 'Right pupil', 'Default', 'None'}; - values = {'pupil_c', 'both', 'pupil_l', 'pupil_r', 'pupil', ''}; + values = {'pupil_c', 'both', 'pupil_l', 'pupil_r', 'pupil', 'none'}; out = cfg_menu; out.name = 'Channel specification'; diff --git a/src/pspm_check_data.m b/src/pspm_check_data.m index 0b849180d..a8d1461fc 100644 --- a/src/pspm_check_data.m +++ b/src/pspm_check_data.m @@ -6,8 +6,11 @@ % conversions. % ● Format % [sts, data] = pspm_check_data(data, infos) -% ● Developer's notes +% ● Developer % This code is taken from pspm_load_data; it could be improved using cellfun. +% ● History +% Introducted in Version 7.0 +% Written by Dominik R Bach (Bonn) global settings if isempty(settings) diff --git a/src/pspm_check_model.m b/src/pspm_check_model.m index 98e7f0263..bab423f4e 100644 --- a/src/pspm_check_model.m +++ b/src/pspm_check_model.m @@ -1,18 +1,17 @@ -function model = pspm_check_model(model, modeltype) -% ● Definition +function [model, options] = pspm_check_model(model, options, modeltype) +% ● Description % pspm_check_model automatically determine the fields of the struct model -% for the corresponding function. +% for the corresponding function. It also checks the options structure +% and uses it to determine whether overwriting of the model file is +% allowed % ● Format % model = pspm_check_model(model, modeltype) % ● Arguments % ┌─────model % ├─.datafile : Values (any of the following). % │ A file name (single session); -% │ A cell array of file names (multiple sessions). -% ├.modelfile : A file name for the model output, can be any of the following. -% │ [for GLM, DCM, TAM] A file name. -% │ [for SF] A file name (single data file) or a cell array of file names -% │ (multiple data files). +% │ A cell array of file names (multiple sessions, not allowed for SF). +% ├.modelfile : A file name for the model output. % ├.timeunits : A string. % │ [for GLM, TAM] can be either 'seconds', 'samples', 'markers', or % │ 'markervalues'. @@ -56,7 +55,7 @@ % │ or cell array of any of these, for multiple files. % ├──.missing : [optional] allows to specify missing (e. g. artefact) epochs in the % │ data file. See pspm_get_timing for epoch definition; specify a cell -% │ array for multiple input files. This must always be specified in SECONDS. +% │ array for multiple input files (not allowed for SF). This must always be specified in SECONDS. % │ Default: no missing values % ├──.channel : [optional] channel number (or, for GLM, channel type). If a channel type % │ is specified the LAST channel matching the given type will be used. @@ -118,27 +117,29 @@ % └────method : [optional, SF (modeltype) only] [string/cell_array] % [string] either 'auc', 'scl', 'dcm' (default), or 'mp'. % [cell_array] a cell array of methods mentioned above. +% options: see calling functions and pspm_options % ● History % Introduced in PsPM 6.1.1 % Written in 2023 by Dominik Bach (UCL and Bonn) -%% 0. Initialise +%% 0. Initialise & check options global settings if isempty(settings) pspm_init; end %% 1. General checks ------------------------------------------------------ -if ~isstruct(model) - warning('ID:invalid_input', 'Model must be a struct.'); +if ~isstruct(model) || isempty(model) + warning('ID:invalid_input', 'Model must be a non-empty struct.'); model = struct('invalid', 1); return else - model.invalid = 1; - if isempty(model) - warning('ID:invalid_input', 'Model is empty.'); + model.invalid = 1; +end + +options = pspm_options(options, modeltype); +if options.invalid return - end end %% 2. Reject missing mandatory fields common to all models ----------------- @@ -154,10 +155,8 @@ % 3. Reject wrong type of mandatory fields -------------------------------- if ~iscell(model.datafile) && ~ischar(model.datafile) warning('ID:invalid_input', 'Input data must be a cell or string.'); return; -elseif ~ischar(model.modelfile) && ~strcmpi (modeltype, 'sf') +elseif ~ischar(model.modelfile) warning('ID:invalid_input', 'Output model must be a string.'); return; -elseif ischar(model.modelfile) && strcmpi (modeltype, 'sf') - model.modelfile = {model.modelfile}; end % NOTE we need to separate the case of DCM timing being @@ -168,17 +167,13 @@ %% 3. Fill missing fields common to all models, and accept only allowed values if ~isfield(model, 'timing') model.timing = cell(nFile, 1); -else - if ~isempty(model.timing) - if ~iscell(model.timing) || ... - (strcmpi(modeltype, 'dcm') && ~iscell(model.timing{1}) && ~ischar(model.timing{1})) - % for DCM, model.timing is either a file name or a cell array of - % events, or a cell array of file names or cell arrays, so we need to - % take care of cases where model.timing is a cell array but not a cell - % array of cell arrays or a cell array of char - model.timing = {model.timing}; - end - end +elseif ~iscell(model.timing) || ... + (strcmpi(modeltype, 'dcm') && ~isempty(model.timing) && ~iscell(model.timing{1}) && ~ischar(model.timing{1})) + % for DCM, model.timing is either a file name or a cell array of + % events, or a cell array of file names or cell arrays, so we need to + % take care of cases where model.timing is a cell array but not a cell + % array of cell arrays or a cell array of char + model.timing = {model.timing}; end if ~isfield(model, 'missing') model.missing = cell(nFile, 1); @@ -195,8 +190,20 @@ warning('ID:invalid_input', 'Normalisation must be specified as 0 or 1.'); return; end +% make sure file extension is '.mat' +[pth, fn, ext] = fileparts(model.modelfile); +model.modelfile = fullfile(pth, [fn, '.mat']); + +% check that overwriting output is allowed +options.overwrite = pspm_overwrite(model.modelfile, options); +if ~options.overwrite + warning('ID:invalid_input', 'Model file exists, and overwriting not allowed by user.'); + return +end + %% 4. Check that session-related field entries have compatible size -if (nFile ~= numel(model.timing)) && ~(numel(model.timing) == 0 && isfield(model, 'nuisance')) +if (nFile ~= numel(model.timing)) && ... + ~(numel(model.timing) == 0 && (isfield(model, 'nuisance') || (isfield(model, 'timeunits') && strcmpi(model.timeunits, 'whole')))) warning('ID:number_of_elements_dont_match',... 'Session numbers of data files and event definitions do not match.'); return @@ -335,12 +342,11 @@ warning('ID:invalid_input', 'No timeunits specified.'); return; elseif ~ischar(model.timeunits) || ~ismember(model.timeunits, {'seconds', 'markers', 'samples','whole'}) warning('ID:invalid_input', 'Timeunits (%s) not recognised; only ''seconds'', ''markers'', ''samples'' and ''whole'' are supported', model.timeunits); return; + elseif nFile > 1 + warning('ID:invalid_input', 'Only one data file allowed for SF.'); return; elseif ~strcmpi(model.timeunits, 'whole') && sum(cellfun(@(f) isempty(f), model.timing)) > 0 warning('ID:number_of_elements_dont_match',... 'Number of data files and epoch definitions does not match.'); return; - elseif numel(model.modelfile) ~= nFile - warning('ID:number_of_elements_dont_match',... - 'Number of data files and model files does not match.'); return; end % Check optional fields, set default values and reject invalid values diff --git a/src/pspm_combine_markerchannels.m b/src/pspm_combine_markerchannels.m index 465904b1b..122671af0 100644 --- a/src/pspm_combine_markerchannels.m +++ b/src/pspm_combine_markerchannels.m @@ -21,6 +21,10 @@ % └.marker_chan_num: Choose any number of marker channel numbers to % combine. If 0 all marker channels are % used [default: use all channels]. +% ● Outputs +% * sts : Status flag (-1 or 1). +% * outchannel : Index of the newly created marker channel. +% Empty if unsuccessful. % ● History % Introduced In PsPM 6.1.2 % Written in 2023 by Dominik R Bach (Uni Bonn) diff --git a/src/pspm_convert_area2diameter.m b/src/pspm_convert_area2diameter.m index a2adb44f9..dea0960cc 100644 --- a/src/pspm_convert_area2diameter.m +++ b/src/pspm_convert_area2diameter.m @@ -30,7 +30,7 @@ % └.channel_action : ['add'/'replace', default as 'add'] % Defines whether the new channel should be added or the previous % outputs of this function should be replaced. -% ● Output +% ● Outputs % * channel_index : index of channel containing the processed data % ● History % Introduced in PsPM 3.1 diff --git a/src/pspm_convert_au2unit.m b/src/pspm_convert_au2unit.m index da7a6f954..55b6667ad 100644 --- a/src/pspm_convert_au2unit.m +++ b/src/pspm_convert_au2unit.m @@ -53,7 +53,7 @@ % └.channel_action : ['add'/'replace', default as 'add'] % Defines whether the new channel should be added or the previous % outputs of this function should be replaced. -% ● Output +% ● Outputs % * channel_index : Index of channel containing the processed data. % ● History % Introduced in PsPM 3.1 diff --git a/src/pspm_convert_ecg2hb.m b/src/pspm_convert_ecg2hb.m index aeb9b33c0..4946a615d 100644 --- a/src/pspm_convert_ecg2hb.m +++ b/src/pspm_convert_ecg2hb.m @@ -32,10 +32,10 @@ % Defines whether the new channel should be added or % the previous outputs of this function should be replaced. % -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % * quality_info: generated if options.debugmode == 1 -% ● Reference +% ● References % [1] Adjusted algorithm: % Paulus PC, Castegnetti G, & Bach DR (2016). Modeling event-related % heart period responses. Psychophysiology, 53, 837-846. @@ -47,7 +47,7 @@ % Written in 2013-2015 Philipp C Paulus & Dominik R Bach % (Technische Universitaet Dresden, University of Zurich) % Updated in 2022 Teddy -% ● Developer's Notes +% ● Developer % ▶︎ Changes from the original Pan & Tompkins algorithm % filter: P. & T. intend to achieve a pass band from 5-15 Hz with a % real-time filter. This function uses an offline second diff --git a/src/pspm_convert_gaze.m b/src/pspm_convert_gaze.m index 16d9ca19e..9f668aaf8 100644 --- a/src/pspm_convert_gaze.m +++ b/src/pspm_convert_gaze.m @@ -30,7 +30,7 @@ % │ Default is 'gaze'. % └.channel_action: Channel action for sps data, add / replace existing sps % data (default: add) -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % ● History % Introduced in PsPM 4.3.1 diff --git a/src/pspm_convert_hb2hp.m b/src/pspm_convert_hb2hp.m index 5d370794e..51eab0b28 100644 --- a/src/pspm_convert_hb2hp.m +++ b/src/pspm_convert_hb2hp.m @@ -34,9 +34,9 @@ % └─────────.lower: [numeric] % Specifies the lower limit of the % heart periods in seconds. Default is 0.2. -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data -% ● Reference +% ● References % [1] Paulus PC, Castegnetti G, & Bach DR (2016). Modeling event-related % heart period responses. Psychophysiology, 53, 837-846. % ● History diff --git a/src/pspm_convert_pixel2unit_core.m b/src/pspm_convert_pixel2unit_core.m index 8c6d196e2..89b3dd11d 100644 --- a/src/pspm_convert_pixel2unit_core.m +++ b/src/pspm_convert_pixel2unit_core.m @@ -2,10 +2,10 @@ % ● Description % pspm_convert_pixel2unit_core converts gaze data from pixel to units. % ● Format -% [sts, out_data, out_range] = pspm_convert_pixel2unit_core(data, screen_length) +% [out_data, out_range] = pspm_convert_pixel2unit_core(data, data_range, screen_length) % ● Arguments % * data: Original data in pixels. No checks are performed. -% * range: Original range in pixels. +% * data_range: Original range in pixels. % * screen_length: Screen width for gaze_x data, or screen height for gaze_y data, in mm % ● History % Introduced in PsPM 4.0 diff --git a/src/pspm_convert_ppg2hb.m b/src/pspm_convert_ppg2hb.m index c9c215096..cd2cc87c6 100644 --- a/src/pspm_convert_ppg2hb.m +++ b/src/pspm_convert_ppg2hb.m @@ -42,7 +42,7 @@ % └───.python_path: [char] for method 'heartpy' % The path where python can be found. Mandatory if % python environment is not yet set up -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % ● References % [1] van Gent, P, Farah, H, van Nes, N, & van Arem, B. (2019) Heartpy: diff --git a/src/pspm_convert_visual_angle_core.m b/src/pspm_convert_visual_angle_core.m index 3f875a226..f77494de0 100644 --- a/src/pspm_convert_visual_angle_core.m +++ b/src/pspm_convert_visual_angle_core.m @@ -12,7 +12,7 @@ % * width: screen width in same units as data % * height: screen height in same units as data % * distance: screen distance in same units as data -% ● Output +% ● Outputs % * lat: the latitude in degrees (x-direction) % * lon: the longitude in degrees (y-direction) % * lat_range: the latitude range diff --git a/src/pspm_dcm.m b/src/pspm_dcm.m index 699024efb..cdb4b140d 100644 --- a/src/pspm_dcm.m +++ b/src/pspm_dcm.m @@ -130,13 +130,13 @@ % └.eventnames: Cell array of names for individual events, % in the order they are specified in the model.timing array - % to be used for display and export only -% ● Output +% ● Outputs % * fn : Name of the model file. % * dcm : Model struct. Output units: all timeunits are in seconds; % eSCR and aSCR amplitude are in SN units such that an % eSCR SN pulse with 1 unit amplitude causes an eSCR with % 1 mcS amplitude. -% ● Developer's Notes +% ● Developer % 1. pspm_dcm can handle NaN values in data channels. Either by specifying % missing epochs manually using model.missing, or by detecting NaN epochs % in the data. Missing epochs shorter than model.substhresh will be ignored @@ -203,18 +203,12 @@ if nargin < 1; errmsg = 'Nothing to do.'; warning('ID:invalid_input', errmsg); return elseif nargin < 2; options = struct(); end -% 2.2 check model -model = pspm_check_model(model, 'dcm'); -if model.invalid +% 2.2 check model and options +[model, options] = pspm_check_model(model, options, 'dcm'); +if model.invalid || options.invalid return end -% 2.3 check options -options = pspm_options(options, 'dcm'); -if options.invalid - return -end - % all the below should be re-factored into pspm_options ------------------- % numeric fields num_fields = {'depth', 'sfpre', 'sfpost', 'sffreq', 'sclpre', ... diff --git a/src/pspm_dcm_inv.m b/src/pspm_dcm_inv.m index 22e293478..924b2f0c4 100644 --- a/src/pspm_dcm_inv.m +++ b/src/pspm_dcm_inv.m @@ -64,7 +64,7 @@ % and aSCR amplitude are in SN units such that an % eSCR SN pulse with 1 unit amplitude causes an eSCR % with 1 mcS amplitude (unless model.norm = 1). -% ● Developer Notes +% ● Developer % There are two event types: flexible and fixed. The terminology is to call % flexible responses aSCR (anticipatory) and fixed responses eSCR (evoked % SCR). diff --git a/src/pspm_denoise_spike.m b/src/pspm_denoise_spike.m index 6e082d013..37a227101 100644 --- a/src/pspm_denoise_spike.m +++ b/src/pspm_denoise_spike.m @@ -8,7 +8,7 @@ % * header : header of data % * kbdata : keyboard channel data % * cutoff : the cut off value for denoising -% ● Arguments +% ● Outputs % * data: denoised data % ● History % Introduced in PsPM 3.0 @@ -28,7 +28,7 @@ % start with low to high if header.initLow==0 pulse(1)=[]; -end; +end % filter out high spikes dt=diff(pulse); @@ -45,7 +45,7 @@ pulse(delpulse)=[]; clear dt dthi dtlo noisepulse delpulse -if isempty(pulse), pulse=0; end; +if isempty(pulse), pulse=0; end % check for buffer overflow if keyboard channel is given % (if one event flank isn't written to file, @@ -60,7 +60,7 @@ bufferoverflowtime=kbdata.timings(n); [dummy, nexttrigger]=min(abs(pulse-bufferoverflowtime)); % check for polarity after buffer overflow - if mod(nexttrigger,2)==1, ttl=1; else ttl=0; end; + if mod(nexttrigger,2)==1, ttl=1; else ttl=0; end if nexttrigger==numel(pulse) % if this is the last event, then just bin % it @@ -75,13 +75,13 @@ % nexttrigger if ttl==1&&nextinterval>110 % max marker duration in ms pulse(nexttrigger)=[]; - end; - end; + end + end errmsg=sprintf('During sampling, a buffer overflow occured at %.2f s. Please check your data for consistency.', bufferoverflowtime/1000); warning(errmsg); - end; - end; -end; + end + end +end % store only lo to hi transitions data = pulse(1:2:end); diff --git a/src/pspm_doc.m b/src/pspm_doc.m index 1cefa9aea..10ac0bf5d 100644 --- a/src/pspm_doc.m +++ b/src/pspm_doc.m @@ -23,7 +23,12 @@ M = []; % 3.1 Add title Title = pspm_doc_get_title(func_name); -M = [M, '# ', Title, newline]; +M = [M, '---', newline]; +M = [M, 'layout: post', newline]; +M = [M, 'title: ', func_name, newline]; +M = [M, 'permalink: /ref/', func_name, newline]; +M = [M, '---', newline]; +M = [M, ' ', newline]; M = [M, '[Back to index](/PsPM/ref/)', newline]; % 3.2 Add description if isfield(S, 'Description') @@ -52,10 +57,15 @@ end M = [M, '[Back to index](/PsPM/ref/)', newline]; %% 4 Write to file +if isfield(options, 'post') && options.post == 1 + PrefTitle = ['2024-01-01-',Title]; +else + PrefTitle = Title; +end if isfield(options, 'path') - writelines(M, [options.path, '/', Title,'.md']); + writelines(M, [options.path, '/', PrefTitle,'.md']); else - writelines(M, [Title,'.md']); + writelines(M, [PrefTitle,'.md']); end sts = 1; end @@ -125,6 +135,7 @@ Y = [Y, newline]; end end + Y = [Y, newline]; end end end diff --git a/src/pspm_doc_gen.m b/src/pspm_doc_gen.m index 1c34b7604..90067f668 100644 --- a/src/pspm_doc_gen.m +++ b/src/pspm_doc_gen.m @@ -49,6 +49,7 @@ 'pspm_convert_hb2hp', ... 'pspm_convert_ppg2hb', ... 'pspm_emg_pp', ... + 'pspm_expand_epochs', ... 'pspm_find_sounds', ... 'pspm_find_valid_fixations', ... 'pspm_gaze_pp', ... @@ -72,6 +73,7 @@ for i_func = 1:length(list_func) options = struct(); options.path = savepath; + options.post = 1; disp(list_func{i_func}); sts_temp = pspm_doc(list_func{i_func}, options); if sts_temp == -1 diff --git a/src/pspm_downsample.m b/src/pspm_downsample.m index 553427d8d..bfd22ace0 100644 --- a/src/pspm_downsample.m +++ b/src/pspm_downsample.m @@ -11,7 +11,7 @@ % * sr: original sampling rate of the input data. % * sr_down: targeted downsampling rate. % -% ● Output +% ● Outputs % * sts: -1 if the frequency ratio is not an integer % ● History % Introduced in PsPM 3.0 diff --git a/src/pspm_emg_pp.m b/src/pspm_emg_pp.m index a0f2724ad..ff97d7a85 100644 --- a/src/pspm_emg_pp.m +++ b/src/pspm_emg_pp.m @@ -25,8 +25,8 @@ % └.channel_action: ['add'/'replace'] Defines whether the new channel should % be added or the previous outputs of this function should % be replaced. (Default: 'replace') -% ● Output -% channel_index: index of channel containing the processed data +% ● Outputs +% * channel_index: index of channel containing the processed data % ● References % [1] Khemka S, Tzovara A, Gerster S, Quednow BB, Bach DR (2017). % Modelling startle eye blink electromyogram to assess fear learning. diff --git a/src/pspm_epochs2logical.m b/src/pspm_epochs2logical.m index dab39feb4..fd4713f41 100644 --- a/src/pspm_epochs2logical.m +++ b/src/pspm_epochs2logical.m @@ -12,7 +12,7 @@ % * datalength : length of the resulting logical index % * sr : if epochs are specified in seconds: sample rate % if epochs are specified in terms of data samples: 1 -% ● Output +% ● Outputs % * index : [logical] index % ● History % Introduced in PsPM 6.1.2 diff --git a/src/pspm_expand_epochs.m b/src/pspm_expand_epochs.m index ca1a3bc96..c86a7de15 100644 --- a/src/pspm_expand_epochs.m +++ b/src/pspm_expand_epochs.m @@ -9,7 +9,7 @@ % [sts, output_file] = pspm_expand_epochs(epochs_fn, expansion, options) % [sts, expanded_epochs] = pspm_expand_epochs(epochs, expansion, options) % [sts, channel_index] = pspm_expand_epochs(data_fn, channel, expansion , options) -% ● Arguments +% ● Arguments % * epochs_fn: An epochs file as defined in pspm_get_timing. % * epochs: A 2-column matrix with epochs onsets and offsets in seconds. % * data_fn: A PsPM data file. @@ -17,11 +17,11 @@ % * expansion: A 2-element vector with positive numbers [pre, post] % ┌────────────options: % ├─────────.overwrite: Define if already existing files should be -% │ overwritten. Default ist 0. (Only used if input +% │ overwritten. Default ist 2. (Only used if input % │ is epochs file.) % └────.channel_action: Channel action, add / replace existing data % data (default: add) -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % ● History % Introduced in PsPM 7.0 @@ -48,22 +48,38 @@ if isnumeric(varargin{1}) mode = 'epochs'; [gsts, epochs] = pspm_get_timing('epochs', varargin{1}, 'seconds'); - if gsts < 1 + if gsts < 1 return end + elseif ischar(varargin{1}) fn = varargin{1}; + % we turn the downstream warning off because the return status is used to determine the + % format of the first input argument warning off - [gsts, epochs] = pspm_get_timing('epochs', fn, 'seconds'); + [dsts, infos, ~, filestruct] = pspm_load_data(fn, 'none'); warning on - if gsts == 1 - mode = 'epochfile'; - else - fprint('Assuming input is a PsPM data file ...\n'); + + if dsts == 1 + fprintf('Assuming input is a PsPM data file ...\n'); mode = 'datafile'; + else + % we turn the downstream warning off because we want to give a summary warning + % below + warning off + [gsts, epochs] = pspm_get_timing('epochs', fn, 'seconds'); % if the epochfile is empty? + warning on + + if gsts == 1 + mode = 'epochfile'; + else % neither a empty nor a normal epochfile gsts < 1 + warning('ID:invalid_input', 'First argument must be a file name or epoch matrix.'); + return + end end else warning('ID:invalid_input', 'First argument must be a file name or epoch matrix.'); + return end % parse remaining arguments @@ -77,7 +93,7 @@ end if nargin > k - options = varargin{3}; + options = varargin{k+1}; else options = struct(); end @@ -86,11 +102,13 @@ options = pspm_options(options, 'expand_epochs'); % check if expansion vector is valid -if ~isnumeric(expansion) || numel(expansion) ~= 2 - warning('Invalid input to expand vector musst be 1x2 or 2x1.'); +if ~isnumeric(expansion) || numel(expansion) ~= 2 || expansion(1) < 0 || expansion(2) < 0 + warning('ID:invalid_input','Expansion vector must have 2 positive elements.'); return; end + + % work on input % ------------------------------------------------------------------------- @@ -105,22 +123,27 @@ channel_data = data{1}; sr = channel_data.header.sr; - % Find NaN indices + % find NaN indices nan_indices = isnan(channel_data.data); - - % Convert NaN indices to epochs + + % convert NaN indices to epochs epochs = pspm_logical2epochs(nan_indices, sr); end % expand epochs -pre = expansion(1); -post = expansion(2); -expanded_epochs_temp = [epochs(:,1) - pre, epochs(:,2) + post]; -% remove negative values and merge overlapping epochs -[ksts, expanded_epochs] = pspm_get_timing('missing',expanded_epochs_temp , 'seconds') ; -if ksts < 1 - return +if isempty(epochs) + warning('No epochs found.'); + expanded_epochs = []; +else + pre = expansion(1); + post = expansion(2); + expanded_epochs_temp = [epochs(:,1) - pre, epochs(:,2) + post]; + % remove negative values and merge overlapping epochs + [ksts, expanded_epochs] = pspm_get_timing('missing', expanded_epochs_temp, 'seconds') ; + if ksts < 1 + return + end end % generate output @@ -130,31 +153,34 @@ case 'epochfile' % save expanded epochs to a new file with 'e' prefix - [pathstr, name, ext] = fileparts(fn); - output_file = fullfile(pathstr, ['e', name, ext]); - overwrite_final = pspm_overwrite(output_file, options.overwrite); - if overwrite_final == 1 - save(output_file, 'epochs'); - fprintf(['Expanded epochs saved to file: ', output_file, '\n']); - end + [pathstr, name, ext] = fileparts(fn); + output_file = fullfile(pathstr, ['e', name, ext]); + overwrite_final = pspm_overwrite(output_file, options.overwrite); + if overwrite_final == 1 + epochs = expanded_epochs; + save(output_file, 'epochs'); + fprintf(['Expanded epochs saved to file: ', output_file, '\n']); + out = output_file; % the function outputs the filename of the expanded epochfile + end case 'datafile' - % Convert expanded epochs back to logical indices - expanded_indices = pspm_epochs2logical(expanded_epochs, numel(channel_data.data), sr); + % Convert expanded epochs back to logical indices + expanded_indices = pspm_epochs2logical(expanded_epochs, numel(channel_data.data), sr); + + % Set data to NaN at expanded indices + channel_data.data(logical(expanded_indices)) = NaN; + + % Save the data + [wsts, out] = pspm_write_channel(fn, {channel_data}, options.channel_action, struct('channel', channel)); + if wsts < 1 + return + end + out = out.channel; - % Set data to NaN at expanded indices - channel_data.data(logical(expanded_indices)) = NaN; - % Save the data - [wsts, out] = pspm_write_channel(fn, {channel_data}, options.channel_action, struct('channel', channel)); - if wsts < 1 - return end - out = out.channel; -end sts = 1; - - +end diff --git a/src/pspm_export.m b/src/pspm_export.m index 9945bf780..fd93a5062 100644 --- a/src/pspm_export.m +++ b/src/pspm_export.m @@ -6,7 +6,7 @@ % (first-level models) and columns for statistics (must be the same for all % models). The output can be written to screen or to a text file. % ● Format -% pspm_exp(modelfile, options) +% sts = pspm_exp(modelfile, options) % ● Arguments % * modelfile: [string/cell_array] a filename, or cell array of filenames. % ┌─────────options @@ -31,6 +31,8 @@ % values. This option can only be used for GLM files when % exclude_missing was set during model setup. Otherwise % this argument is ignored. +% ● Outputs +% * sts : Status flag. % ● History % Introduced in PsPM 3.0 % Written in 2009-2015 by Dominik R Bach (WTCN, UZH) @@ -51,7 +53,7 @@ elseif nargin < 2 %if no options are given, built options struct with default values options = struct(); -end; +end options = pspm_options(options, 'exp'); if options.invalid @@ -68,7 +70,7 @@ elseif ~iscell(modelfile) warning('ID:invalid_input', 'Model file must be a cell array of char, or char.'); return; -end; +end % check target -- if ~ischar(target) @@ -90,8 +92,8 @@ % open or create file for reading and writing, discard contents fid = fopen(target, 'w+'); - if fid == -1, warning('Output file (%s) could not be opened.', target); return; end; -end; + if fid == -1, warning('Output file (%s) could not be opened.', target); return; end +end % check statstype -- if ~ischar(statstype) @@ -102,18 +104,18 @@ elseif ~strcmpi(statstype, {'cond', 'recon'}) warning('ID:invalid_input', 'Unknown Stats type (%s)', statstype); return; -end; +end % check delimiter -- if ~ischar(delim) warning('ID:invalid_input', 'Delimiter must be a char'); return; -end; +end % check exclude_missing -- if exclude_missing~=0 && exclude_missing~=1 warning('ID:invalid_input', ['The value of options.exclude_missing ',... 'must be either 0 or 1']); return; -end; +end % get data % ------------------------------------------------------------------------- @@ -122,7 +124,7 @@ excl_stats_contained = false(numel(modelfile),1); for iFile = 1:numel(modelfile) [lsts, data(iFile), modeltype{iFile}] = pspm_load1(modelfile{iFile}, statstype); - if lsts < 1, return; end; + if lsts < 1, return; end % set flag to indicate if exclude statistics are contained if isfield(data(iFile),'stats_exclude') && isfield(data(iFile),'stats_missing') excl_stats_contained(iFile) = true; @@ -138,9 +140,9 @@ elseif ~(numel(data(iFile).names) == numel(data(1).names)) || ... ~all(strcmpi(data(iFile).names, data(1).names)); usenames = 0; - end; - end; -end; + end + end +end % create output names -- if ~usenames @@ -152,16 +154,16 @@ trlnames = data(1).trlnames; elseif strcmpi(statstype, 'cond') trlnames = data(1).condnames; - end; + end % combine with measure names cName = 1; for iMsr = 1:size(data(1).stats, 2) for iTrl = 1:size(data(1).stats, 1) outnames{cName} = sprintf('%s - %s', trlnames{iTrl}, data(1).names{iMsr}); cName = cName + 1; - end; - end; -end; + end + end +end % create output data -- % if exclude_missing & any exclude stats available: set condition stats to NaN @@ -198,7 +200,7 @@ statstypechar = 'Reconstructed response amplitude per condition'; else warning('No valid data type'); return; -end; +end % output -- @@ -207,20 +209,20 @@ % variable names - for iName = 1:numel(outnames) fprintf(fid, sprintf('%s%s', outnames{iName}, delim)); -end; +end fprintf(fid, '\n'); % data - for iRow = 1:size(outdata, 1) for iCol = 1:size(outdata, 2) fprintf(fid, sprintf('%8.8f%s', outdata(iRow, iCol), delim)); - end; + end fprintf(fid, '\n'); -end; +end fprintf(fid, '\n'); % close file - if fid ~= 1 fclose(fid); -end; +end %% Return values sts = 1; diff --git a/src/pspm_extract_segments.m b/src/pspm_extract_segments.m index 1f65bc533..353676b8c 100644 --- a/src/pspm_extract_segments.m +++ b/src/pspm_extract_segments.m @@ -58,6 +58,12 @@ % │ a matlab file. Default is no NaN output. % └──────────────.norm: If 1, z-scores the entire data time series % (default: 0). +% ● Outputs +% * sts : Status flag. +% * segments : [1 x c] cell array, with one struct per condition c. +% Each condition contains the following fields: data, +% mean, std, sem, trial_nan_percent, and total_nan_percent +% % ● History % Introduced in PsPM 4.3 % Written in 2008-2018 by Tobias Moser (University of Zurich) @@ -104,7 +110,8 @@ if isfield(options, 'missing') model.missing = options.missing; end - model = pspm_check_model(model, 'glm'); + % set overwrite = 1 to override test of existing model file + model = pspm_check_model(model, struct('overwrite', 1), 'glm'); if model.invalid, return; end timing = model.timing; datafile = model.datafile; @@ -330,7 +337,7 @@ disp(trials_nan_output); case 'none' otherwise - %print Nan-Value in file + %print NaN-Value in file %expect the path to file in options.nan_output %find information about file [path, name, ext ]= fileparts(options.nan_output); diff --git a/src/pspm_eye.m b/src/pspm_eye.m index d7d7ef813..717b44b5a 100644 --- a/src/pspm_eye.m +++ b/src/pspm_eye.m @@ -2,7 +2,7 @@ % ● Description % pspm_eye converts legacy use of eye markers into the current version % ● Format -% Y = pspm_eye(X) +% Y = pspm_eye(X,feature) % ● Arguments % * X: The input eye marker. % * feature: The feature used for converting eye marker. Accepted values diff --git a/src/pspm_filtfilt.m b/src/pspm_filtfilt.m index 9d9f49c0d..ce0d45299 100644 --- a/src/pspm_filtfilt.m +++ b/src/pspm_filtfilt.m @@ -9,7 +9,7 @@ % * a: filter parameters (denominator) % * x: input data vector (if matrix, filter over columns) % * y: filtered data -% ● Developer's notes +% ● Developer % The filter is described by the difference equation: % y(n) = b(1)*x(n) + b(2)*x(n-1) + ... + b(nb+1)*x(n-nb) % - a(2)*y(n-1) - ... - a(na+1)*y(n-na) @@ -26,9 +26,8 @@ % [2] Fredrik Gustafsson, Determining the initial states in forward-backward % filtering, IEEE Transactions on Signal Processing, pp. 988--992, % April 1996, Volume 44, Issue 4 -% ● References -% L. Shure, T. Krauss, F. Gustafsson -% Copyright 1988-2004 The MathWorks, Inc. +% [3] L. Shure, T. Krauss, F. Gustafsson +% Copyright 1988-2004 The MathWorks, Inc. % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) diff --git a/src/pspm_find_eye.m b/src/pspm_find_eye.m index 2ea49d453..0cb239347 100644 --- a/src/pspm_find_eye.m +++ b/src/pspm_find_eye.m @@ -1,5 +1,5 @@ function [sts, eye, new_chantype] = pspm_find_eye(chantype) -% ● Definition +% ● Description % pspm_get_eye detects the eye location ('l', 'r', 'c', '') from an % eyetracker channel type % ● Format diff --git a/src/pspm_find_sounds.m b/src/pspm_find_sounds.m index 12ac9e1a7..4106c9ed8 100644 --- a/src/pspm_find_sounds.m +++ b/src/pspm_find_sounds.m @@ -70,7 +70,7 @@ % few are found, lowers threshold until at least specified count is % reached. Threshold is lowered by .01 until 0.05 is reached for a max % of 95 iterations. This is a EXPERIMENTAL variable, use with caution! -% ● Output +% ● Outputs % * channel_index : index of channel containing the processed data % ┌───────────info % ├───.snd_markers : vector of begining of sound sound events diff --git a/src/pspm_find_valid_fixations.m b/src/pspm_find_valid_fixations.m index a2d7445d7..5bab91f91 100644 --- a/src/pspm_find_valid_fixations.m +++ b/src/pspm_find_valid_fixations.m @@ -26,8 +26,8 @@ % perpendicular to the vector from the eye to the fixation point (which % is approximately correct for large enough screen distance). % ● Format -% [sts, channel_index] = pspm_find_valid_fixations(fn, bitmap, options) -% [sts, channel_index] = pspm_find_valid_fixations(fn, circle_degree, distance, unit, options) +% [sts, channel_index, fn] = pspm_find_valid_fixations(fn, bitmap, options) +% [sts, channel_index, fn] = pspm_find_valid_fixations(fn, circle_degree, distance, unit, options) % ● Arguments % * fn : The actual data file containing the eyelink recording with gaze % data converted to cm. @@ -74,10 +74,15 @@ % mode "fixation" and distance or pixel units for mode % "bitmap". % Default is 'pupil'. +% ● Outputs +% * sts: Status flag: 1 = success, -1 = error +% * pos_of_channel: Index/indices of modified or newly added channels +% * fn : Unchanged if called with a filename (data is saved); +% updated data structure if called with a data structure % ● References % [1] Korn CW & Bach DR (2016). A solid frame for the window on cognition: % Modelling event-related pupil responses. Journal of Vision, 16:28,1-6. -% ● Developer note +% ● Developer % Additional i/o options for recursive calls are not included in the help. % (1) fn can be a data structure as permitted by pspm_load_data, % (2) the output argument pos_of_channels is an index of the channel(s) diff --git a/src/pspm_format_history.m b/src/pspm_format_history.m index 32620a671..d740092a3 100644 --- a/src/pspm_format_history.m +++ b/src/pspm_format_history.m @@ -14,7 +14,7 @@ % ● Arguments % * history_cell_array: [cell array of strings] infos.history field in % a PsPM file -% ● Output +% ● Outputs % * hist_str : Formatted table string. % ● History % Written in 2019 by Eshref Yozdemir (UZH) diff --git a/src/pspm_format_history_from_file.m b/src/pspm_format_history_from_file.m index 7892658ae..1e6dea0d6 100644 --- a/src/pspm_format_history_from_file.m +++ b/src/pspm_format_history_from_file.m @@ -5,9 +5,9 @@ % to pspm_format_history. % ● Format % [sts, hist_str] = pspm_format_history_from_file(fn) -% ● Argument +% ● Arguments % * fn: [string] Path to a PsPM file -% ● Output +% ● Outputs % * hist_str: Formatted table string % ● History % Written in 2019 by Eshref Yozdemir (UZH) diff --git a/src/pspm_gaze_pp.m b/src/pspm_gaze_pp.m index ad0aad411..2409fa729 100644 --- a/src/pspm_gaze_pp.m +++ b/src/pspm_gaze_pp.m @@ -15,7 +15,7 @@ % │ specified above. Default is 'gaze'. % └.channel_action: 'replace' existing gaze_x_c and gaze_y_c channels, or % 'add' new ones (default) -% ● Output +% ● Outputs % * sts: Status determining whether the execution was % successfull (sts == 1) or not (sts == -1) % * channel_index: Index of the generated combined gaze channels. diff --git a/src/pspm_get_acq.m b/src/pspm_get_acq.m index 2c46f0b15..687bdb8da 100644 --- a/src/pspm_get_acq.m +++ b/src/pspm_get_acq.m @@ -16,10 +16,10 @@ % ├────────.sr : The sampling rate of the acq file. % ├──────.data : The data read from the acq file. % └────.marker : The type of marker, such as 'continuous' -% ● Output +% ● Outputs % * import : The import struct that saves importing information % * sourceinfo : The struct that saves information of original data source -% ● Developer's Notes +% ● Developer % The main part of this function is shared with pspm_get_acq_python. % The function acqread is stored in the path /Import/acq. % ● History diff --git a/src/pspm_get_acq_bioread.m b/src/pspm_get_acq_bioread.m index d3edfc688..8b1b6599d 100644 --- a/src/pspm_get_acq_bioread.m +++ b/src/pspm_get_acq_bioread.m @@ -12,7 +12,9 @@ % ● Arguments % * datafile : the path of the BIOPAC/AcqKnowledge file to be imported % ┌───import +% ├─.channel : channel. % ├──────.sr : sampling rate. +% ├────.type : channel type. % ├────.data : The data read from the acq file. % ├───.units : the unit of data. % └──.marker : The type of marker, such as 'continuous'. @@ -38,8 +40,8 @@ channel = import{k}.channel; else channel = pspm_find_channel(channel_labels, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end if channel > size(channel_labels, 1) warning('ID:channel_not_contained_in_file', ... 'Channel %02.0f not contained in file %s.\n', channel, datafile); @@ -54,8 +56,8 @@ import{k}.units = inputdata.channels{channel}.units; if strcmpi(settings.channeltypes(import{k}.typeno).data, 'events') import{k}.marker = 'continuous'; - end; -end; + end +end %% Return values sts = 1; return diff --git a/src/pspm_get_acq_python.m b/src/pspm_get_acq_python.m index 73f456db6..0759ae9bc 100644 --- a/src/pspm_get_acq_python.m +++ b/src/pspm_get_acq_python.m @@ -16,7 +16,7 @@ % ├────────.sr: The sampling rate of the acq file. % ├──────.data: The data read from the acq file. % └────.marker: The type of marker, such as 'continuous' -% ● Output +% ● Outputs % * import: The import struct that saves importing information % * sourceinfo: The struct that saves information of original data source % ● History diff --git a/src/pspm_get_acqmat.m b/src/pspm_get_acqmat.m index ac266b78a..63736337b 100644 --- a/src/pspm_get_acqmat.m +++ b/src/pspm_get_acqmat.m @@ -16,7 +16,7 @@ % ├────────.sr : The sampling rate of the file. % ├──────.data : The data read from the file. % └────.marker : The type of marker, such as 'continuous' -% ● Output +% ● Outputs % * import : The import struct that saves importing information % * sourceinfo : The struct that saves information of original data source % ● History @@ -47,7 +47,7 @@ if channel < 1, return; end end - if channel > size(inputdata.labels, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(inputdata.labels, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, inputdata.labels(channel, :)); diff --git a/src/pspm_get_biograph.m b/src/pspm_get_biograph.m index 5a7e64c08..c71dcc66a 100644 --- a/src/pspm_get_biograph.m +++ b/src/pspm_get_biograph.m @@ -13,9 +13,9 @@ % ├────────.sr : The sampling rate of the file. % ├──────.data : The data read from the file. % └────.marker : The type of marker, such as 'continuous' -% ● Output -% import : The import struct that saves importing information -% sourceinfo : The struct that saves information of original data source +% ● Outputs +% * import : The import struct that saves importing information +% * sourceinfo : The struct that saves information of original data source % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 Dominik R Bach (Wellcome Trust Centre for Neuroimaging) @@ -41,7 +41,7 @@ fprintf('\n'); warning('Please use ''Interval Data Export'' for channels of type ''%s''', ... import{1}.type); return - end; + end import{1}.marker = 'timestamps'; import{1}.sr = 1; % time stamps are in seconds import{1}.data = bio.data{1}; @@ -50,7 +50,7 @@ fprintf('\n'); warning('Please use ''Export Channel Data'' for channels of type ''%s''', ... import{1}.type); return - end; + end import{1}.sr = str2num(cell2mat(regexp(bio.header{1}{1}, '\d', 'match'))); import{1}.data = bio.data{2}; % check sample rate -- @@ -70,8 +70,8 @@ % --> abs(1-diff(timestamps)) < threshold, with threshold = sr * abs(error) if any(abs(1-import{1}.sr*diff(bio.data{1})) > threshold) warning('Sample rate in header line and timestamps in first column do not match.'); return; - end; -end; + end +end %% Return values sts = 1; return diff --git a/src/pspm_get_biosemi.m b/src/pspm_get_biosemi.m index 2e5e546e5..0d3de3a42 100644 --- a/src/pspm_get_biosemi.m +++ b/src/pspm_get_biosemi.m @@ -32,7 +32,7 @@ % ------------------------------------------------------------------------- hdr = ft_read_header(datafile); indata = ft_read_data(datafile); -try mrk = ft_read_event(datafile); catch, mrk = []; end; +try mrk = ft_read_event(datafile); catch, mrk = []; end % extract individual channels % ------------------------------------------------------------------------- @@ -44,10 +44,10 @@ channel = import{k}.channel; else channel = pspm_find_channel(hdr.label, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > size(indata, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(indata, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, hdr.label{channel}); @@ -71,10 +71,10 @@ import{k}.marker = 'timestamps'; import{k}.markerinfo.value = []; import{k}.markerinfo.name = []; - end; - end; + end + end -end; +end % clear path and return % ------------------------------------------------------------------------- diff --git a/src/pspm_get_biotrace.m b/src/pspm_get_biotrace.m index 5e2f5a92b..3f92441b2 100644 --- a/src/pspm_get_biotrace.m +++ b/src/pspm_get_biotrace.m @@ -11,9 +11,9 @@ % ├────────.sr : The sampling rate of the file. % ├──────.data : The data read from the file. % └────.marker : The type of marker, such as 'continuous' -% ● Output -% import : The import struct that saves importing information -% sourceinfo : The struct that saves information of original data source +% ● Outputs +% * import : The import struct that saves importing information +% * sourceinfo : The struct that saves information of original data source % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) @@ -44,7 +44,7 @@ else foo = regexp(bio.header{1}{7}, '\s', 'split'); sr = str2num(foo{3}); -end; +end % retrieve recording channel, date and time --- foo = regexp(bio.header{1}{9}, ':', 'split'); @@ -66,8 +66,8 @@ else import{k}.data = bio.data{1}; import{k}.sr = sr; - end; -end; + end +end %% Return values sts = 1; return diff --git a/src/pspm_get_blink_l.m b/src/pspm_get_blink_l.m index 529138997..aa2b17d64 100644 --- a/src/pspm_get_blink_l.m +++ b/src/pspm_get_blink_l.m @@ -7,6 +7,7 @@ % ● Arguments % ┌──import % ├───.data: column vector of waveform data +% ├──.units: units of waveform data % └─────.sr: sample rate % ● History % Introduced in PsPM 4.0.2 diff --git a/src/pspm_get_blink_r.m b/src/pspm_get_blink_r.m index 9a7220577..3c64b1d88 100644 --- a/src/pspm_get_blink_r.m +++ b/src/pspm_get_blink_r.m @@ -7,6 +7,7 @@ % ● Arguments % ┌────import % ├─────.data : column vector of waveform data +% ├────.units : units of waveform data % └───────.sr : sample rate % ● History % Introduced in PsPM 4.0.2 diff --git a/src/pspm_get_brainvis.m b/src/pspm_get_brainvis.m index 5eb7f96ef..1694f19b8 100644 --- a/src/pspm_get_brainvis.m +++ b/src/pspm_get_brainvis.m @@ -9,7 +9,7 @@ % ● Arguments % * datafile : the path of data file to be imported % * import : the struct of import settings -% ● Developer's Note +% ● Developer % I did not have sample files, simply assumed that hdr.labels would be % a cell array - might have to be changed in lines 38 and 41 % ● History @@ -30,7 +30,7 @@ % ------------------------------------------------------------------------- hdr = ft_read_header(datafile); indata = ft_read_data(datafile); -try mrk = ft_read_event(datafile); catch, mrk = []; end; +try mrk = ft_read_event(datafile); catch, mrk = []; end % extract individual channels % ------------------------------------------------------------------------- @@ -43,10 +43,10 @@ channel = import{k}.channel; else channel = pspm_find_channel(hdr.label, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > numel(hdr.label), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > numel(hdr.label), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, hdr.label{channel}); @@ -72,15 +72,15 @@ val{i} = ''; else val{i} = v; - end; - end; + end + end % convert into double num_val = str2double(regexprep(val, '[^0-9]*([0-9,.]*)', '$1')); import{k}.markerinfo.value = num_val; import{k}.markerinfo.name = {mrk.type}'; - end; + end -end; +end % clear path rmpath(pspm_path('Import','fieldtrip','fileio')); diff --git a/src/pspm_get_cnt.m b/src/pspm_get_cnt.m index b2a7a60c5..53884e6f2 100644 --- a/src/pspm_get_cnt.m +++ b/src/pspm_get_cnt.m @@ -3,7 +3,7 @@ % pspm_get_cnt imports NeuroScan cnt files using FieldTrip functions. % ● Format % [sts, import, sourceinfo] = pspm_get_cnt(datafile, import); -% ● Developer's notes +% ● Developer % This function uses fieldtrip fileio functions % ● Arguments % * datafile : The data file to be imported. @@ -37,11 +37,11 @@ headerformat = 'ns_cnt32'; else headerformat = 'ns_cnt16'; -end; +end hdr = ft_read_header(datafile, 'headerformat', headerformat); indata = ft_read_data(datafile, 'headerformat', headerformat, 'dataformat', headerformat); -try mrk = ft_read_event(datafile, 'headerformat', headerformat, 'dataformat', headerformat, 'eventformat', headerformat); catch, mrk = []; end; +try mrk = ft_read_event(datafile, 'headerformat', headerformat, 'dataformat', headerformat, 'eventformat', headerformat); catch, mrk = []; end % extract individual channels % ------------------------------------------------------------------------- @@ -51,8 +51,8 @@ channel = import{k}.channel; else channel = pspm_find_channel(hdr.label, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, hdr.label{channel}); @@ -74,10 +74,10 @@ import{k}.data = []; import{k}.markerinfo.value = []; import{k}.markerinfo.name = []; - end; - end; + end + end -end; +end % clear path and return % ------------------------------------------------------------------------- diff --git a/src/pspm_get_edf.m b/src/pspm_get_edf.m index 5939974bc..8e0af6397 100644 --- a/src/pspm_get_edf.m +++ b/src/pspm_get_edf.m @@ -27,14 +27,14 @@ warning('off', 'all'); % unfortunately the warning is not issued with an ID hdr = ft_read_header(datafile); indata = ft_read_data(datafile); -try mrk = ft_read_event(datafile, 'detectflank', []); catch, mrk = []; end; +try mrk = ft_read_event(datafile, 'detectflank', []); catch, mrk = []; end warning(w_state); % convert 3 dim to 2 dim (collapse all trials into continuous data) if numel(size(indata)) == 3, indata = indata(:,:); -end; +end % extract individual channels % ------------------------------------------------------------------------- @@ -46,10 +46,10 @@ channel = import{k}.channel; else channel = pspm_find_channel(hdr.label, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > size(indata, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(indata, 1), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, hdr.label{channel}); @@ -71,10 +71,10 @@ else warning('ID:channel_not_contained_in_file', ... 'Marker channel not contained in file %s.\n', datafile); return; - end; - end; + end + end -end; +end % clear path and return % ------------------------------------------------------------------------- diff --git a/src/pspm_get_events.m b/src/pspm_get_events.m index 0fabf4022..c38614ff7 100644 --- a/src/pspm_get_events.m +++ b/src/pspm_get_events.m @@ -17,7 +17,7 @@ % │ descending flank as separate events). % └──.denoise : for continuous marker channels: only retains markers of % duration longer than the value given here (in seconds). -% ● Output +% ● Outputs % * import : returns event timestamps in seconds in import.data % ● History % Introduced in PsPM 3.0 diff --git a/src/pspm_get_eyelink.m b/src/pspm_get_eyelink.m index d1e852308..90556bc3f 100644 --- a/src/pspm_get_eyelink.m +++ b/src/pspm_get_eyelink.m @@ -33,7 +33,7 @@ % │ according to the set distance. % └────.distance_unit : [optional] The unit to which the data should be % converted and in which eyelink_trackdist is given. -% ● Developer's Notes +% ● Developer % In this function, channels related to eyes will not produce an error, if % they do not exist. Instead they will produce an empty channel (a channel % with NaN values only). diff --git a/src/pspm_get_gaze_x_l.m b/src/pspm_get_gaze_x_l.m index bc73bc79c..da329afa5 100644 --- a/src/pspm_get_gaze_x_l.m +++ b/src/pspm_get_gaze_x_l.m @@ -7,7 +7,9 @@ % ● Arguments % ┌import % ├─.data : column vector of left gaze x data -% └───.sr : sample rate +% ├─.units: measurement units +% ├───.sr : sample rate +% └─.range: range of the gaze data % ● History % Introduced in PsPM 3.1 % Written in 2015 by Tobias Moser (University of Zurich) diff --git a/src/pspm_get_gaze_x_r.m b/src/pspm_get_gaze_x_r.m index bc3a901d0..58e5b3777 100644 --- a/src/pspm_get_gaze_x_r.m +++ b/src/pspm_get_gaze_x_r.m @@ -7,7 +7,9 @@ % ● Arguments % ┌import % ├─.data : column vector of right gaze x data -% └───.sr : sample rate +% ├─.units: measurement units +% ├───.sr : sample rate +% └─.range: range of the gaze data % ● History % Introduced in PsPM 3.1 % Written in 2015 by Tobias Moser (University of Zurich) diff --git a/src/pspm_get_gaze_y_l.m b/src/pspm_get_gaze_y_l.m index db7ce9440..84ddf4cde 100644 --- a/src/pspm_get_gaze_y_l.m +++ b/src/pspm_get_gaze_y_l.m @@ -7,7 +7,9 @@ % ● Arguments % ┌import % ├─.data : column vector of left gaze y data -% └───.sr : sample rate +% ├─.units: measurement units +% ├───.sr : sample rate +% └─.range: range of the gaze data % ● History % Introduced in PsPM 3.1 % Written in 2015 by Tobias Moser (University of Zurich) diff --git a/src/pspm_get_gaze_y_r.m b/src/pspm_get_gaze_y_r.m index a8d2be641..60c99e34a 100644 --- a/src/pspm_get_gaze_y_r.m +++ b/src/pspm_get_gaze_y_r.m @@ -7,7 +7,9 @@ % ● Arguments % ┌import % ├─.data : column vector of right gaze y data -% └───.sr : sample rate +% ├─.units: measurement units +% ├───.sr : sample rate +% └─.range: range of the gaze data % ● History % Introduced in PsPM 3.1 % Written in 2015 by Tobias Moser (University of Zurich) diff --git a/src/pspm_get_hp.m b/src/pspm_get_hp.m index 0632de87e..dd31b5326 100644 --- a/src/pspm_get_hp.m +++ b/src/pspm_get_hp.m @@ -26,7 +26,7 @@ data.header.units = 'ms'; else data.header.units = import.units; -end; +end data.header.sr = import.sr; % check status diff --git a/src/pspm_get_hr.m b/src/pspm_get_hr.m index 2a72657a8..a86a5e4ee 100644 --- a/src/pspm_get_hr.m +++ b/src/pspm_get_hr.m @@ -27,7 +27,7 @@ data.header.units = 'bpm'; else data.header.units = import.units; -end; +end data.header.sr = import.sr; % check status diff --git a/src/pspm_get_labchart.m b/src/pspm_get_labchart.m index effcd3634..fe3f798af 100644 --- a/src/pspm_get_labchart.m +++ b/src/pspm_get_labchart.m @@ -2,7 +2,7 @@ % ● Description % pspm_get_labchart imports ADInstruments LabChart *.adicht files. This % function uses an external library that requires Windows as OS. See -% pspm_labchartmat_in and pspm_labchart_mat_ex for import of matlab +% pspm_get_labchartmat_in and pspm_get_labchartmat_ext for import of matlab % files that were exported either using the built-in function or the % online conversion tool. % ● Format diff --git a/src/pspm_get_labchartmat_ext.m b/src/pspm_get_labchartmat_ext.m index f1499a9d6..4ea54a436 100644 --- a/src/pspm_get_labchartmat_ext.m +++ b/src/pspm_get_labchartmat_ext.m @@ -16,7 +16,7 @@ % * sts : status. % * import : the import structure. % * sourceinfo : the source information structure. -% ● Developer's Notes +% ● Developer % Tue Jun 08, 2010 12:25 am from % http://www.adinstruments.com/forum/viewtopic.php?f=7&t=35&p=79#p79 % Export MATLAB writes the comment timestamps using the overall `tick rate`. @@ -49,7 +49,7 @@ elseif ~isfield(labchart, 'data_block1') warning('This version of the export extension is not supported. Please contact PsPM developers.'); return; -end; +end % retrieve sampling rate(s) --- for channel = 1:size(labchart.ticktimes_block1, 1) @@ -59,8 +59,8 @@ warning('Recording timestamps imprecise (> 5% deviation)'); return; else sr(channel) = mean(timestamps); - end; -end; + end +end % loop through import jobs % ------------------------------------------------------------------------- @@ -78,10 +78,10 @@ channel = import{k}.channel; else channel = pspm_find_channel(cellstr(labchart.titles_block1), import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > numel(cellstr(labchart.titles_block1)), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > numel(cellstr(labchart.titles_block1)), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, labchart.titles_block1(channel, :)); @@ -96,13 +96,13 @@ samples = ~isnan(labchart.ticktimes_block1(1, :)); % get sample rate --- import{k}.sr = 1/sr; - end; + end % get data import{k}.data = labchart.data_block1(channel, samples); % get units --- import{k}.units = labchart.units_block1(channel, :); - end; -end; + end +end sts = 1; return diff --git a/src/pspm_get_labchartmat_in.m b/src/pspm_get_labchartmat_in.m index 66fbd5e10..e1fdf5039 100644 --- a/src/pspm_get_labchartmat_in.m +++ b/src/pspm_get_labchartmat_in.m @@ -16,7 +16,7 @@ % * sts : status. % * import : the import structure. % * sourceinfo : the source information structure. -% ● Developer's Notes +% ● Developer % * NOTE % This info is inherited from the old labchart export code but I % assume it's still valid @@ -77,10 +77,10 @@ channel = import{blk}{k}.channel; else channel = pspm_find_channel(cellstr(labchart.titles), import{blk}{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > numel(cellstr(labchart.titles)), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > numel(cellstr(labchart.titles)), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo{blk}.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, labchart.titles(channel, :)); @@ -89,9 +89,9 @@ labchart.data(labchart.datastart(channel, blk):labchart.dataend(channel, blk))]; % get sample rate import{blk}{k}.sr = labchart.samplerate(channel, blk); - end; - end; -end; + end + end +end sts = 1; return diff --git a/src/pspm_get_markerinfo.m b/src/pspm_get_markerinfo.m index 686eb9808..85f551774 100644 --- a/src/pspm_get_markerinfo.m +++ b/src/pspm_get_markerinfo.m @@ -7,8 +7,7 @@ % ● Format % [sts, markerinfo] = pspm_get_markerinfo(filename, options) % ● Arguments -% * filename : [char] -% name of PsPM file +% * filename : [char] name of PsPM file % if empty, you will be prompted for one % ┌────options % ├.marker_chan_num: [int] marker channel number. @@ -19,13 +18,12 @@ % └──overwrite : [logical] (0 or 1) % Define whether to overwrite existing output files or not. % Default value: determined by pspm_overwrite. -% ● Output -% * sts : [double] -% default value: -1 if unsuccessful -% ┌─markerinfo : [struct] -% ├──────.name : [char] -% ├─────.value : ... -% └───.element : ... +% ● Outputs +% * sts : [double] default value: -1 if unsuccessful. +% ┌────markerinfo +% ├──────.name : [char] marker type name, extracted from the data. +% ├─────.value : [double] marker value, representing event codes or timestamps. +% └───.element : [array] % ● History % Introduced in PsPM 6.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) diff --git a/src/pspm_get_mat.m b/src/pspm_get_mat.m index 88bff7110..f1d90ee99 100644 --- a/src/pspm_get_mat.m +++ b/src/pspm_get_mat.m @@ -5,14 +5,15 @@ % array of column vectors, or a time points x channels matrix. The % import of event markers is supported. Marker channels are assumed to be % continuous if the input data is a matrix or if the input data is a cell -% and the given sample rate is larger than 1 Hz. A sample rate has to -% in the import structure in both cases. +% and the given sample rate is larger than 1 Hz. A sample rate has to be +% included in the import structure in both cases. % ● Format % [sts, import, sourceinfo] = pspm_get_mat(datafile, import); % ● Arguments % * datafile : a .mat file that contains a variable 'data' that is either % [1] a cell array of channel data vectors; % [2] a datapoints x channel matrix +% * import : import structure as defined by pspm_import % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) @@ -33,7 +34,7 @@ elseif isnumeric(data.data) for k = 1:size(data.data, 2) foo{k} = data.data(:, k); - end; + end data = foo; channeltype = 'column'; elseif iscell(data.data) @@ -46,14 +47,14 @@ channeltype = 'cell'; else warning('ID:invalid_data_structure', 'Variable ''data'' in file %s must be a cell or numeric.\n', datafile); return; -end; +end % select desired channels % ------------------------------------------------------------------------- for k = 1:numel(import) channel = import{k}.channel; - if channel > numel(data), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > numel(data), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end import{k}.data = data{channel}; if strcmpi(settings.channeltypes(import{k}.typeno).data, 'events') && ~isfield(import{k}, 'marker') @@ -64,7 +65,7 @@ end end sourceinfo.channel{k} = sprintf('Data %s %02.0', channeltype, channel); -end; +end sts = 1; return diff --git a/src/pspm_get_obs.m b/src/pspm_get_obs.m index 7a1db05d1..8ba530dc7 100644 --- a/src/pspm_get_obs.m +++ b/src/pspm_get_obs.m @@ -88,23 +88,23 @@ channel = import{k}.channel; elseif strcmpi(import{k}.type, 'marker') channel = pspm_find_channel(obs.channel_names, {'sync'}); - if channel < 1, warning('Marker channel for import job %02.0f could not be identified (it''s name needs to be SYNC). Please specify as field .channel', k); return; end; + if channel < 1, warning('Marker channel for import job %02.0f could not be identified (it''s name needs to be SYNC). Please specify as field .channel', k); return; end else channel = pspm_find_channel(obs.channel_names, import{k}.type); - if channel < 1, return; end; - end; + if channel < 1, return; end + end - if channel > numel(obs.data), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > numel(obs.data), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, obs.channel_names{channel}); import{k}.sr = obs.sr; if strcmpi(import{k}.type, 'marker') import{k}.marker = 'continuous'; - end; + end import{k}.data = obs.data{channel}; -end; +end sts = 1; return diff --git a/src/pspm_get_physlog.m b/src/pspm_get_physlog.m index cdecc4a33..751b07056 100644 --- a/src/pspm_get_physlog.m +++ b/src/pspm_get_physlog.m @@ -12,7 +12,7 @@ % respiration marker, Measurement (?slice onset?), Start of scan sequence, % End of scan sequence, Trigger external, Calibration, Manual start, % Reference ECG Trigger. -% ● Developer's Notes +% ● Developer % Special about this function is that channel numbers for event/marker % channels correspond to the different event types scanphyslog files. % * Possible event types are: @@ -64,26 +64,26 @@ if bsts ~= 1 warning('ID:invalid_input', 'Physlog import was not successfull'); return; -end; +end % iterate through data and fill up channel list as specified in import % ------------------------------------------------------------------------- for k = 1:numel(import) if strcmpi(import{k}.type, 'marker') channel = import{k}.channel; - if channel > size(out.trigger.t, 2), warning('ID:channel_not_contained_in_file', 'Column %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(out.trigger.t, 2), warning('ID:channel_not_contained_in_file', 'Column %02.0f not contained in file %s.\n', channel, datafile); return; end import{k}.marker = 'continuous'; import{k}.sr = out.trigger.sr; import{k}.data = out.trigger.t{:,channel}; else channel = import{k}.channel; - if channel > size(out.data, 1), warning('ID:channel_not_contained_in_file', 'Column %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(out.data, 1), warning('ID:channel_not_contained_in_file', 'Column %02.0f not contained in file %s.\n', channel, datafile); return; end import{k}.sr = out.data{channel,1}.header.sr; import{k}.data = out.data{channel,1}.data; import{k}.units = out.data{channel,1}.header.units; sourceinfo.channel{k, 1} = sprintf('Column %02.0f', channel); - end; -end; + end +end % extract record time and date sourceinfo.date = out.record_date; diff --git a/src/pspm_get_rf.m b/src/pspm_get_rf.m index 800a4f531..52fb1d9fa 100644 --- a/src/pspm_get_rf.m +++ b/src/pspm_get_rf.m @@ -3,7 +3,7 @@ % pspm_get_rf estimates a response function from an event-related design % (e.g. for further use in a GLM analysis), using a regularisation as % third-order ODE and DCM machinery. -% ● Developer's Notes +% ● Developer % the function returns an m-function for the RF, and the parameters of that % function % ● Format @@ -35,19 +35,19 @@ warning('No events specified'); return; elseif nargin < 3 outfile = ''; -end; +end if isempty(outfile) || ~ischar(outfile) [pth infn ext] = fileparts(fn); outfile = fullfile(pth, ['RF_', infn, ext]); -end; +end if nargin < 4 channel = 'scr'; -end; +end %% call DCM options = pspm_options(options, 'get_rf'); % options.getrf = 1; -%try options.nosave, catch, options.nosave = 1; end; +%try options.nosave, catch, options.nosave = 1; end options.channel = channel; [foo dcm] = pspm_dcm(fn, '', events, options); if numel(dcm{1}.prior.posterior) == 2 @@ -56,7 +56,7 @@ else % based on aSCR (i. e. updated RF) theta = dcm{1}.prior.posterior(3).muTheta(1:7)'; -end; +end %% write response function to file if ~isempty(outfile) @@ -78,13 +78,13 @@ job{14} = sprintf('in.dt = td;'); job{15} = sprintf('for k = 1:size(ut, 2)'); job{16} = sprintf(' Xt(:, k + 1) = f_SCR(Xt(:, k), Theta, ut(:, k), in);'); - job{17} = sprintf('end;'); + job{17} = sprintf('end'); job{18} = sprintf('rf = Xt(1, :);'); job{19} = sprintf('rf = rf/max(rf);'); job{20} = sprintf('rf = rf(:);'); job = strvcat(job'); outfile = fullfile(pth, [fn, '.m']); dlmwrite(outfile, job, 'delimiter', ''); -end; +end sts = 1; return diff --git a/src/pspm_get_saccade_l.m b/src/pspm_get_saccade_l.m index 6d2a2befd..9510d31c7 100644 --- a/src/pspm_get_saccade_l.m +++ b/src/pspm_get_saccade_l.m @@ -7,8 +7,8 @@ % ● Arguments % ┌import % ├─.data : column vector of left saccade data -% ├───.sr : sample rate -% └.units : unit of left saccade data +% ├.units : unit of left saccade data +% └───.sr : sample rate % ● History % Introduced in PsPM 4.0.2 % Written in 2018 by Laure Ciernik diff --git a/src/pspm_get_scr.m b/src/pspm_get_scr.m index 29e5bb224..cce2b04cc 100644 --- a/src/pspm_get_scr.m +++ b/src/pspm_get_scr.m @@ -28,7 +28,7 @@ transferparams = import.transfer; else transferparams = 'none'; -end; +end clear c Rs offset recsys if isfield(import, 'units') dataunits = import.units; @@ -40,38 +40,38 @@ c=transferparams.c; catch warning('ID:no_conversion_constant', '/nNo conversion constant given'); return; - end; + end try Rs=transferparams.Rs; catch - Rs=0; end; + Rs=0; end try offset=transferparams.offset; catch offset=0; - end; + end try recsys=transferparams.recsys; catch recsys='conductance'; - end; + end dataunits = 'uS'; elseif ischar(transferparams) if strcmp(transferparams, 'none') c=1; Rs=0; offset=0; recsys='conductance'; elseif exist(transferparams)==2 load(transferparams); - if ~exist('c'), warning('ID:no_conversion_constant', '/nNo conversion constant given'); return; end; - if ~exist('Rs'), Rs=0; end; - if ~exist('offset'), offset=0; end; - if ~exist('recsys'), recsys='conductance'; end; + if ~exist('c'), warning('ID:no_conversion_constant', '/nNo conversion constant given'); return; end + if ~exist('Rs'), Rs=0; end + if ~exist('offset'), offset=0; end + if ~exist('recsys'), recsys='conductance'; end dataunits = 'uS'; else warning('ID:nonexistent_file', '/nTransfer file doesn''t exist'); return; - end; + end else warning('/nWrong format for transfer parameters'); return; -end; +end % convert data inputdata = double(import.data); diff --git a/src/pspm_get_smr.m b/src/pspm_get_smr.m index 666b7cd9b..1ccfc2d1e 100644 --- a/src/pspm_get_smr.m +++ b/src/pspm_get_smr.m @@ -5,9 +5,14 @@ % ● Format % [sts, import, sourceinfo] = pspm_get_smr(datafile, import); % ● Arguments +% * datafile : the data file to be imported. % ┌───import -% └─.denoise : for marker channels in CED spike format (recorded as 'level'), -% filters out markers duration longer than the value given here (in ms). +% ├───channel : X +% └───denoise : for marker channels in CED spike format (recorded as 'level'), +% only retains markers with duration longer than the value given here (in ms). +% ● Outputs +% * import : the import struct with added information. +% * sourceinfo: the struct that includes source information. % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) diff --git a/src/pspm_get_smrx.m b/src/pspm_get_smrx.m index 0f3147ca3..b8e594232 100644 --- a/src/pspm_get_smrx.m +++ b/src/pspm_get_smrx.m @@ -1,9 +1,9 @@ function [sts, import, sourceinfo] = pspm_get_smrx(datafile, import) % ● Description -% pspm_get_smr imports *.smrx files generated by Cambridge Electronics +% pspm_get_smrx imports *.smrx files generated by Cambridge Electronics % Design (CED) Spike software. % ● Format -% [sts, import, sourceinfo] = pspm_get_smr(datafile, import); +% [sts, import, sourceinfo] = pspm_get_smrx(datafile, import); % ● Arguments % * datafile : path to the smrx file % ┌───import @@ -14,10 +14,10 @@ % ├────.type : [string] The type of input channel, such as 'scr'. % └──.typeno : [integer] The number of channel type, please see pspm_init. % ● Outputs -% sts: the status recording whether the function runs successfully. -% import: the struct that stores read information. -% sourceinfo: the struct that stores channel titles. -% ● Developer's notes +% * sts: the status recording whether the function runs successfully. +% * import: the struct that stores read information. +% * sourceinfo: the struct that stores channel titles. +% ● Developer % The following fields are read from the datafile and saved in import % * data | via CEDS64ReadWaveF/CEDS64ReadEvents/CEDS64ReadMarkers % * div | via CEDS64ChanDiv diff --git a/src/pspm_get_sound.m b/src/pspm_get_sound.m index f8efc2161..a18adc76a 100644 --- a/src/pspm_get_sound.m +++ b/src/pspm_get_sound.m @@ -6,6 +6,7 @@ % ● Arguments % ┌─import % ├──.data : column vector of waveform data. +% ├─.units : units of data. % └────.sr : sample rate. % ● History % Introduced in PsPM 3.0 diff --git a/src/pspm_get_timing.m b/src/pspm_get_timing.m index 596e978bd..a3d5d6b8b 100644 --- a/src/pspm_get_timing.m +++ b/src/pspm_get_timing.m @@ -11,7 +11,7 @@ % [sts, epochs] = pspm_get_timing('missing', epochs, timeunits) % → For recursive calls also: % [sts, epochs] = pspm_get_timing('file', filename) -% ● Arguments +% ● Argument(s) // need change % onsets and timeunits are 'seconds', 'samples' or 'markers': % for defining event onsets for multiple conditions (e. g. GLM) % intiming is - a multiple condition file name (single session) OR @@ -28,15 +28,17 @@ % onsets and timeunits are 'markervalues': % for defining onsets for multiple conditions (e.g. GLM) from % entries in markerinfos: -% intiming: - a struct with fields 'markerinfos', 'markervalues, +% intiming: - a struct with fields 'markerinfo', 'markervalues', % 'names' OR % - a cell array of struct -% - markerinfos as loaded from a marker channel -% - if markervalues is a vector of numeric, it creates -% conditions from the entries in markerinfos.value +% - in both cases: +% - markerinfo as loaded from a marker channel +% - if markervalues is a vector of numeric, this creates +% conditions from the corresponding entries in markerinfos.value % - if markervalues is a cell array of char, it creates -% conditions from the entries in markerinfos.name -% - names: cell array of condition names +% conditions from the corresponding entries in markerinfos.name +% - names: cell array of condition names for the values +% indicated in markervalues % % epochs: for defining data epochs (e. g. analysis of SF, missing epochs in % GLM). epochs can be one of the following @@ -51,7 +53,7 @@ % - a .mat file with a variable 'events' (see below) % - a cell array with multiple one and two column vectors for fully % flexible DCMs that must all have the same number of rows. -% ● Developer's Notes +% ● Developer % Differences in GLM multiple condition definitions between SPM and PsPM % (1) 'durations' is optional - default is 0 % (2) 'durations' must be 0 if onsets are specified by markers @@ -138,8 +140,8 @@ for iFile = 1:nFiles % load regressor information from file if necessary -- if ischar(intiming{iFile}) - [sts, in] = pspm_get_timing('file', intiming{iFile}); - if sts < 1, return; end + [lsts, in] = pspm_get_timing('file', intiming{iFile}); + if lsts < 1, return; end elseif isstruct(intiming{iFile}) in = intiming{iFile}; else @@ -422,13 +424,12 @@ case 'epochs' % get epoch information from file or from input -- if ischar(intiming) - [sts, in] = pspm_get_timing('file', intiming); - if sts < 1, return; end + [lsts, in] = pspm_get_timing('file', intiming); + if lsts < 1, return; end if isfield(in, 'epochs') outtiming = in.epochs; elseif isfield(in, 'onsets') onsets = in.onsets; - onsetsflag = 0; if numel(onsets) == 2 if numel(onsets{1}) == numel(onsets{2}) outtiming(:, 1) = onsets{1}; @@ -485,8 +486,8 @@ % Missing epoch information for GLM and DCM % ------------------------------------------------------------------------ case 'missing' - [sts, missepochs] = pspm_get_timing('epochs', intiming, timeunits); - if sts < 1, return; end + [lsts, missepochs] = pspm_get_timing('epochs', intiming, timeunits); + if lsts < 1, return; end % sort & merge missing epochs if size(missepochs, 1) > 0 [~, sortindx] = sort(missepochs(:, 1)); @@ -508,8 +509,8 @@ case('events') if ischar(intiming) % recursive call to retrieve file - [sts, in] = pspm_get_timing('file', intiming); - if sts == -1, return; end + [lsts, in] = pspm_get_timing('file', intiming); + if lsts == -1, return; end if isfield(in, 'events') intiming = in.events; else diff --git a/src/pspm_get_txt.m b/src/pspm_get_txt.m index c1cf0180f..697cd7d77 100644 --- a/src/pspm_get_txt.m +++ b/src/pspm_get_txt.m @@ -134,7 +134,7 @@ return; end -% warning('An error occured while reading a textfile.\n'); return; end; +% warning('An error occured while reading a textfile.\n'); return; end % select desired channels % ------------------------------------------------------------------------- @@ -144,7 +144,7 @@ channel = import{k}.channel; elseif channel_names_line ~= 0 channel = pspm_find_channel(channel_names, import{k}.type); - if channel < 1, return; end; + if channel < 1, return; end else warning('ID:invalid_input', ... ['Neiter ''channel'' nor ''channel_names_line'' options were specified.', ... @@ -152,16 +152,16 @@ return; end - if channel > size(data, 2), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size(data, 2), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end import{k}.data = data(:, channel); if isfield(import{k},'typeno') && strcmpi(settings.channeltypes(import{k}.typeno).data, 'events') import{k}.marker = 'continuous'; - end; + end sourceinfo.channel{k} = sprintf('Data column %02.0', channel); -end; +end sts = 1; return diff --git a/src/pspm_get_vario.m b/src/pspm_get_vario.m index 3d61f53a4..c5780f7e0 100644 --- a/src/pspm_get_vario.m +++ b/src/pspm_get_vario.m @@ -41,7 +41,7 @@ if channel < 1, return; end end - if channel > size({vario.channel.name}, 2), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end; + if channel > size({vario.channel.name}, 2), warning('ID:channel_not_contained_in_file', 'Channel %02.0f not contained in file %s.\n', channel, datafile); return; end sourceinfo.channel{k, 1} = sprintf('Channel %02.0f: %s', channel, vario.channel(channel).name); diff --git a/src/pspm_get_viewpoint.m b/src/pspm_get_viewpoint.m index 271f0cc99..75619ef87 100644 --- a/src/pspm_get_viewpoint.m +++ b/src/pspm_get_viewpoint.m @@ -41,6 +41,7 @@ % │ custom channel id. % ├─────.units: Units of the channel. % ├────────.sr: Sampling rate. +% ├─sourceinfo: information on the data source % └───.chan_id: Channel index of the imported channel in the raw data columns. % ● History % Written in 2019 by Eshref Yozdemir (University of Zurich) diff --git a/src/pspm_get_wdq.m b/src/pspm_get_wdq.m index 26dcc586e..c3297e24f 100644 --- a/src/pspm_get_wdq.m +++ b/src/pspm_get_wdq.m @@ -39,15 +39,15 @@ channel = import{k}.channel; if channel > size(inputdata.Data, 2) warning('Channel %1.0f does not exist in data file', channel); return; - end; + end import{k}.sr = inputdata.SR; % sample rate per channel import{k}.data = inputdata.Data(:, channel); % data per channel import{k}.units = inputdata.Units{channel}; sourceinfo.channel{k, 1} = sprintf('Channel %02.0f', channel); if strcmpi(settings.channeltypes(import{k}.typeno).data, 'events') import{k}.marker = 'continuous'; - end; -end; + end +end % clear path and return % ------------------------------------------------------------------------- diff --git a/src/pspm_get_wdq_n.m b/src/pspm_get_wdq_n.m index 7be26435f..e3a3eb0f6 100644 --- a/src/pspm_get_wdq_n.m +++ b/src/pspm_get_wdq_n.m @@ -18,7 +18,7 @@ % ● Outputs % * import : Struct that includes data obtained from wdq files. % * sourceinfo : Struct that includes source information -% ● Developer's Notes +% ● Developer % This function does not use the ActiveX control elements provided by % Dataq developers. Instead it reads the binary file according to the % documentation published by dataq @@ -53,15 +53,15 @@ channel = import{k}.channel; if channel > size(inputdata, 2) warning('ID:channel_not_contained_in_file', 'Channel %1.0f does not exist in data file', channel); return; - end; + end import{k}.sr = inputinfo.sampleRatePerChannel; % sample rate per channel import{k}.data = inputdata{channel}; % data per channel import{k}.units = inputinfo.engineeringUnitsTag(channel, :); sourceinfo.channel{k, 1} = sprintf('Channel %02.0f', channel); if strcmpi(settings.channeltypes(import{k}.typeno).data, 'events') import{k}.marker = 'continuous'; - end; -end; + end +end % clear path and return % ------------------------------------------------------------------------- diff --git a/src/pspm_glm.m b/src/pspm_glm.m index 0e81f0648..7cf8e09f9 100644 --- a/src/pspm_glm.m +++ b/src/pspm_glm.m @@ -101,7 +101,8 @@ % model structure as fields .stats_missing and % .stats_exclude but not used further. % ● Outputs -% * glm: a structure 'glm' which is also written to file +% * sts: status flag (-1 or 1) +% * glm: a structure 'glm' which is also written to file % ● References % * Skin conductance response analysis % [1] GLM for SCR: @@ -163,7 +164,7 @@ % Introduced in PsPM 3.1 % Written in 2008-2016 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) % Maintained in 2022 by Teddy -% ● Developer's Notes +% ● Developer % TIMING - multiple condition file(s) or struct variable(s): % The structure is equivalent to SPM2/5/8/12 (www.fil.ion.ucl.ac.uk/spm), % such that SPM files can be used. @@ -205,26 +206,12 @@ if nargin < 1; errmsg = 'Nothing to do.'; warning('ID:invalid_input', errmsg); return elseif nargin < 2; options = struct(); end -% 2.2 check model -model = pspm_check_model(model, 'glm'); -if model.invalid +% 2.2 check model and options +[model, options] = pspm_check_model(model, options, 'glm'); +if model.invalid || options.invalid return end -% 2.3 check options -options = pspm_options(options, 'glm'); -if options.invalid - return -end - -% 2.4 check files -% stop the script if files are not allowed to overwrite -options.overwrite = pspm_overwrite(model.modelfile, options); -if ~options.overwrite - warning('ID:invalid_input', 'Model file exists, and overwriting not allowed by user.'); - return -end - %% 3 Check & get data fprintf('Computing GLM: %s ...\n', model.modelfile); fprintf('Getting data ...'); diff --git a/src/pspm_glm_recon.m b/src/pspm_glm_recon.m index a0c675abc..3ba0d25af 100644 --- a/src/pspm_glm_recon.m +++ b/src/pspm_glm_recon.m @@ -4,11 +4,11 @@ % Reconstructed responses are written into the field glm.resp, and % reconstructed response peaks into the field glm.recon in original GLM file. % ● Format -% glm = pspm_glm_recon(glmfile) or [sts, glm] = pspm_glm_recon(glmfile) +% glm = pspm_glm_recon(modelfile) or [sts, glm] = pspm_glm_recon(modelfile) % ● Arguments -% * glmfile : the GLM file +% * modelfile : the GLM file % ● Outputs -% * glm : calculated GLM struct +% * glm : calculated GLM struct % ● History % Introduced in PsPM 3.0 % Written in 2008-2018 Dominik R Bach (Wellcome Trust Centre for Neuroimaging) diff --git a/src/pspm_guide.m b/src/pspm_guide.m index 9ddf20580..d88c70243 100644 --- a/src/pspm_guide.m +++ b/src/pspm_guide.m @@ -1,7 +1,7 @@ function varargout = pspm_guide(varargin) % ● Description % pspm_guide handles the main GUI for PsPM -% ● Developer's Guide +% ● Developer % * Template % function varargout = FunctionName(hObject, eventdata, handles, varargin) % varargout cell array for returning output args (see VARARGOUT); @@ -15,7 +15,7 @@ % contents{get(hObject,'Value')} returns selected item from the list % * Hint % popupmenu controls usually have a white background on Windows. -% ● Copyright +% ● History % Introduced in PsPM 1.0 and terminated in PsPM 6.1. % Written by Dominik R Bach (Wellcome Centre for Human Neuroimaging) in 2008-2021 % Lastly updated in PsPM 6.1 by Teddy in 2022 diff --git a/src/pspm_help_init.m b/src/pspm_help_init.m index e30d70efa..be926aa61 100644 --- a/src/pspm_help_init.m +++ b/src/pspm_help_init.m @@ -1,8 +1,10 @@ function out = pspm_help_init -% pspm_help_init sets up the help texts for matlabbatch GUI. This is work -% in progress. +% ● Description +% pspm_help_init sets up the help texts for matlabbatch GUI. +% ● Developer +% This is work in progress. -% get functions list +%% get functions list [pth, fname, ext] = fileparts(mfilename('fullpath')); filelist = dir(fullfile(pth, '*.m')); diff --git a/src/pspm_import.m b/src/pspm_import.m index c74ae1469..29f5388f2 100644 --- a/src/pspm_import.m +++ b/src/pspm_import.m @@ -60,13 +60,13 @@ % └────────.overwrite : overwrite existing files by default. [logical] (0 or 1) % Define whether to overwrite existing output files or not. % Default value: determined by pspm_overwrite. -% ● Output +% ● Outputs % * outfile : [char] name of a .mat file on the input file path containing the % imported data. For datatypes that support multiple sessions % of non-contiguous data in one file (e.g. ADInstruments LabChart), % these will be saved separately, and outfile will be a cell % array of file names. -% ● Developer notes +% ● Developer % Structure of PsPM import % pspm_import is a general function for handling of import jobs. It checks % the import job, calls a datatype-specific function to extract data from diff --git a/src/pspm_init.m b/src/pspm_init.m index c8746f9f4..682944cb5 100644 --- a/src/pspm_init.m +++ b/src/pspm_init.m @@ -15,11 +15,14 @@ % 3 channel type (channeltype) definitions % 3.1 SCR % ● Arguments -% defaults -% ├─channeltypes -% ├─import -% │ └─channeltypes -% └─lateral +% ┌──defaults +% ├─.channeltypes: List of all allowed PsPM channel types (e.g., SCR, ECG, Pupil). +% ├─.import: Settings and definitions for importing various data file formats. +% └─.lateral: Defines how PsPM denotes left, right, or combined channels. +% // ... (not complete) +% ┌──defaults.import +% └─.channeltypes : Subset of channel types that are allowed for direct data import. +% // ... (not complete) % ● History % Introduced in PsPM 3.1 % Written in 2009-2015 by Dominik R Bach (WTCN, UZH) diff --git a/src/pspm_interpolate.m b/src/pspm_interpolate.m index 28358528c..59da8c6e1 100644 --- a/src/pspm_interpolate.m +++ b/src/pspm_interpolate.m @@ -29,7 +29,7 @@ % or the corresponding channel should be replaced. % [optional; accept: 'add', 'replace'; default: 'add'] % Only used if 'channel' is not 'all'. -% ● Output +% ● Outputs % * outdata : interpolated numeric array. % * channel_index : index of new channel if no new file is created % * newfile : name of new file if channel == 'all' diff --git a/src/pspm_jobman.m b/src/pspm_jobman.m index 1d7f0a55d..e0f3f9428 100644 --- a/src/pspm_jobman.m +++ b/src/pspm_jobman.m @@ -28,7 +28,7 @@ % * job_id: can be used to manipulate this job in cfg_util. Note that % changes to the job in cfg_util will not show up in cfg_ui % unless 'Update View' is called. -% ● Developer's Notes +% ● Developer % This code is based on SPM8 and earlier versions by John Ashburner, % Philippe Ciuciu and Guillaume Flandin. % ● History diff --git a/src/pspm_leaky_integrator.m b/src/pspm_leaky_integrator.m index 83fd5a302..af225d1f4 100644 --- a/src/pspm_leaky_integrator.m +++ b/src/pspm_leaky_integrator.m @@ -1,17 +1,19 @@ function filtered_data = pspm_leaky_integrator(data, tau) % ● Description % pspm_leaky_integrator applies a leaky integrator filter to the input data +% ● Format +% filtered_data = pspm_leaky_integrator(data, tau) % ● Arguments % * data: A numerical vector representing the input signal to be filtered. % * tau: The time constant of the leaky integrator, representing the % leak rate. The leak constant defines how quickly previous values % "leak out" of the integrator (or decay). A higher tau value % results in slower decay, meaning the integrator has a longer memory. -% ● Output +% ● Outputs % * filtered_data: The filtered signal, of the same size as the input data, % processed by the leaky integrator. - % Initialize the filteredData vector with the same size as input data +%% Initialize the filteredData vector with the same size as input data filtered_data = zeros(size(data)); % Start with the first value of the input data filtered_data(1) = data(1); diff --git a/src/pspm_load1.m b/src/pspm_load1.m index 55302b159..4369dcf97 100644 --- a/src/pspm_load1.m +++ b/src/pspm_load1.m @@ -26,14 +26,15 @@ % ├.zscored : zscore data - substract the mean and divide by the standard deviation. % └.overwrite : [for 'save'] [logical] (0 or 1) Define whether to overwrite existing % output files or not. Default value: determined by pspm_overwrite. -% ● Output +% ● Outputs % * data : depending on option % - none (for 'none', 'savecon', 'save') % - data.stats, data.names, (and data.trlnames if existing) (for % 'stats', 'recon', 'cond') % - con structure (for 'con') % - full first level structure (for 'all') -% ● Developer's Notes +% * mdltype : model type e.g. 'glm', 'sf', 'dcm', 'tam' +% ● Developer % General structure of PsPM 1st level model files % Each file contains one struct variable with the model % allowed model names are specified in pspm_init diff --git a/src/pspm_load_channel.m b/src/pspm_load_channel.m index cc6ab75e3..fd1c3246e 100644 --- a/src/pspm_load_channel.m +++ b/src/pspm_load_channel.m @@ -1,6 +1,6 @@ function [sts, data_struct, infos, pos_of_channel, chantype_sts] = ... pspm_load_channel(fn, channel, channeltype) -% ● Definition +% ● Description % pspm_load_channel loads a single data channel and provides integrated % channel checking logic % ● Format @@ -35,7 +35,7 @@ % 'wave', or 'events': checks whether retrieved data channel % is of the specified type and gives a warning if not % ● Outputs -% * sts : [logical] 1 as default, -1 if unsuccessful. +% * sts : [numeric] 1 as default, -1 if unsuccessful. % * data_struct : a struct with fields .data and .header, corresponding to a single % cell of a data cell array returned by pspm_load_data. % * infos : file infos as returned from pspm_load_data. @@ -44,7 +44,7 @@ % Written in 2019 by Eshref Yozdemir (University of Zurich) % Updated in 2024 by Dominik Bach (University of Bonn) % Introduced in PsPM 6.1.2 -% ● Developer's notes +% ● Developer % No checking of file and channel type here as this is done downstream in % pspm_load_data diff --git a/src/pspm_load_data.m b/src/pspm_load_data.m index ea77f4204..0c6365fe7 100644 --- a/src/pspm_load_data.m +++ b/src/pspm_load_data.m @@ -1,9 +1,10 @@ function [sts, infos, data, filestruct] = pspm_load_data(fn, channel) % ● Description -% pspm_load_data checks and returns the structure of PsPM 3-5.x and +% pspm_load_data checks and returns the structure of PsPM 3-7.x and % SCRalyze 2.x data files - SCRalyze 1.x is not supported % ● Format % [sts, infos, data, filestruct] = pspm_load_data(fn, channel) +% [sts, infos, data, filestruct] = pspm_load_data(fn) % ● Arguments % * fn: [char] filename / [struct] with fields % ┌──────fn @@ -25,7 +26,7 @@ % returns the respective channels (see settings for % permissible channel types) % 'none' just checks the file -% ▶ struct check and save file +% ▶ struct check and save file % ┌────channel % ├───.infos: (mandatory) % ├────.data: (mandatory) @@ -41,7 +42,7 @@ % ├───.posofmarker: position of the first marker channel % │ 0 if no marker channel exists % └─.posofchannels: number of the channels that were returned -% ● Developer's Notes +% ● Developer % General structure of PsPM data files % Each file contains two variables: % infos - struct variable with general infos diff --git a/src/pspm_logical2epochs.m b/src/pspm_logical2epochs.m index 794ceda4e..af507547b 100644 --- a/src/pspm_logical2epochs.m +++ b/src/pspm_logical2epochs.m @@ -1,34 +1,34 @@ function epochs = pspm_logical2epochs(index, sr) - % ● Description - % logical2pspm_epochs converts a logical index vector into an nx2 - % onset/offset epoch matrix. - % ● Format - % epochs = logical2pspm_epochs(index, sr) - % ● Arguments - % * index : [logical] index vector of length datalength - % * sr : sample rate used when index was created - % - % ● Output - % * epochs : nx2 (onset/offset) epoch matrix - % ● History - % Written in 2024 by Bernhard Agoué von Raußendorf +% ● Description +% logical2pspm_epochs converts a logical index vector into an nx2 +% onset/offset epoch matrix. +% ● Format +% epochs = logical2pspm_epochs(index, sr) +% ● Arguments +% * index : [logical] index vector of length datalength +% * sr : sample rate used when index was created +% +% ● Outputs +% * epochs : nx2 (onset/offset) epoch matrix +% ● History +% Written in 2024 by Bernhard Agoué von Raußendorf - - % Compute the differences between consecutive elements in the index array, - % with padding at the start and end - diff_index = diff([0; index(:); 0]); - - % Onsets are where the difference is 1 (0 to 1 transition) - onsets = find(diff_index == 1); - - % Offsets are where the difference is -1 (1 to 0 transition) - offsets = find(diff_index == -1); - - % Combine onsets and offsets into an nx2 matrix - epochs = double([onsets, offsets]); +%% +% Compute the differences between consecutive elements in the index array, +% with padding at the start and end +diff_index = diff([0; index(:); 0]); - % If the sample rate (sr) is not 1, convert indices back to time - if nargin > 1 && sr ~= 1 - epochs = (epochs - 1) / sr; - end +% Onsets are where the difference is 1 (0 to 1 transition) +onsets = find(diff_index == 1); + +% Offsets are where the difference is -1 (1 to 0 transition) +offsets = find(diff_index == -1); + +% Combine onsets and offsets into an nx2 matrix +epochs = double([onsets, offsets]); + +% If the sample rate (sr) is not 1, convert indices back to time +if nargin > 1 && sr ~= 1 + epochs = (epochs - 1) / sr; +end end \ No newline at end of file diff --git a/src/pspm_merge.m b/src/pspm_merge.m index bc24ff614..10abfdb5f 100644 --- a/src/pspm_merge.m +++ b/src/pspm_merge.m @@ -23,6 +23,10 @@ % as a reference. Ignored if reference is specified % as 'file'. If undefined or 0, the first marker % channel of either file is used +% ● Outputs +% * sts : status flag (-1 or 1) +% * outfile : path of the merged file (char). +% Empty if not successfully merged. % ● History % Introduced In PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (UZH, WTCN) diff --git a/src/pspm_msg.txt b/src/pspm_msg.txt index 218ba2cff..4d3cc63d4 100644 --- a/src/pspm_msg.txt +++ b/src/pspm_msg.txt @@ -1,6 +1,6 @@ $___________________________________________________________________________ Welcome to PsPM (Psychophysiological Modelling) -Version 7.0 (xx.xx.2025) +Version 7.0 (12.02.2025) $ ------------------------------------------ (c) 2008-2025 diff --git a/src/pspm_multi_channel.m b/src/pspm_multi_channel.m index 18b82baad..063a4a4a9 100644 --- a/src/pspm_multi_channel.m +++ b/src/pspm_multi_channel.m @@ -5,7 +5,7 @@ % function multiple times and so does accelerate processing time. It % creates the required loop and handles any processing errors. % ● Format -% [sts, channel_index] = pspm_multi_channel(function, channels, argument1, argument2, ..., options) +% [sts, channel_index] = pspm_multi_channel(fhandle, channels, argument1, argument2, ..., options) % ● Arguments % * fhandle : [char or function handle] Preprocessing function % * channels : [char, vector, cell array] Channel specifications: @@ -22,7 +22,7 @@ % the specified channels exactly. % * argument1 : all input arguments for the pre-processing function % * options : must always be specified as the last input argument -% ● Output +% ● Outputs % * sts : Status determining whether the execution was % successful (sts == 1) or not (sts == -1) % * channel_index : Index of the generated channels. Any unsuccesful pre-processing diff --git a/src/pspm_options.m b/src/pspm_options.m index f53d4a6b6..c39fb4ba5 100644 --- a/src/pspm_options.m +++ b/src/pspm_options.m @@ -1,10 +1,12 @@ function options = pspm_options(options, FunName) -% ● Definition +% ● Description % pspm_options automatically determine the fields of options for the % corresponding function. % ● Arguments -% options: a struct to be filled by the function -% FunName: a string, the name of the function where option is used +% * options: a struct to be filled by the function +% * FunName: a string, the name of the function where option is used +% ● Outputs +% * options: a struct containing the options for the specified function. % ● History % Introduced in PsPM 6.1 % Written in 2022 by Teddy diff --git a/src/pspm_pp.m b/src/pspm_pp.m index 77960e24d..f04bcf33e 100644 --- a/src/pspm_pp.m +++ b/src/pspm_pp.m @@ -36,7 +36,7 @@ % [optional][string][Accepts: 'add'/'replace'][Default: 'add'] Defines % whether corrected data should be added or the corresponding preprocessed % channel should be replaced. -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % ● History % Introduced in PsPM 3.0 diff --git a/src/pspm_prepdata.m b/src/pspm_prepdata.m index a3449b6d9..bb511b423 100644 --- a/src/pspm_prepdata.m +++ b/src/pspm_prepdata.m @@ -19,7 +19,7 @@ % └─────.down: sample rate in Hz after downsampling or 'none' % ┌───options % └──.fillnan: 0/1 specify whether to fill nan if there is. Default: 1 -% ● Developer's Notes +% ● Developer % Note that the order for bandpass and bandstop filters is equal to % order = lporder + hporder % the new sample rate is returned as newsr because downsampling might fail diff --git a/src/pspm_pull_zenodo.m b/src/pspm_pull_zenodo.m index 5bbbd4ef9..44732c788 100644 --- a/src/pspm_pull_zenodo.m +++ b/src/pspm_pull_zenodo.m @@ -1,6 +1,13 @@ function sts = pspm_pull_zenodo(ID, datapath) % ● Description % pspm_pull_zenodo pulls data from zenodo.org +% ● Format +% sts = pspm_pull_zenodo(ID, datapath) +% ● Arguments +% * ID: ID of the dataset on Zenodo (numeric) +% * datapath: directory where the downloaded files will be stored (string) +% ● Outputs +% * sts: status flag fprintf('Pulling data set %i from zenodo.org\n', ID); mkdir(datapath); diff --git a/src/pspm_pulse_convert.m b/src/pspm_pulse_convert.m index 35f5b5b1a..ead25f22a 100644 --- a/src/pspm_pulse_convert.m +++ b/src/pspm_pulse_convert.m @@ -2,7 +2,7 @@ % ● Description % pspm_pulse_convert converts pulsed data into a data waveform, assuming % milliseconds as time unit and a resamplingrate in Hz given as input argument -% ● Developer's Notes +% ● Developer % This function is designed for data from CED spike, recorded by CED Micro % 1401. These data should not normally exceed pulse frequencies of 10 kHz, % corresponding to a pulse time stamp difference of 0.1 ms. Smaller values diff --git a/src/pspm_pupil_correct.m b/src/pspm_pupil_correct.m index b2eb995a5..0492ddee2 100644 --- a/src/pspm_pupil_correct.m +++ b/src/pspm_pupil_correct.m @@ -29,7 +29,7 @@ % screen if they have same x and y coordinates. (Unit: mm) % ● Outputs % * pupil_corrected: PFE corrected pupil data. (Unit: unit of the input pupil data) -% ● Developer's Notes +% ● Developer % geometry_setup is a struct with the geometry setup fields. When defining these % coordinate system parameters, we assume that the origin O of the 3D coordinate system % is the center of the pupil. diff --git a/src/pspm_pupil_pp.m b/src/pspm_pupil_pp.m index 71603e3c7..294b05539 100644 --- a/src/pspm_pupil_pp.m +++ b/src/pspm_pupil_pp.m @@ -85,7 +85,7 @@ % ├─────.end : [decimal][Unit: second] Ending time of the segment. % ├────.name : [string] Name of the segment. Segment will be stored by this name. % ├.plot_data: [Boolean][Default: false or 0] Plot the preprocessing steps. -% ├─.chan_valid_cutoff : [optional][Default: 0.01] +% ├─.chan_valid_cutoff : [optional][Default: 0.2] % │ A cut-off value for checking whether there are too many missing values % │ in a data channel for combination. If the difference in % │ missing data percentage between the two channels exceeds @@ -116,18 +116,25 @@ if nargin == 1 options = struct(); end + + options = pspm_options(options, 'pupil_pp'); if options.invalid return end -[lsts, default_settings] = pspm_pupil_pp_options(); + +% when batch editor has default settings +if ~isfield(options,'custom_settings') + [lsts, default_settings] = pspm_pupil_pp_options(); % so no warnings are displayed +else + [lsts, default_settings] = pspm_pupil_pp_options(options.custom_settings); +end + + if lsts ~= 1 return end -if isfield(options, 'custom_settings') - default_settings = pspm_assign_fields_recursively(... - default_settings, options.custom_settings); -end + options.custom_settings = default_settings; %% 3 Input checks @@ -352,16 +359,3 @@ end end end -function out_struct = pspm_assign_fields_recursively(out_struct, in_struct) -% Definition -% pspm_assign_fields_recursively assign all fields of in_struct to -% out_struct recursively, overwriting when necessary. -fnames = fieldnames(in_struct); -for i = 1:numel(fnames) - name = fnames{i}; - if isstruct(in_struct.(name)) && isfield(out_struct, name) - out_struct.(name) = pspm_assign_fields_recursively(out_struct.(name), in_struct.(name)); - else - out_struct.(name) = in_struct.(name); - end -end diff --git a/src/pspm_pupil_pp_options.m b/src/pspm_pupil_pp_options.m index 4e4713ef8..ee4670be7 100644 --- a/src/pspm_pupil_pp_options.m +++ b/src/pspm_pupil_pp_options.m @@ -1,12 +1,12 @@ -function [sts, default_settings] = pspm_pupil_pp_options() +function [sts, default_settings] = pspm_pupil_pp_options(custom_settings) % ● Description % pspm_pupil_pp_options is a helper function that can be used to modify the % behaviour of pspm_pupil_pp function. This function returns the settings % structure used by pspm_pupil_pp for pupil preprocessing. You can modify the % returned structure and then pass it to pspm_pupil_pp. See below for % explanation of the parameters. Adapted from: -% - pspm/pupil-size/code/helperFunctions/rawDataFilter.m lines 63 to 149, -% - pspm/pupil-size/code/dataModels/ValidSamplesModel.m lines 357 to 373. +% - src/ext/pupil-size/code/helperFunctions/rawDataFilter.m lines 63 to 149, +% - src/ext/pupil-size/code/dataModels/ValidSamplesModel.m lines 357 to 373. % ● Format % [sts, default_settings] = pspm_pupil_pp_options() % ● Outputs @@ -90,39 +90,124 @@ % │ Cutoff frequency for first order Butterworth filter. % │ (Default: 16 Hz) % │ +% ├─residualsFilter_lowpassB: +% │ Numerator (B) coefficients of the first-order +% │ Butterworth filter used in the residuals filter passes. +% │ Automatically computed from residualsFilter_lowpassCF +% │ and residualsFilter_interpFs. +% ├─residualsFilter_lowpassA: +% │ Denominator (A) coefficients of the first-order +% │ Butterworth filter used in the residuals filter +% │ passes. Automatically computed. +% │ % │ // Keep filter data % │ -% └─keepFilterData: If true, intermediate filter data will be stored. +% └───────keepFilterData:If true, intermediate filter data will be stored. % Set to false to save memory and improve plotting % performance. (Default: true) -% -% // Final data smoothing -% +% % ┌───────────────valid % ├interp_upsamplingFreq:The upsampling frequency used to generate the smooth % │ signal. (Default: 1000 Hz) -% ├───LpFilt_cutoffFreq: Cutoff frequency of the lowpass filter used during -% │ final smoothing. (Default: 4 Hz) -% ├────────LpFilt_order: Filter order of the lowpass filter used during final -% │ smoothing. (Default: 4) -% └───────interp_maxGap: Maximum gap in the used (valid) raw samples to -% interpolate over. Sections that were interpolated -% over distances larger than this value will be set -% to NaN. (Default: 250 ms) +% ├───────interp_maxGap: Maximum gap in the used (valid) raw samples to +% │ interpolate over. Sections that were interpolated +% │ over distances larger than this value will be set +% │ to NaN. (Default: 250 ms) +% │ +% │ // For final data smoothing, the below computation is performed: +% │ // [LpFilt_B, LpFilt_A] = butter(LpFilt_order, ... +% │ // 2*LpFilt_cutoffFreq/interp_upsamplingFreq ); +% │ +% ├────LpFilt_cutoffFreq:The cutoff frequency (in Hz) for the low-pass Butterworth filter +% │ that is applied to the upsampled signal. (Default: 4 Hz) +% ├─────────LpFilt_order:The order of the Butterworth filter used on the +% │ upsampled signal. (Default: 4) +% ├─────────────LpFilt_B:The numerator coefficients of the digital Butterworth +% │ low-pass filter. Automatically computed. +% └─────────────LpFilt_A:The denominator coefficients of the digital +% Butterworth low-pass filter. Automatically computed. +% +% % ● History % Introduced In PsPM version ?. % Written in 2019 by Eshref Yozdemir (University of Zurich) % Maintained in 2022 by Teddy +% Maintained in 2024 by Bernhard von Raußendorf global settings if isempty(settings) pspm_init; end + sts = -1; +default_settings = struct(); + +if nargin < 1 + flag = 0; +elseif ~isstruct(custom_settings) + warning('Input must be a struct. Returning default settings.'); + flag = 0; +else + flag = 1; +end + + + +if nargin == 1 && flag == 1 + + reqFieldsRaw = {'residualsFilter_interpFs','residualsFilter_lowpassCF'}; + if isfield(custom_settings,'raw') && all(isfield(custom_settings.raw, reqFieldsRaw)) + % from src/ext/pupil-size/code/helperFunctions/rawDataFilter.m + + [custom_settings.raw.residualsFilter_lowpassB , custom_settings.raw.residualsFilter_lowpassA] ... + = butter(1 , custom_settings.raw.residualsFilter_lowpassCF/(custom_settings.raw.residualsFilter_interpFs/2) ); + else + warning('Missing required fields in custom_settings.raw: Default filter coefficients will be used.'); % change + end + + reqFieldsValid = {'LpFilt_cutoffFreq','interp_upsamplingFreq','LpFilt_order'}; + if isfield(custom_settings,'valid') && all(isfield(custom_settings.valid, reqFieldsValid)) + % settingsOut = getDefaultSettings() from ValidSamplesModel + [custom_settings.valid.LpFilt_B, custom_settings.valid.LpFilt_A] = butter(custom_settings.valid.LpFilt_order, ... + 2*custom_settings.valid.LpFilt_cutoffFreq/custom_settings.valid.interp_upsamplingFreq ); + else + warning('Missing required fields in custom_settings.valid: Default filter coefficients will be used.'); % change + end + +end + + libbase_path = pspm_path('ext','pupil-size', 'code'); libpath = {fullfile(libbase_path, 'dataModels'), fullfile(libbase_path, 'helperFunctions')}; addpath(libpath{:}); default_settings = PupilDataModel.getDefaultSettings(); + +% gets +default_settings.valid.LpFilt_cutoffFreq = 4; % could also be added to the default_settings in ValidSamplesModel +default_settings.valid.LpFilt_order = 4; % could also be added to the default_settings in ValidSamplesModel + +if nargin == 1 && flag == 1 + default_settings = pspm_assign_fields_recursively(default_settings, custom_settings); +end + + rmpath(libpath{:}); sts = 1; return +end + +function out_struct = pspm_assign_fields_recursively(out_struct, in_struct) +% Definition +% pspm_assign_fields_recursively assign all fields of in_struct to +% out_struct recursively, overwriting when necessary. +fnames = fieldnames(in_struct); +for i = 1:numel(fnames) + name = fnames{i}; + if isstruct(in_struct.(name)) && isfield(out_struct, name) + out_struct.(name) = pspm_assign_fields_recursively(out_struct.(name), in_struct.(name)); + else + out_struct.(name) = in_struct.(name); + end +end + +end \ No newline at end of file diff --git a/src/pspm_remove_epochs.m b/src/pspm_remove_epochs.m index 3714b8ae7..ddfa5a59a 100644 --- a/src/pspm_remove_epochs.m +++ b/src/pspm_remove_epochs.m @@ -16,7 +16,7 @@ % │ corresponding channels should be replaced. The default value is 'add'. % └─.expand_epochs: [pre, post] % -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % ● History % Introduced in PsPM 4.0 diff --git a/src/pspm_rename.m b/src/pspm_rename.m index 179249dcf..c00de55b2 100644 --- a/src/pspm_rename.m +++ b/src/pspm_rename.m @@ -10,6 +10,10 @@ % ┌─────options % └──.overwrite : [Optional, logical] overwrite existing file by default % The default value is determined by pspm_overwrite. +% ● Outputs +% * sts : status flag (-1 or 1) +% * outfile : path of the renamed file (char). +% Empty if not successfully merged. % ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (Wellcome Trust Centre for Neuroimaging) diff --git a/src/pspm_resp_pp.m b/src/pspm_resp_pp.m index 9ee34c6dd..64475b8e1 100644 --- a/src/pspm_resp_pp.m +++ b/src/pspm_resp_pp.m @@ -34,7 +34,7 @@ % └.channel_action: ['add'(default) /'replace'] % Defines whether the new channels should be added or the % corresponding channel should be replaced. -% ● Output +% ● Outputs % * channel_index: index of channel containing the processed data % % ● References diff --git a/src/pspm_rev_con.m b/src/pspm_rev_con.m index e7dbdde34..1f8150784 100644 --- a/src/pspm_rev_con.m +++ b/src/pspm_rev_con.m @@ -23,14 +23,14 @@ elseif ~isfield(model, 'con') fprintf('No contrasts contained in model.\n'); return; -end; +end % print contrast names to screen % ------------------------------------------------------------------------ fprintf('Contrast names for %s:\n---------------------------------------\n', model.modelfile); for n=1:numel(model.con) fprintf('Contrast %d: %s\n',n,model.con(n).name); -end; +end fprintf('---------------------------------------\n'); sts = 1; diff --git a/src/pspm_rev_dcm.m b/src/pspm_rev_dcm.m index 44a35891c..aabe6899d 100644 --- a/src/pspm_rev_dcm.m +++ b/src/pspm_rev_dcm.m @@ -2,7 +2,7 @@ % ● Description % pspm_rev_dcm displays DCM results post hoc. It is meant to be called by % pspm_review only. -% ● Developer's Notes +% ● Developer % The development of this funcrion is still in progress. % More jobs to be implemented. % ● Format @@ -37,7 +37,7 @@ end sts = -1; -try, sn; catch, sn = 1; end; +try, sn; catch, sn = 1; end if ischar(dcm) [~, dcm, ~] = pspm_load1(dcm, 'all'); @@ -54,7 +54,7 @@ warning('Session %1.0f does not exist', sn); return; elseif strcmpi(job, 'inv') && numel(dcm.sn{sn}.u) < trl warning('Trial %1.0f in session %1.0f does not exist', trl, sn); return; - end; + end end @@ -89,7 +89,7 @@ win = floor(sr * ((trlstart(n)):(1/sr):(trlstart(n + 1)))); else win = floor(sr * ((trlstart(n)):(1/sr):(numel(yhat)/sr))); - end; + end win(win == 0) = []; data = [y(win), yhat(win)]; subplot(f.r, f.c, n); @@ -97,7 +97,7 @@ xt = get(gca, 'XTick'); set(gca, 'XTickLabel', xt / dcm.input.sr); set(gca, 'YLim', [min(yhat), max(yhat)]); - end; + end % display scrf % --------------------------------------------------------------------- case 'scrf' @@ -112,7 +112,7 @@ Theta = [dcm.sn{sn}.prior.theta 1]; for x = 1:size(ut, 2) xt(x + 1, :) = f_SCR(xt(x, :), Theta, ut(:, x), in); - end; + end figure; plot(xt(:, 1)); set(gca, 'YTick', [], 'XTick', 0:50:300, 'XTickLabel', 0:5:30, 'FontWeight', 'Bold', 'FontSize', 12); set(get(gca, 'Title'), 'String', 'Skin conductance response function', 'FontWeight', 'Bold', 'FontSize', 16); @@ -120,19 +120,19 @@ fprintf('Trial names for %s:\n---------------------------------------\n', dcm.dcmname); for n=1:numel(dcm.trlnames) fprintf('Trial %d: %s\n',n,dcm.trlnames{n}); - end; + end fprintf('---------------------------------------\n'); fprintf('Condition names for %s:\n---------------------------------------\n', dcm.dcmname); for n=1:numel(dcm.condnames) fprintf('Condition %d: %s\n',n,dcm.condnames{n}); - end; + end fprintf('---------------------------------------\n'); case 'seg' options = struct('plot', 1); [ssts, segments] = pspm_extract_segments('model', dcm, options); -end; +end sts = 1; return diff --git a/src/pspm_scr_pp.m b/src/pspm_scr_pp.m index 36e253bf4..1712c551b 100644 --- a/src/pspm_scr_pp.m +++ b/src/pspm_scr_pp.m @@ -141,63 +141,71 @@ warning('ID:invalid_input', 'Argument ''data'' should contain > 1 data points.'); return; end + %% Create filters +% filt == 1 if sample is valid and filt == 0 if it is invalid data_changed = NaN(size(indata)); filt_range = indata < options.max & indata > options.min; filt_slope = true(size(indata)); filt_slope(2:end) = abs(diff(indata)*sr) < options.slope; if (options.deflection_threshold ~= 0) && ~all(filt_slope==1) - slope_epochs = filter_to_epochs(filt_slope); + slope_epochs = pspm_logical2epochs(1-filt_slope); % sr = 1 for r = transpose(slope_epochs) if range(indata(r(1):r(2))) < options.deflection_threshold filt_slope(r(1):r(2)) = 1; end end end -[filt_clipping, filt_baseline] = detect_clipping_baseline(indata, options.clipping_step_size, ... +[index_clipping, index_baseline] = detect_clipping_baseline(indata, options.clipping_step_size, ... options.clipping_window_size, options.baseline_jump, options.clipping_threshold); if options.include_baseline - filt_clipping = filt_clipping | filt_baseline; + filt_clipping = 1 - (index_clipping | index_baseline); +else + filt_clipping = 1-index_clipping; end -% combine filters +% combine filters: filt = filt_range & filt_slope; filt = filt & (1-filt_clipping); + + %% Find data islands and expand artefact islands if isempty(find(filt==0, 1)) warning('Epoch was empty based on the current settings.'); else if options.data_island_threshold > 0 || options.expand_epochs > 0 + % work out data epochs - filt_epochs = filter_to_epochs(1-filt); % gives data (rather than artefact) epochs + missing_epochs = pspm_logical2epochs(1-filt,sr); % gives NaN (artefact) epochs + if options.expand_epochs > 0 - % remove data epochs too short to be shortened - epoch_duration = diff(filt_epochs, 1, 2); - filt_epochs(epoch_duration < 2 * ceil(options.expand_epochs * sr), :) = []; - % shorten data epochs - filt_epochs(:, 1) = filt_epochs(:, 1) + ceil(options.expand_epochs * sr); - filt_epochs(:, 2) = filt_epochs(:, 2) - ceil(options.expand_epochs * sr); + exp = options.expand_epochs; + [lsts, missing_epochs] = pspm_expand_epochs(missing_epochs, [exp,exp]); + if lsts < 1, return, end end - % correct possibly negative values - filt_epochs(filt_epochs(:, 2) < 1, 2) = 1; + + missing_index = pspm_epochs2logical(missing_epochs,length(indata) ,sr); + data_epochs = pspm_logical2epochs(1-missing_index,sr); + + % island threshold if options.data_island_threshold > 0 - epoch_duration = diff(filt_epochs, 1, 2); - filt_epochs(epoch_duration < options.data_island_threshold * sr, :) = []; + epoch_duration = diff(data_epochs, 1, 2); + data_epochs(epoch_duration < options.data_island_threshold * sr, :) = []; end + % write back into data - index(filt_epochs(:, 1)) = 1; - index(filt_epochs(:, 2)) = -1; - filt = (cumsum(index(:)) == 1); - % (thanks Jan: https://www.mathworks.com/matlabcentral/answers/ - % 324955-replace-multiple-intervals-in-array-with-nan-no-loops) + filt = pspm_epochs2logical(data_epochs, length(indata), sr); + filt = logical(filt); + end + end data_changed(filt) = indata(filt); -% Compute epochs + +% Compute epochs missing if ~isempty(find(filt == 0, 1)) - epochs = filter_to_epochs(filt); - epochs = epochs / sr; %convert into seconds + epochs_missing = pspm_logical2epochs(1-filt,sr); else - epochs = []; + epochs_missing = []; end %% Save data if ~isempty(options.missing_epochs_filename) @@ -206,7 +214,7 @@ warning('ID:invalid_input', 'Missing epoch file exists, and overwriting not allowed by user.'); return else - save(options.missing_epochs_filename, 'epochs'); + save(options.missing_epochs_filename, 'epochs_missing'); out = options.missing_epochs_filename; end else @@ -225,22 +233,7 @@ sts = 1; % sts is true if all processing above is successful return -function epochs = filter_to_epochs(filt) % Return the start and end points of the excluded interval -epoch_on = find(diff(filt) == -1) + 1; % Return the start points of the excluded interval -epoch_off = find(diff(filt) == 1); % Return the end points of the excluded interval -if ~isempty(epoch_on) && ~isempty(epoch_off) - if (epoch_on(end) > epoch_off(end)) % ends on - epoch_off = [epoch_off; length(filt)]; % Include the end point of the whole data sequence - end - if (epoch_on(1) > epoch_off(1)) % starts on - epoch_on = [ 1; epoch_on ]; % Include the start point of the whole data sequence - end -elseif ~isempty(epoch_on) && isempty(epoch_off) - epoch_off = length(filt); -elseif isempty(epoch_on) && ~isempty(epoch_off) - epoch_on = 1; -end -epochs = [ epoch_on, epoch_off ]; + function [index_clipping, index_baseline] = detect_clipping_baseline(data, step_size, window_size, jump, threshold) l_data = length(data); diff --git a/src/pspm_sf.m b/src/pspm_sf.m index 628fb36e6..af4a3e89d 100644 --- a/src/pspm_sf.m +++ b/src/pspm_sf.m @@ -1,31 +1,31 @@ function [sts, sf] = pspm_sf(model, options) % ● Description % pspm_sf is a wrapper function for analysis of skin conductance as a -% measure of tonic arousal. SF are analysed over time windows that -% typically last 60 s and should at least be 15 s long. PsPM implements 3 -% different models. +% measure of tonic arousal. SF are analysed over time windows that +% typically last 60 s and should at least be 15 s long. PsPM implements 3 +% different models. % (1) Skin conductance level (SCL): this is the mean signal over the % epoch. % (2) Area under the curve (AUC): this is the time-integral of the signal % with the minimum value subtracted (to account for pre-epoch arousal), -% divided by epoch duration. This is designed to be independent from SCL -% and ideally represents the number x amplitude of spontaneous -% fluctuations (also termed non-specific SCR) in this epoch. -% (3) Number of SF estimated by DCM: this is a non-linear estimation of -% the number and onset of SF, and is the most sensitive indicator of +% divided by epoch duration. This is designed to be independent from SCL +% and ideally represents the number x amplitude of spontaneous +% fluctuations (also termed non-specific SCR) in this epoch. +% (3) Number of SF estimated by DCM: this is a non-linear estimation of +% the number and onset of SF, and is the most sensitive indicator of % tonic arousal. For counting peaks, a threshold in mcS is applied; hence -% it is important that the data are provided in the correct units. Estimated -% SF onset is stored in the model and is expressed in CNS time, i.e. the -% time point at which an SF was generated in the CNS. Thus, it already +% it is important that the data are provided in the correct units. Estimated +% SF onset is stored in the model and is expressed in CNS time, i.e. the +% time point at which an SF was generated in the CNS. Thus, it already % takes into account the conduction delay from CNS into the periphery. % (4) Number of SF estimated by MP: This is the same model as in (3) but -% estimated with an approximative matching pursuit (MP) algorithm. +% estimated with an approximative matching pursuit (MP) algorithm. % ● Format % [sts, sf] = pspm_sf(model, options) % ● Arguments % ┌──────────model -% ├──────.datafile : one data filename or cell array of filenames. -% ├─────.modelfile : one data filename or cell array of filenames. +% ├──────.datafile : one data filename +% ├─────.modelfile : one model filename % ├────────.timing : can be one of the following % │ - an SPM style onset file with two event types: onset & % │ offset (names are ignored) @@ -40,10 +40,9 @@ % │ [string] accept 'auc', 'scl', 'dcm', or 'mp', default as 'dcm'. % │ [cell_array] a cell array of methods mentioned above. % ├────────.filter : [optional] filter settings; modality specific default -% ├───────.missing : [optional, string/cell_array] [default: no missing values] +% ├───────.missing : [optional, string] [default: no missing values] % │ Allows to specify missing (e.g. artefact) epochs in the data file. -% │ See pspm_get_timing for epoch definition; specify a cell array -% │ for multiple input files. This must always be specified in SECONDS. +% │ See pspm_get_timing for epoch definition. This must always be specified in SECONDS. % └───────.channel : [optional, integer, default: last SCR channel] Channel number. % ┌────────options % ├─────.overwrite : [logical, default: determined by pspm_overwrite] @@ -59,13 +58,15 @@ % │ (Maximum) frequency (in Hz) of responses in the model. % │ (Used for DCM and MP only.) % ├───────.dispwin : [logical, default: 1] -% │ Display progress plot (DCM) or result plot (MP). +% │ Display progress plot (DCM) or result plot (MP). % ├──.dispsmallwin : [logical, default: 0] % │ Display intermediate progress windows. (Used for DCM only.) % └─.missingthresh : [numeric, default: 2] [unit: second] % Threshold value for controlling missing epochs. % (Used for DCM only). -% +% ● Outputs +% * sts : Status flag. +% * sf : Results structure. % ● References % [1] DCM for SF: % Bach DR, Daunizeau J, Kuelzow N, Friston KJ, Dolan RJ (2010). Dynamic @@ -80,10 +81,10 @@ % quantification of arousal from spontanaeous skin conductance % fluctuations. International Journal of Psychophysiology, 76, 52-55. % -% ● Developer's Note +% ● Developer % the output also contains a field .time that contains the inversion time % in ms (for DCM and MP) -% ● Copyright +% ● History % Introduced in PsPM 3.0 % Written in 2008-2015 by Dominik R Bach (WCHN, UCL and UZH) % Maintained in 2022 by Teddy @@ -91,7 +92,7 @@ %% 1 Initialise global settings if isempty(settings) - pspm_init; + pspm_init; end outfile = []; sts = -1; @@ -102,182 +103,166 @@ if nargin < 1; errmsg = 'Nothing to do.'; warning('ID:invalid_input', errmsg); return elseif nargin < 2; options = struct(); end -% 2.2 check model -model = pspm_check_model(model, 'sf'); -if model.invalid +% 2.2 check model and options +[model, options] = pspm_check_model(model, options, 'sf'); +if model.invalid || options.invalid return end -% 2.3 check options -options = pspm_options(options, 'sf'); -if options.invalid - return -end - -% 2.4 check files -% stop the script if files are not allowed to overwrite -if ~pspm_overwrite(model.modelfile, options) - return -end +model.timing = model.timing{1}; +model.datafile = model.datafile{1}; +model.missing = model.missing{1}; %% 3. Parse methods method = cell(numel(model.method), 1); fhandle = method; datatype = NaN(numel(model.method)); for k = 1:numel(model.method) -switch model.method{k} - case {'auc', 'AUC'} - method{k} = 'auc'; - fhandle{k} = @pspm_sf_auc; - datatype(k) = 2; % filtered - case {'DCM', 'dcm'} - method{k} = 'dcm'; - fhandle{k} = @pspm_sf_dcm; - datatype(k) = 2; % filtered - case {'MP', 'mp'} - method{k} = 'mp'; - fhandle{k} = @pspm_sf_mp; - datatype(k) = 2; % filtered - case {'SCL', 'scl', 'level'} - method{k} = 'scl'; - fhandle{k} = @pspm_sf_scl; - datatype(k) = 1; % unfiltered - case 'all' - method = {'scl', 'auc', 'dcm', 'mp'}; - fhandle = {@pspm_sf_scl, @pspm_sf_auc, @pspm_sf_dcm, @pspm_sf_mp}; - datatype = [1 2 2 2]; - otherwise - warning('Method %s not supported', model.method{k}); return; -end + switch model.method{k} + case {'auc', 'AUC'} + method{k} = 'auc'; + fhandle{k} = @pspm_sf_auc; + datatype(k) = 2; % filtered + case {'DCM', 'dcm'} + method{k} = 'dcm'; + fhandle{k} = @pspm_sf_dcm; + datatype(k) = 2; % filtered + case {'MP', 'mp'} + method{k} = 'mp'; + fhandle{k} = @pspm_sf_mp; + datatype(k) = 2; % filtered + case {'SCL', 'scl', 'level'} + method{k} = 'scl'; + fhandle{k} = @pspm_sf_scl; + datatype(k) = 1; % unfiltered + case 'all' + method = {'scl', 'auc', 'dcm', 'mp'}; + fhandle = {@pspm_sf_scl, @pspm_sf_auc, @pspm_sf_dcm, @pspm_sf_mp}; + datatype = [1 2 2 2]; + otherwise + warning('Method %s not supported', model.method{k}); return; + end end + % 2.6 Get timing -- if strcmpi(model.timeunits, 'whole') - epochs = repmat({[1 1]}, numel(model.datafile), 1); + epochs = [1 1]; else - for iFile = 1:numel(model.datafile) - [sts, epochs{iFile}] = pspm_get_timing('epochs', model.timing{iFile}, model.timeunits); - end + [sts, epochs] = pspm_get_timing('epochs', model.timing, model.timeunits); end -options = pspm_options(options, 'sf'); -if options.invalid - return -end %% 3 Get data -nFile = numel(model.datafile); -for iFile = 1:nFile - % 3.1 User output - fprintf('SF analysis: %s ...', model.datafile{iFile}); +% 3.1 User output +fprintf('SF analysis: %s ...', model.datafile); - % 3.2 get and filter data -- - [sts_load_data, data] = pspm_load_channel(model.datafile{iFile}, model.channel, 'scr'); - if sts_load_data < 0, return; end - y{1} = data.data; - sr(1) = data.header.sr; - model.filter.sr = sr(1); - [sts_prepdata, y{2}, sr(2)] = pspm_prepdata(y{1}, model.filter); - % always use last data channels - if sts_prepdata == -1 +% 3.2 get and filter data -- +[sts_load_data, data] = pspm_load_channel(model.datafile, model.channel, 'scr'); +if sts_load_data < 0, return; end +y{1} = data.data; +sr(1) = data.header.sr; +model.filter.sr = sr(1); +[sts_prepdata, y{2}, sr(2)] = pspm_prepdata(y{1}, model.filter); +% always use last data channels +if sts_prepdata == -1 warning('ID:invalid_input', 'Call of pspm_prepdata failed.'); return; - end - % 3.3 Check data units - if ~strcmpi(data.header.units, 'uS') && any(strcmpi('dcm', method)) +end +% 3.3 Check data units +if ~strcmpi(data.header.units, 'uS') && any(strcmpi('dcm', method)) fprintf(['\nYour data units are stored as %s, ',... - 'and the method will apply an amplitude threshold in uS. ',... - 'Please check your results.\n'], ... - data.header.units); - end - % 3.4 Get missing epochs -- - if ~isempty(model.missing{iFile}) - [~, missing{iFile}] = pspm_get_timing('missing', model.missing{iFile}, 'seconds'); + 'and the method will apply an amplitude threshold in uS. ',... + 'Please check your results.\n'], ... + data.header.units); +end +% 3.4 Get missing epochs -- +if ~isempty(model.missing) + [~, missing{iFile}] = pspm_get_timing('missing', model.missing, 'seconds'); model.missing_data = zeros(size(y{2})); - missing_index = pspm_time2index(missing{iFile}, sr(datatype(k))); + missing_index = pspm_time2index(missing, sr(datatype(k))); model.missing_data((missing_index(:,1)+1):(missing_index(:,2)+1)) = 1; - else - missing{iFile} = []; - end - % 3.5 Get marker data -- - if any(strcmp(model.timeunits, {'marker', 'markers'})) - [sts, ndata] = pspm_load_channel(model.datafile{iFile}, options.marker_chan_num, 'marker'); +else + missing= []; +end +% 3.5 Get marker data -- +if any(strcmp(model.timeunits, {'marker', 'markers'})) + [sts, ndata] = pspm_load_channel(model.datafile, options.marker_chan_num, 'marker'); if sts < 1, return; end events{iFile} = ndata.data(:); - end +end - for iEpoch = 1:size(epochs{iFile}, 1) +for iEpoch = 1:size(epochs, 1) if iEpoch > 1, fprintf('\n\t\t\t'); end fprintf('epoch %01.0f ...', iEpoch); for k = 1:numel(method) - fprintf('%s ', method{k}); - switch model.timeunits - case 'seconds' - win = round(epochs{iFile}(iEpoch, :) * sr(datatype(k))); - case 'samples' - win = round(epochs{iFile}(iEpoch, :) * sr(datatype(k)) / sr(1)); - case 'markers' - win = round(events{iFile}(epochs{iFile}(iEpoch, :)) * sr(datatype(k))); - case 'whole' - win = [1 numel(y{datatype(k)})]; - end - if any(win > numel(y{datatype(k)}) + 1) || any(win < 0) - warning('\nEpoch %2.0f outside of file %s ...', iEpoch, model.modelfile{iFile}); - inv_flag = 0; - else - inv_flag = 1; - % correct issues with using 'round' - win(1) = max(win(1), 1); - win(2) = min(win(2), numel(y{datatype(k)})); - end - if diff(win) < 4 - warning('\nEpoch %2.0f contains insufficient data ...', iEpoch); - inv_flag = 0; - end - % 3.6.1 collect information -- - sf.model{k}(iEpoch).modeltype = method{k}; - sf.model{k}(iEpoch).boundaries = squeeze(epochs{iFile}(iEpoch, :)); - sf.model{k}(iEpoch).timeunits = model.timeunits; - sf.model{k}(iEpoch).samples = win; - sf.model{k}(iEpoch).sr = sr(datatype(k)); - % - escr = y{datatype(k)}(win(1):win(end)); - sf.model{k}(iEpoch).data = escr; + fprintf('%s ', method{k}); + switch model.timeunits + case 'seconds' + win = round(epochs(iEpoch, :) * sr(datatype(k))); + case 'samples' + win = round(epochs(iEpoch, :) * sr(datatype(k)) / sr(1)); + case 'markers' + win = round(events{iFile}(epochs(iEpoch, :)) * sr(datatype(k))); + case 'whole' + win = [1 numel(y{datatype(k)})]; + end + if any(win > numel(y{datatype(k)}) + 1) || any(win < 0) + warning('\nEpoch %2.0f outside of file %s ...', iEpoch, model.datafile); + inv_flag = 0; + else + inv_flag = 1; + % correct issues with using 'round' + win(1) = max(win(1), 1); + win(2) = min(win(2), numel(y{datatype(k)})); + end + if diff(win) < 4 + warning('\nEpoch %2.0f contains insufficient data ...', iEpoch); + inv_flag = 0; + end + % 3.6.1 collect information -- + sf.model{k}(iEpoch).modeltype = method{k}; + sf.model{k}(iEpoch).boundaries = squeeze(epochs(iEpoch, :)); + sf.model{k}(iEpoch).timeunits = model.timeunits; + sf.model{k}(iEpoch).samples = win; + sf.model{k}(iEpoch).sr = sr(datatype(k)); + % + escr = y{datatype(k)}(win(1):win(end)); + sf.model{k}(iEpoch).data = escr; - % 3.6.2 do the analysis and collect results -- - if ~isempty(model.missing{iFile}) - model_analysis = struct('scr', escr, 'sr', sr(datatype(k)), 'missing_data', model.missing_data(win(1):win(end))); - else - model_analysis = struct('scr', escr, 'sr', sr(datatype(k))); - end - if inv_flag ~= 0 - [sts, invrs] = fhandle{k}(model_analysis, options); - sf.model{k}(iEpoch).inv = invrs; - else - sf.model{k}(iEpoch).inv = []; - end - if inv_flag == 0 - sf.stats(iEpoch, k) = NaN; - elseif any(strcmpi(method{k}, {'dcm', 'mp'})) - sf.stats(iEpoch, k) = invrs.f; - else - sf.stats(iEpoch, k) = invrs; - end + % 3.6.2 do the analysis and collect results -- + if ~isempty(model.missing) + model_analysis = struct('scr', escr, 'sr', sr(datatype(k)), 'missing_data', model.missing_data(win(1):win(end))); + else + model_analysis = struct('scr', escr, 'sr', sr(datatype(k))); + end + if inv_flag ~= 0 + [sts, invrs] = fhandle{k}(model_analysis, options); + sf.model{k}(iEpoch).inv = invrs; + else + sf.model{k}(iEpoch).inv = []; + end + if inv_flag == 0 + sf.stats(iEpoch, k) = NaN; + elseif any(strcmpi(method{k}, {'dcm', 'mp'})) + sf.stats(iEpoch, k) = invrs.f; + else + sf.stats(iEpoch, k) = invrs; + end end sf.trlnames{iEpoch} = sprintf('Epoch #%d', iEpoch); - end - sf.names = method(:); - sf.infos.date = date; - sf.infos.file = model.modelfile{iFile}; - sf.modelfile = model.modelfile{iFile}; - sf.data = y; - if exist('events','var'), sf.events = events; end - sf.input = model; - sf.options = options; - sf.modeltype = 'sf'; - sf.modality = settings.modalities.sf; - save(model.modelfile{iFile}, 'sf'); - fprintf('\n'); end +sf.names = method(:); +sf.infos.date = date; +sf.infos.file = model.modelfile; +sf.modelfile = model.modelfile; +sf.data = y; +if exist('events','var'), sf.events = events; end +sf.input = model; +sf.options = options; +sf.modeltype = 'sf'; +sf.modality = settings.modalities.sf; +save(model.modelfile, 'sf'); +fprintf('\n'); sts = 1; diff --git a/src/pspm_sf_auc.m b/src/pspm_sf_auc.m index 2c57012a5..489f4c8cc 100644 --- a/src/pspm_sf_auc.m +++ b/src/pspm_sf_auc.m @@ -4,15 +4,16 @@ % ● Format % [sts, auc] = pspm_sf_auc(scr, sr, options) % ● Arguments -% * scr : the SCR time series -% * sr : sampling rate. -% * options : the options struct. +% ┌────────model +% ├─────────.scr : skin conductance epoch (maximum size depends on computing power, +% │ a sensible size is 60 s at 10 Hz) +% ├──────────.sr : [numeric] [unit: Hz] sampling rate. +% └.missing_data : [Optional] missing epoch data, originally loaded as model.missing +% from pspm_sf, but calculated into .missing_data (created +% in pspm_sf and then transferred to pspm_sf_dcm. +% * options: the options struct (not used) % ● Outputs % * auc : The calculated area under the curve. -% ● Reference -% Bach DR, Friston KJ, Dolan RJ (2010). Analytic measures for the -% quantification of arousal from spontanaeous skin conductance -% fluctuations. International Journal of Psychophysiology, 76, 52-55. % ● References % [1] Bach DR, Friston KJ, Dolan RJ (2010). Analytic measures for the % quantification of arousal from spontanaeous skin conductance @@ -33,11 +34,9 @@ %% check input arguments if nargin < 1 warning('No data specified'); return; -end; +end try model.scr; catch, warning('Input data is not defined.'); return; end -try model.sr; catch, warning('Sample rate is not defined.'); return; end scr = model.scr; -sr = model.sr; scr = scr - min(scr); auc = mean(scr); sts = 1; diff --git a/src/pspm_sf_mp.m b/src/pspm_sf_mp.m index 6332eb627..6db18e58d 100644 --- a/src/pspm_sf_mp.m +++ b/src/pspm_sf_mp.m @@ -4,11 +4,12 @@ % matching pursuit algorithm, and f_SF for the forward model the input data is assumed % to be in mcS, and sampling rate in Hz. % ● Format -% [sts, mp] = pspm_sf_mp(model, options) +% [sts, out] = pspm_sf_mp(model, options) % ● Arguments -% * scr : skin conductance epoch (maximum size depends on computing power, a -% sensible size is 60 s at 10 Hz) -% * sr : sampling rate in Hz +% ┌─model +% ├─────scr : skin conductance epoch (maximum size depends on computing power, a +% │ sensible size is 60 s at 10 Hz) +% └──────sr : sampling rate in Hz % ┌─options % ├─.threshold: threshold for SN detection (default 0.1 mcS) % ├──.theta : a (1 x 5) vector of theta values for f_SF (default: read from pspm_sf_theta) @@ -18,20 +19,24 @@ % Add further diagnostics to the output. Is disabled if set to be false. % If set to true this will add a further field 'D' to the output struct. % Default is false. -% ● Output +% ● Outputs % ┌─────out % ├──────.n : number of responses above threshold % ├──────.f : frequency of responses above threshold in Hz % ├─────.ma : mean amplitude of responses above threshold -% ├──────.t : timing of responses -% ├──────.a : amplitude of responses (re-estimated) -% ├───.rawa : amplitude of responses (initial estimate) +% ├──────.t : timing of responses (adjusted for conduction delay) +% ├──────.a : amplitude of responses (re-estimated via ML) +% ├───.rawa : amplitude of responses (initial greedy estimate) % ├──.theta : parameters used for f_SF -% ├─.threshold : threshold -% ├───.yhat : fitted time series (reestimated amplitudes) -% ├.yhatraw : fitted time series (original amplitudes) -% ├──────.S : inversion settings -% └──────.D : inversion dictionary +% ├─.threshold : threshold applied for response detection +% ├───.yhat : fitted time series (using reestimated amplitudes) +% ├.yhatraw : fitted time series (using initial amplitudes) +% ├──────.ind : indices of selected dictionary atoms in D.D +% ├──.sortind : sorted indices of selected atoms (after pruning) +% ├───────.y : preprocessed input data (baseline-centered scr) +% ├───.time : total execution time in seconds +% ├──────.S : inversion settings (struct with algorithm parameters) +% └──────.D : inversion dictionary (struct with atoms and metadata) % ● References % [1] Bach DR, Staib M (2015). A matching pursuit algorithm for inferring tonic % sympathetic arousal from spontaneous skin conductance fluctuations. @@ -67,9 +72,9 @@ errmsg = 'Input SCR is not a vector'; else scr = scr(:); -end; +end -if exist('errmsg') == 1, warning(errmsg); return; end; +if exist('errmsg') == 1, warning(errmsg); return; end % options @@ -106,13 +111,13 @@ Theta = [S.theta(1:3), S.sfsets{iSet}]; for k = 1:(size(ut, 2) - 1) Xt(:, k + 1) = f_SF(Xt(:, k), Theta, ut(:, k), in); - end; + end % extract SF amplitude and normalise to 1 unit if iSet == 1 sfa = max(Xt(1, :)); - end; + end sf{iSet} = Xt(1, :)/sfa; -end; +end % initialise D.D --- D.D = zeros(numel(S.sfsets) * S.n + S.ntail + numel(S.tonicsets{1}) * numel(S.tonicsets{2}), S.n); @@ -121,7 +126,7 @@ for k = 1:S.ntail D.D(k, 1:min(S.n, S.nsf - S.ntail + k - 1)) = sf{1}((S.ntail - k + 2):min(S.nsf, S.ntail - k + 1 + S.n)); D.tindx(k) = 1 - (S.ntail - k + 1) .* S.dt; -end; +end Dindx = k; % model atoms for SF occuring in data segment -- @@ -130,9 +135,9 @@ for k = 1:maxn D.D(Dindx + k, k:min(k + S.nsf - 1, S.n)) = sf{iSet}(1:min(S.nsf, S.n - k + 1)); D.tindx(Dindx + k) = 1 + (k - 1) .* S.dt; - end; + end Dindx = Dindx + k; -end; +end D.phasicterms = Dindx; Dindx = Dindx + 1; @@ -144,8 +149,8 @@ D.D(Dindx + 1, :) = (S.tonicsets{1}(ia) + S.n * S.dt * S.tonicsets{2}(ib)) - (1:S.n) * S.dt * S.tonicsets{2}(ib); D.tindx(Dindx + (0:1)) = NaN; Dindx = Dindx + 2; - end; -end; + end +end % % normalise D.D and retain original amplitudes -- % (this is to make inner product interpretable) @@ -200,10 +205,10 @@ % stopping criteria: smaller than threshold, maximum number of sf if sum(S.Yres.^2) < S.maxres || k >= S.maxsf S.cont = 0; - end; + end k = k + 1; - end; -end; + end +end S.diagnostics.num = numel(a); % number of iterations S.diagnostics.error = sum(S.Yres.^2); % error @@ -242,7 +247,7 @@ % only add field D if options.diagnostics is set to true. if options.diagnostics out.D = D; -end; +end out.ind = ind; out.sortind = sortind; out.y = y; @@ -260,4 +265,4 @@ plot(y, 'k'); plot(D.D(ind, :)', 'b'); plot(Yhat, 'r'); -end; +end diff --git a/src/pspm_sf_scl.m b/src/pspm_sf_scl.m index 5f94610c9..ecaa32bd9 100644 --- a/src/pspm_sf_scl.m +++ b/src/pspm_sf_scl.m @@ -2,11 +2,16 @@ % ● Description % pspm_sf_scl returns the mean skin conductance level for an epoch % ● Format -% [sts, scl] = pspm_sf_scl(scr, sr) +% [sts, scl] = pspm_sf_scl(model, options) % ● Arguments -% * scr : the input skin conductance response -% * sr : the input sampling rate -% * options: the options struct +% ┌────────model +% ├─────────.scr : skin conductance epoch (maximum size depends on computing power, +% │ a sensible size is 60 s at 10 Hz) +% ├──────────.sr : [numeric] [unit: Hz] sampling rate. +% └.missing_data : [Optional] missing epoch data, originally loaded as model.missing +% from pspm_sf, but calculated into .missing_data (created +% in pspm_sf and then transferred to pspm_sf_dcm. +% * options: the options struct (not used) % ● Outputs % * scl : scl outputs % ● History @@ -22,13 +27,11 @@ sts = -1; scl = []; - % check input arguments if nargin < 1 warning('No data specified'); return; -end; +end try model.scr; catch, warning('Input data is not defined.'); return; end -try model.sr; catch, warning('Sample rate is not defined.'); return; end -scl = mean(scr); +scl = mean(model.scr); sts = 1; diff --git a/src/pspm_sf_theta.m b/src/pspm_sf_theta.m index 72e4b750c..877997ae3 100644 --- a/src/pspm_sf_theta.m +++ b/src/pspm_sf_theta.m @@ -3,7 +3,7 @@ % pspm_sf_theta returns parameter values for skin conductance response function f_SF. % ● Format % [theta, sr] = pspm_sf_theta -% ● Developer's Notes +% ● Developer % Estimated on 29-Jul-2009 % ● Outputs % * theta : a vector as [theta1, theta2, theta3, theta4, theta5] diff --git a/src/pspm_show_arms.m b/src/pspm_show_arms.m index 6b7244e8e..a8cf42fec 100644 --- a/src/pspm_show_arms.m +++ b/src/pspm_show_arms.m @@ -1,5 +1,5 @@ function pspm_show_arms -% ● Developer's Notes +% ● Developer % Happy Easter! % ● History % Introduced in PsPM 3.0 diff --git a/src/pspm_show_forum.m b/src/pspm_show_forum.m index 34d6975a0..c70b65958 100644 --- a/src/pspm_show_forum.m +++ b/src/pspm_show_forum.m @@ -4,4 +4,4 @@ % Written in 2020 by Teddy web('https://github.com/bachlab/PsPM/issues', '-browser') -return \ No newline at end of file +return diff --git a/src/pspm_split_sessions.m b/src/pspm_split_sessions.m index 841aacafb..f3fb28313 100644 --- a/src/pspm_split_sessions.m +++ b/src/pspm_split_sessions.m @@ -54,7 +54,7 @@ % * newdatafile : cell array of filenames for the individual sessions % * newepochfile : cell array of missing epoch filenames for the individual % sessions (empty if options.missing not specified). -% ● Developer's notes +% ● Developer % epochs have a fixed sampling rate of 10000 % REMARK for suffix and prefix: % Markers in the prefix and suffix intervals are ignored. Only markers diff --git a/src/pspm_struct2vec.m b/src/pspm_struct2vec.m index 66e610d56..18793c320 100644 --- a/src/pspm_struct2vec.m +++ b/src/pspm_struct2vec.m @@ -13,7 +13,7 @@ % * field : name of a numerical field. % * warningtype : ['marker' or 'generic'] Type of warning to the displayed % for the user. -% ● Output +% ● Outputs % * v : numerical vector. % ● History % Introduced in PsPM 7.0 diff --git a/src/pspm_tam.m b/src/pspm_tam.m index 61f2d4adb..ae01fd8c7 100644 --- a/src/pspm_tam.m +++ b/src/pspm_tam.m @@ -68,7 +68,7 @@ % Default value: determined by pspm_overwrite. % ● Outputs % * tam: a structure 'tam' which is also written to file -% ● Reference +% ● References % [1] Model development: % Korn CW & Bach DR (2016). A solid frame for the window on cognition: % Modelling event-related pupil responses. Journal of Vision, 16:28, @@ -83,7 +83,7 @@ % Introduced In PsPM 4.2 % Written in 2020 by Ivan Rojkov (University of Zurich) % Maintained in 2022 by Teddy -% ● Developer's Notes +% ● Developer % The fitting process is a residual least square minimisation where the % predicted value is calculated as following: % Y_predicted = input_function (*) basis_function @@ -120,25 +120,12 @@ if nargin < 1; errmsg = 'Nothing to do.'; warning('ID:invalid_input', errmsg); return elseif nargin < 2; options = struct(); end -% 2.2 check model -model = pspm_check_model(model, 'tam'); -if model.invalid +% 2.2 check model and options +[model, options] = pspm_check_model(model, options, 'tam'); +if model.invalid || options.invalid return end -% 2.3 check options -options = pspm_options(options, 'tam'); -if options.invalid - return -end - -% 2.4 check files -% stop the script if files are not allowed to overwrite -if ~pspm_overwrite(model.modelfile, options) - warning('ID:invalid_input', 'Model file exists, and overwriting not allowed by user.'); - return -end - %% Loading files fprintf('Computing Trial Average Model: %s \n', model.modelfile); diff --git a/src/pspm_time2index.m b/src/pspm_time2index.m index e2bff816d..fd4c3e395 100644 --- a/src/pspm_time2index.m +++ b/src/pspm_time2index.m @@ -4,7 +4,7 @@ % to a sample index. % ● Format % index = pspm_time2index(time, sr [, data_length, is_duration, events]) -% ● Developer's notes +% ● Developer % Optional arguments in []; all arguments up the last specified one need to be specified. % ● Arguments % * time : [vector or matrix] time stamps in second. @@ -13,8 +13,8 @@ % * is_duration : [0/1] whether an index or a duration is required, default as 0. % * events : vector of timestamps from a marker channel, will be considered if % given as input. -% ● Output -% index : [integer] index or data point. +% ● Outputs +% * index : [integer] index or data point. % ● History % Introduced in PsPM 5.1.2 % Written in 2021 by Teddy diff --git a/src/pspm_transfer_function.m b/src/pspm_transfer_function.m index 71351dac8..a7ccbd615 100644 --- a/src/pspm_transfer_function.m +++ b/src/pspm_transfer_function.m @@ -61,19 +61,19 @@ warning('ID:invalid_input','The parameter ''offset'' has to be numeric.'); return; elseif nargin < 5 recsys = 'conductance'; -end; +end if ~any(strcmpi(recsys, {'conductance','resistance'})) warning('ID:invalid_input', ['Invalid recording system given. Use either ', ... '''conductance'' or ''resistance''.']); return; -end; +end switch recsys case 'conductance' power = 1; case 'resistance' power = -1; -end; +end % catch zeros z = (data == 0); diff --git a/src/pspm_ui.m b/src/pspm_ui.m index 130399813..463045716 100644 --- a/src/pspm_ui.m +++ b/src/pspm_ui.m @@ -1,10 +1,15 @@ function [hObject, handles] = pspm_ui(hObject,handles,window) % ● Description % pspm_ui controls the UI of the referred handle. +% ● Format +% [hObject, handles] = pspm_ui(hObject,handles,window) % ● Arguments % * hObject : UI controllor of the specific GUI window. % * handles : UI controllor of the specific GUI window. % * window : the name of the specific GUI window. +% ● Outputs +% * hObject : The handle of the main UI figure or control element. +% * handles : A structure containing handles to all UI components. % ● History % Introduced in PsPM 5.1 % Written and maintained in 2021-2022 @@ -112,7 +117,7 @@ handles.tag_attribution.FontSize = FSAttr; %handles.tag_attribution.Visible = 'off'; handles.tag_attribution.HorizontalAlignment = 'center'; - attribution_disp_text = sprintf(['Version 7.0, Build 25-01-2024 with MATLAB 2023a, ',... + attribution_disp_text = sprintf(['Version 7.0, Build 12-02-2025 with MATLAB 2024a, ',... 'The PsPM Team']); handles.tag_attribution.String = attribution_disp_text; handles.tag_PsPM.FontName = FNRoman; diff --git a/src/pspm_ui_app.m b/src/pspm_ui_app.m index e80cd1af8..25c234146 100644 --- a/src/pspm_ui_app.m +++ b/src/pspm_ui_app.m @@ -1,5 +1,5 @@ function app = pspm_ui_app (app) -% ● Descrition +% ● Description % pspm_ui_app handles the ui controlling elements for app designer based GUI files. % Details of font styles can be found in the developer's guide. % ● History @@ -58,7 +58,7 @@ %% Window specific settings switch app.layout.Name case 'pspm' - attribution_disp_text = ['Build 03-06-2024 with MATLAB 2024a, ',... + attribution_disp_text = ['Build 12-02-2025 with MATLAB 2024a, ',... 'The PsPM Team']; app.text_attribution.Text{1,1} = 'Version 7.0'; app.text_attribution.Text{2,1} = attribution_disp_text; diff --git a/src/pspm_update_channeltype.m b/src/pspm_update_channeltype.m index 19f47a285..9fef0c8bb 100644 --- a/src/pspm_update_channeltype.m +++ b/src/pspm_update_channeltype.m @@ -6,7 +6,7 @@ % * keyword : the keyword to update to accepted values, 'c', 'pp'. % (1) 'c': update the lateral keyword 'l' or 'r' to 'c'. % (2)'pp': update the channel type to be preprocessed. -% ● Output +% ● Outputs % * channeltype_new : the new channel type with the updated keyword % ● History % Introduced in PsPM 6.0. diff --git a/test/pspm_butter_test.m b/test/pspm_butter_test.m index 96ec130bd..0b51b03e5 100644 --- a/test/pspm_butter_test.m +++ b/test/pspm_butter_test.m @@ -6,7 +6,7 @@ methods (Test) function invalid_input(this) global settings; - if isempty(settings), pspm_init; end; + if isempty(settings), pspm_init; end settings.signal = 0; % Verify not enough input this.verifyWarning(@() pspm_butter(), 'ID:invalid_input'); diff --git a/test/pspm_convert_ecg2hb_test.m b/test/pspm_convert_ecg2hb_test.m index 500151744..040d742af 100644 --- a/test/pspm_convert_ecg2hb_test.m +++ b/test/pspm_convert_ecg2hb_test.m @@ -58,17 +58,17 @@ function test_added_data(this, filename, original_num_channels) if nsts == -1 warning('unable to load the test data file'); return; - end; + end if numel(data) > original_num_channels for i=original_num_channels+1:numel(data) % check if channel header is correct hdr = data{i}.header; - if hdr.sr ~= 1, warning('Wrong sampling rate in header'); end; - if ~strcmpi(hdr.units, 'events'), warning('Wrong unit in header'); end; - if ~strcmpi(hdr.chantype, 'hb'), warning('Wrong chantype in header'); end; + if hdr.sr ~= 1, warning('Wrong sampling rate in header'); end + if ~strcmpi(hdr.units, 'events'), warning('Wrong unit in header'); end + if ~strcmpi(hdr.chantype, 'hb'), warning('Wrong chantype in header'); end % check if channel has data d = data{i}.data; - if numel(d) < 1, warning('Less than 1 data points'); end; + if numel(d) < 1, warning('Less than 1 data points'); end % check if hb time indices are increasing if ~isempty(find(diff(d) < 0)) warning('Heartbeat seconds are not monotonically increasing'); @@ -84,13 +84,13 @@ function test_added_data(this, filename, original_num_channels) % otherwise there is something odd if std(diff(d)) > 2, warning('Abnormal high standard deviation (more than 2s) of time between heartbeats'); - end; + end % check if last data point also corresponds to the % length of the recordings % shouldn't be more than 60s either if (infos.duration - d(end)) > 60 warning('Heartbeat data ends 60s earlier than data recording'); - end; + end end else warning('No channel has been added to testfile'); diff --git a/test/pspm_doc_test.m b/test/pspm_doc_test.m index 24f698d1b..13c5306b3 100644 --- a/test/pspm_doc_test.m +++ b/test/pspm_doc_test.m @@ -48,7 +48,7 @@ function valid_input(this) end this.verifyEqual(pspm_doc_gen(this.list_func), 1); for i = 1:length(this.list_func) - this.verifyEqual(isfile(['src/ref/',this.list_func{i},'.md']), true); + this.verifyEqual(isfile(['src/ref/2024-01-01-',this.list_func{i},'.md']), true); end rmdir('src/ref', 's'); end diff --git a/test/pspm_down_test.m b/test/pspm_down_test.m index 4e3451f80..2fb6310c7 100644 --- a/test/pspm_down_test.m +++ b/test/pspm_down_test.m @@ -29,7 +29,7 @@ function generate_test_data(this) delete(pspm_down_test.fn); end pspm_testdata_gen(channels, 10, scr_down_test.fn); - if ~exist(pspm_down_test.fn, 'file'), warning('the testdata could not be generated'), end; + if ~exist(pspm_down_test.fn, 'file'), warning('the testdata could not be generated'), end end end methods (TestClassTeardown) diff --git a/test/pspm_exp_test.m b/test/pspm_exp_test.m index d3d9040d3..be009aeb5 100644 --- a/test/pspm_exp_test.m +++ b/test/pspm_exp_test.m @@ -137,14 +137,14 @@ function save_datafile(this, Y, sr, duration, fn, onsets) % generate signal copied from pspm_glm_test % with signal(onsets) = scal + offset % default values - if nargin < 6, duration = 10; end; - if nargin < 5, sr = 100; end; + if nargin < 6, duration = 10; end + if nargin < 5, sr = 100; end if nargin < 4 onsets_duration = zeros(size(onsets)); elseif isscalar(onsets_duration) onsets_duration = onsets_duration .* ones(size(onsets)); end - if nargin < 3, offset = 0; end; + if nargin < 3, offset = 0; end if nargin < 2 scal = ones(size(onsets)); elseif isscalar(scal) diff --git a/test/pspm_expand_epochs_test.m b/test/pspm_expand_epochs_test.m new file mode 100644 index 000000000..2b20de083 --- /dev/null +++ b/test/pspm_expand_epochs_test.m @@ -0,0 +1,335 @@ +classdef pspm_expand_epochs_test < pspm_testcase + % ● Description + % Unit test class for the pspm_expand_epochs function. + % ● Authorship + % (C) 2024 Bernhard Agoué von Raußendorf + + properties(Constant) + % Define test data filenames + epochs_filename = 'test_epochs.mat'; + data_filename = 'test_data.mat'; + backup_data_filename = 'test_data_backup.mat'; + NoNaN_data_filename = 'test_data_NoNaN.mat'; + backup_NoNaN_data_filename = 'test_data_NoNaN_backup.mat'; + + expansion = [1, 1]; % Expand epochs by 1 second before and after + options = struct('overwrite', 1); + end + + methods(TestClassSetup) + function generate_test_data(this) + % Generate test epochs file + epochs = [5, 10; 15, 20]; + save(this.epochs_filename, 'epochs'); + + % Generate test data file with missing data in a channel + channels{1}.chantype = 'scr' ; + channels{1}.sr = 100; + + duration = 25; % seconds + outfile = pspm_testdata_gen(channels, duration, this.data_filename); + + copyfile(this.data_filename, this.NoNaN_data_filename); + + % Introduce missing data (NaNs) between 12 and 18 seconds + sr = channels{1}.sr; + data_length = duration * sr; + data = outfile.data{1}.data; + missing_indices = (12*sr):(18*sr); + data(missing_indices) = NaN; + + % Use pspm_write_channel to save the modified data + newdata = struct('header', outfile.data{1}.header, 'data', data); + options = struct('channel', 1); + [wsts, out] = pspm_write_channel(this.data_filename, {newdata}, 'replace', options); + if wsts < 1 + error('Failed to write modified channel data'); + end + + % Backup the data file + copyfile(this.data_filename, this.backup_data_filename); + end + end + + methods(Test) + function InValidInputError(this) + % no input + this.verifyWarning(@()pspm_expand_epochs(), 'ID:invalid_input'); + % invalid input + this.verifyWarning(@()pspm_expand_epochs('invalid input'), 'ID:invalid_input'); + % Invalid expansion vector + epochs = [5, 10; 15, 20]; + invalid_expansion = [1]; % Should be a 2-element vector + this.verifyWarning(@()pspm_expand_epochs(epochs, invalid_expansion), 'ID:invalid_input'); + end + + function InValidInputEpochfileError(this) + + expansion = this.expansion; + options = this.options; + fn = 'nofile.mat'; + + this.verifyWarning(@()pspm_expand_epochs(fn, expansion, options) , 'ID:invalid_input'); + end + + function InValidInputDataFileError(this) + + expansion = this.expansion; + options = this.options; + epoch = [1 , 1]; + fn = 'nofile.mat'; + this.verifyWarning(@()pspm_expand_epochs(fn, expansion, options) , 'ID:invalid_input'); + end + + function InValidEpochsFormatError(this) + options = this.options; + + % Test single column epochs + invalid_epochs = [1; 2; 3]; + [sts , ~] = pspm_expand_epochs(invalid_epochs, this.expansion,options); + this.verifyLessThan(sts,1) + % Test non-numeric epochs + cell_epochs = {[1,2]; [3,4]}; + [sts , ~] = pspm_expand_epochs(invalid_epochs, this.expansion,options); + this.verifyLessThan(sts,1) + + end + + function InValidInputDataFileChannelError(this) + % Tests the error handeling of the loading of the channel + + channel1 = 99; + channel2 = -99; + channel3 = 'not a channel'; + + Exp = this.expansion; + options = struct('channel_action', 'replace','overwrite',1); + fn = this.data_filename; + + this.verifyWarning(@()pspm_expand_epochs(fn, channel1, Exp, options), 'ID:invalid_input' ) + this.verifyWarning(@()pspm_expand_epochs(fn, channel2, Exp, options), 'ID:invalid_input' ) + this.verifyWarning(@()pspm_expand_epochs(fn, channel3, Exp, options), 'ID:invalid_chantype' ) + + % Restors the datafile + copyfile(this.backup_data_filename, this.data_filename); + end + + function InValidInputDataFileChannelActionError(this) + % Tests the error handeling of the loading of the channel + + channel1 = 1; + Exp = this.expansion; + options = struct('channel_action', 'no_action','overwrite', 1); + fn = this.data_filename; + + this.verifyWarning(@()pspm_expand_epochs(fn, channel1, Exp, options), 'ID:invalid_input' ) + + % Restors the datafile + copyfile(this.backup_data_filename, this.data_filename); + + + end + + function NoNaNDataFileEpochReplaceTest(this) + % Tests the error handeling of the loading of the channel + + channel1 = 1; + Exp = this.expansion; + options = struct('channel_action', 'replace','overwrite', 1); + + fn = this.NoNaN_data_filename; + [~, ~, ~, filestruct] = pspm_load_data(fn, 'none'); + + numofchanbefor = filestruct.numofchan; + + [sts, expanded_epochs] = pspm_expand_epochs(fn, channel1, Exp, options); + this.verifyEqual(sts,1) + + % checks if the number of channel stays the same + [~, ~, ~, filestruct2] = pspm_load_data(fn, 'none'); + numofchanafter = filestruct2.numofchan; + + this.verifyEqual(numofchanbefor,numofchanafter) + end + + function NoNaNDataFileEpochAddTest(this) + % Tests the error handeling of the loading of the channel + + channel1 = 1; + Exp = this.expansion; + options = struct('channel_action', 'add','overwrite',1); + + fn = this.NoNaN_data_filename; + + % makes a backup + copyfile(fn,this.backup_NoNaN_data_filename) + + % count the channels + [~, ~, ~, filestruct] = pspm_load_data(fn, 'none'); + numofchanbefor = filestruct.numofchan; + + [sts, expanded_epochs] = pspm_expand_epochs(fn, channel1, Exp, options); + this.verifyEqual(sts,1) + + % checks if the number of channel increases + [~, ~, ~, filestruct2] = pspm_load_data(fn, 'none'); + numofchanafter = filestruct2.numofchan; + + this.verifyEqual(numofchanbefor+1,numofchanafter) + + movefile(this.backup_NoNaN_data_filename,fn) + + end + + + % function NoNaNDataFileNoEpochOverwriteError(this) + % % Tests the error handeling of the loading of the channel + % + % channel1 = 1; + % Exp = this.expansion; + % options = struct('channel_action', 'replace','overwrite', 1); % + % + % fn = this.NoNaN_data_filename; + % + % [pathstr, name, ext] = fileparts(fn); + % fn_out = fullfile(pathstr, ['e', name, ext]); + % copyfile(fn,fn_out) + % + % this.verifyWarning(@()pspm_expand_epochs(fn, channel1, Exp, options), 'ID:empty_channel') + % + % % add pspm_get_timing + % this.verifyTrue(exist(fn_out,'file'),'False') + % + % end + + function EpandEpochsWithEpochsTest(this) + % Test expanding epochs given an epoch matrix + import matlab.unittest.constraints.IsEqualTo + + epochs = [5, 10; 15, 20]; + expansion = this.expansion; + [sts, expanded_epochs] = pspm_expand_epochs(epochs, expansion); + + % Expected expanded epochs + expected_epochs = [4, 11; 14, 21]; + + this.verifyEqual(sts, 1); + this.verifyThat(expanded_epochs, IsEqualTo(expected_epochs)); + end + + function ExpandEpochsWithEpochsFileTest(this) + + + expansion = this.expansion; + options = this.options; + fn = this.epochs_filename; + [sts, output_file] = pspm_expand_epochs(fn, expansion, options); + + % Load the expanded epochs + loaded_epochs = load(output_file); + expanded_epochs = loaded_epochs.epochs; + + % Expected expanded epochs + expected_epochs = [4, 11; 14, 21]; + + + this.verifyEqual(sts, 1); + this.verifyEqual(expanded_epochs,expected_epochs) + end + + function ExpandEpochsWithDataFileReplaceTest(this) + % Test expanding epochs given a data file + + channel = 1; % Assuming the missing data is in channel 1 + Exp = [1,1]; %this.expansion; + options = struct('channel_action', 'replace','overwrite',1); + fn = this.data_filename; + + % Run the function + [sts, channel_index] = pspm_expand_epochs(fn, channel, Exp, options); + + % Load the data and check that missing data has been expanded + [sts, ~, data,~] = pspm_load_data(this.data_filename); + this.verifyEqual(sts, 1); + + sr = data{channel_index}.header.sr; + data_values = data{channel_index}.data; + + % Expected missing data indices + original_missing_indices = (12*sr):(18*sr); + expanded_missing_indices = ((12-Exp(1))*sr):((18+Exp(2))*sr); + + % Verify that data is NaN in the expected expanded intervals + % makes a logical array of the real missing values: NaN -> 1 + missing_indices = isnan(data_values); + % makes a logical array of expacted missing values: NaN -> 1 + expected_missing_logical = false(size(data_values)); + expected_missing_logical(expanded_missing_indices) = true; + + this.verifyEqual(sts, 1) + this.verifyEqual(missing_indices,expected_missing_logical); + + % Restors the datafile + copyfile(this.backup_data_filename, this.data_filename); + end + + function ExpandEpochsWithDataFileAddTest(this) + % Test expanding epochs given a data file with 'add' option + + channel = 1; + Exp = [5,2]; % different expansion then above + options = struct('channel_action', 'add','overwrite',1); + fn = this.data_filename; + + % Run the function + [sts, channel_index] = pspm_expand_epochs(fn, channel, Exp, options); + + % Load the data and check that missing data has been expanded + [sts, ~, data, filestruct] = pspm_load_data(this.data_filename); + this.verifyEqual(sts, 1); + + sr = data{channel_index}.header.sr; + data_values = data{channel_index}.data; + + % Expected missing data indices + original_missing_indices = (12*sr):(18*sr); + expanded_missing_indices = ((12-Exp(1))*sr):((18+Exp(2))*sr); + + + % Verify that data is NaN in the expected expanded intervals + missing_indices = isnan(data_values); + % + expected_missing_logical = false(size(data_values)); + %expected_missing_logical(original_missing_indices) = true; + expected_missing_logical(expanded_missing_indices) = true; + + this.verifyEqual(sts,1) + this.verifyEqual(filestruct.numofchan , 2) % checks if the channel was added? + this.verifyEqual(missing_indices, expected_missing_logical); + + + % Restors the datafile + copyfile(this.backup_data_filename, this.data_filename); + + end + + end + + methods(TestClassTeardown) + function cleanup(this) + % Restore the original data file + movefile(this.backup_data_filename, this.data_filename); + + % Delete the test files + delete(this.epochs_filename); + + if isfile(['e', this.epochs_filename]) + delete(['e', this.epochs_filename]); + end + + + delete(this.data_filename); + delete(this.NoNaN_data_filename); + end + end +end diff --git a/test/pspm_get_acq_bioread_test.m b/test/pspm_get_acq_bioread_test.m index 57fbf928d..11877b074 100644 --- a/test/pspm_get_acq_bioread_test.m +++ b/test/pspm_get_acq_bioread_test.m @@ -24,7 +24,7 @@ function define_testcases(this) this.testcases{3}.pth = 'ImportTestData/acq/calibration2015-12-06T20_22_38_bioread.mat'; this.testcases{3}.import{1} = struct('type', 'ecg' , 'channel', 1); this.testcases{3}.import{2} = struct('type', 'marker' , 'channel', 2); - end; + end end methods (Test) function invalid_datafile(this) diff --git a/test/pspm_get_superclass.m b/test/pspm_get_superclass.m index 070616f99..3554c5bba 100644 --- a/test/pspm_get_superclass.m +++ b/test/pspm_get_superclass.m @@ -13,7 +13,7 @@ methods (Static) function import = assign_chantype_number(import) global settings; - if isempty(settings), pspm_init; end; + if isempty(settings), pspm_init; end for m = 1:numel(import) import{m}.typeno = find(strcmpi(import{m}.type, {settings.channeltypes.type})); end @@ -23,7 +23,7 @@ function init(this) define_testcases(this); global settings - if isempty(settings), pspm_init; end; + if isempty(settings), pspm_init; end % assign channel type number for k = 1:numel(this.testcases) for m = 1:numel(this.testcases{k}.import) @@ -53,7 +53,7 @@ function valid_datafile(this) sourceinfo = {sourceinfo}; end for blk = 1:blkno - if blkno > 1, fprintf('\n\tProcess block %i. ', blk); end; + if blkno > 1, fprintf('\n\tProcess block %i. ', blk); end this.verifyNumElements(import{blk}, numel(this.testcases{k}.import), ... sprintf('The number of elements of ''import'' does not match in testcase %i', k)); for m = 1:numel(this.testcases{k}.import) diff --git a/test/pspm_load1_test.m b/test/pspm_load1_test.m index ad303a367..b55ce140f 100644 --- a/test/pspm_load1_test.m +++ b/test/pspm_load1_test.m @@ -66,10 +66,10 @@ function remove_testdata(this) delete(pspm_load1_test.fn); end for i=1:numel(this.modelfiles) - if exist(this.modelfiles{i}, 'file'), delete(this.modelfiles{i}); end; + if exist(this.modelfiles{i}, 'file'), delete(this.modelfiles{i}); end end for i=1:numel(this.dummyfiles) - if exist(this.dummyfiles{i}, 'file'), delete(this.dummyfiles{i}); end; + if exist(this.dummyfiles{i}, 'file'), delete(this.dummyfiles{i}); end end end end @@ -173,7 +173,7 @@ function invalid_model_structure_specific(this) dummy = dummy_backup; save(dfn, '-struct', 'dummy', mdltype); this.verifyWarning(@()pspm_load1(dfn, 'recon'), 'ID:invalid_input'); - end; + end options.zscored = 1; if strcmpi(mdltype, 'dcm') this.verifyWarning(@()pspm_load1(dfn, 'none', {}, options), 'ID:invalid_input'); @@ -182,7 +182,7 @@ function invalid_model_structure_specific(this) else this.verifyWarning(@()pspm_load1(dfn, 'cond', {}, options), 'ID:invalid_input'); end - end; + end end function test_action_none(this) for i=1:numel(this.modelfiles) @@ -218,8 +218,8 @@ function test_action_cond(this) otherwise this.verifyTrue(isfield(data, 'trlnames'), 'No ''trlnames'' returned.'); this.verifyTrue(isfield(data, 'condnames'), 'No ''condnames'' returned.'); - end; - end; + end + end end function test_action_recon(this) for i=1:numel(this.modelfiles) @@ -236,7 +236,7 @@ function test_action_recon(this) end % non-linear alternative already checked in specific % structure test - end; + end end % run before con in order to create a con field function test_action_savecon(this) @@ -253,7 +253,7 @@ function test_action_savecon(this) this.verifyTrue(isfield(mdl.(mdltype), 'con'), 'No field ''con'' in model.'); this.verifyTrue(isfield(mdl.(mdltype).con, 'test'), 'No field ''con.test'' in model.'); this.verifyEqual(mdl.(mdltype).con.test, x, 'Test field does not contain the expected value.'); - end; + end end function test_action_con(this) for i=1:numel(this.modelfiles) @@ -264,8 +264,8 @@ function test_action_con(this) % check for fields if isfield(mdl.(mdltype), 'con') this.verifyTrue(isfield(data, 'test'), 'No ''con'' returned.'); - end; - end; + end + end end function test_action_all(this) for i=1:numel(this.modelfiles) diff --git a/test/pspm_load_data_ui_test.m b/test/pspm_load_data_ui_test.m index 79b317aca..60328f4fe 100644 --- a/test/pspm_load_data_ui_test.m +++ b/test/pspm_load_data_ui_test.m @@ -45,7 +45,7 @@ function overwrite_option_test(testCase) [sts, infos, data] = pspm_load_data(scr_load_data_test.fn, chan); % load save.data = data; save.infos = infos; - if exist(fn2), delete(fn2); end; + if exist(fn2), delete(fn2); end sts = pspm_load_data(fn2, save); end end diff --git a/test/pspm_process_illuminance_test.m b/test/pspm_process_illuminance_test.m index d9bb45a37..075a50989 100644 --- a/test/pspm_process_illuminance_test.m +++ b/test/pspm_process_illuminance_test.m @@ -6,7 +6,7 @@ properties testfile_prefix = 'testdata_process_illuminance'; datafiles = {}; - end; + end properties (TestParameter) % one file bf_dur = {0.1 10 100}; @@ -16,7 +16,7 @@ % multiple files n_times = {1, 8} mode = {'file', 'data', 'mixed'}; - end; + end methods(TestMethodTeardown) %% Cleanup function function cleanup(this) @@ -24,11 +24,11 @@ function cleanup(this) d = this.datafiles{i}; if ~isempty(d) && exist(d, 'file') delete(d); - end; - end; + end + end this.datafiles = {''}; - end; - end; + end + end methods %% Generate data function [data_list, sr_list] = generate_lx(this, sr, dur, n_times, mode) @@ -36,10 +36,10 @@ function cleanup(this) data_list = repmat({'file'; 'data'}, fix(n_times/2), 1); if mod(n_times, 2) == 1 data_list{end+1} = 'file'; - end; + end else data_list = repmat({mode}, n_times, 1); - end; + end sr_list = cell(n_times,1); for i=1:n_times sr_list{i} = sr; @@ -54,10 +54,10 @@ function cleanup(this) save(file_name, 'Lx'); case 'data' data_list{i} = Lx; - end; - end; - end; - end; + end + end + end + end methods (Test) %% test options function test_options(this, sr, dur, bf_dur, bf_offset) @@ -73,7 +73,7 @@ function test_options(this, sr, dur, bf_dur, bf_offset) expect_warning = 'ID:invalid_input'; else expect_warning = ''; - end; + end if ~isempty(expect_warning) [sts, ~] = this.verifyWarning(@()pspm_process_illuminance(d_list, sr_list, o), expect_warning); this.verifyEqual(sts, -1); @@ -81,8 +81,8 @@ function test_options(this, sr, dur, bf_dur, bf_offset) [sts, out] = this.verifyWarningFree(@()pspm_process_illuminance(d_list, sr_list, o)); this.verifyEqual(sts, 1); this.verifyEqual(size(out,1), size(d_list,1)); - end; - end; + end + end %% test multi function test_multi(this, n_times, mode) [data, sr_list] = this.generate_lx(10, 100, n_times, mode); @@ -93,8 +93,8 @@ function test_multi(this, n_times, mode) this.verifyEqual(size(out,1), 10*100); else this.verifyEqual(size(out), size(data)); - end; - end; + end + end %% test overwrite function test_overwrite(this) [fn_list, sr_list] = this.generate_lx(10, 100, 1, 'file'); @@ -114,9 +114,9 @@ function test_overwrite(this) % this.verifyTrue(isnumeric(out)); % this.verifyTrue(isfield(d, 'Lx')); % this.verifyEqual(size(d.Lx, 2), 1); - % end; - end; - end; + % end + end + end methods (Test) %% test for invalid input function invalid_input(this) @@ -158,6 +158,6 @@ function invalid_input(this) % fn not same format as ldata opt.fn = 'a'; this.verifyWarning(@() pspm_process_illuminance({1:10}, {1}, opt), 'ID:invalid_input'); - end; - end; + end + end end diff --git a/test/pspm_pupil_pp_test.m b/test/pspm_pupil_pp_test.m index 271cffb11..bd9592c56 100644 --- a/test/pspm_pupil_pp_test.m +++ b/test/pspm_pupil_pp_test.m @@ -22,8 +22,9 @@ function backup(this) import{end + 1}.type = 'gaze_x_l'; import{end + 1}.type = 'gaze_y_l'; import{end + 1}.type = 'marker'; + options.overwrite = 1; [sts, this.pspm_input_filename] = pspm_import(... - this.raw_input_filename, 'eyelink', import, struct()); + this.raw_input_filename, 'eyelink', import, options); this.pspm_input_filename = this.pspm_input_filename; end end