Skip to content

Commit cad5172

Browse files
committedSep 2, 2019
Merge branch 'master' of github.com:titoghose/PyLogy
2 parents 6d0ca76 + 2e4d7ff commit cad5172

File tree

4 files changed

+48
-17
lines changed

4 files changed

+48
-17
lines changed
 

‎PyTrack/Experiment.py

+21-4
Original file line numberDiff line numberDiff line change
@@ -124,9 +124,13 @@ class Experiment:
124124

125125
def __init__(self, json_file, reading_method="SQL", aoi="NA"):
126126

127+
json_file = json_file.replace("\\", "/")
128+
127129
with open(json_file, "r") as json_f:
128130
json_data = json.load(json_f)
129131

132+
json_data["Path"] = json_data["Path"].replace("\\", "/")
133+
130134
self.path = json_data["Path"]
131135
self.name = json_data["Experiment_name"]
132136
self.json_file = json_file #string
@@ -489,23 +493,26 @@ def analyse(self, parameter_list={"all"}, between_factor_list=["Subject_type"],
489493
parameter_list: set (optional)
490494
Set of the different indicators/parameters (Pupil_size, Blink_rate) on which statistical analysis is to be performed, by default it will be "all" so that all the parameter are considered.
491495
between_factor_list: list(str) (optional)
492-
List of between group factors, by default it will only contain "Subject_type"
493-
If any additional parameter (eg: Gender) needs to be considered, then the list will be: between_factor_list = ["Subject_type", "Gender"]
496+
List of between group factors, by default it will only contain "Subject_type".
497+
If any additional parameter (eg: Gender) needs to be considered, then the list will be: between_factor_list = ["Subject_type", "Gender"].
494498
DO NOT FORGET TO INCLUDE "Subject_type", if you wish to consider "Subject_type" as a between group factor.
495499
Eg: between_factor_list = ["factor_x"] will no longer consider "Subject_type" as a factor.
496500
Please go through the README FILE to understand how the JSON FILE is to be written for between group factors to be considered.
497501
within_factor_list: list(str) (optional)
498502
List of within group factors, by default it will only contain "Stimuli_type"
499-
If any additional parameter, needs to be considered, then the list will be: between_factor_list = ["Subject_type", "factor_X"]
503+
If any additional parameter, needs to be considered, then the list will be: between_factor_list = ["Subject_type", "factor_X"].
500504
DO NOT FORGET TO INCLUDE "Stimuli_type", if you wish to consider "Stimuli_type" as a within group factor.
501505
Eg: within_factor_list = ["factor_x"] will no longer consider "Stimuli_type" as a factor.
502506
Please go through how the README FILE to understand how the JSON FILE is to be written for within group factors to be considered.
503507
statistical_test: str {"Mixed_anova","RM_anova","ttest","anova","None"} (optional)
504508
Name of the statistical test that has to be performed.
505509
NOTE:
510+
506511
- ttest: There are 3 options for ttest, and your choice of factors must comply with one of those options, for more information, please see description of `ttest_type` variable given below.
512+
- Welch_ttest: There are 2 options for Welch Ttest, and your choice of factors must comply with one of those options, for more information, please see description of `ttest_type` variable given below.
507513
- Mixed_anova: Only 1 between group factor and 1 within group factor can be considered at any point of time
508514
- anova: Any number of between group factors can be considered for analysis
515+
509516
- RM_anova: Upto 2 within group factors can be considered at any point of time
510517
file_creation: bool (optional)
511518
Indicates whether a csv file containing the statistical results should be created.
@@ -514,14 +521,24 @@ def analyse(self, parameter_list={"all"}, between_factor_list=["Subject_type"],
514521
A directory called "Results" will be created within the Directory whose path is mentioned in the json file and the csv files will be stored within "Results" directory.
515522
If any previous file by the same name exists, it will be overwritten.
516523
ttest_type: int {1,2,3} (optional)
517-
Indicates what type of parameters will be considered for the ttest
524+
Indicates what type of parameters will be considered for the ttest and Welch Ttest
518525
NOTE:
526+
For ttest-
527+
519528
- 1: Upto 2 between group factors will be considered for ttest
520529
- 2: 1 within group factor will be considered for ttest
530+
521531
- 3: 1 within group and 1 between group factor will be considered for ttest
522532
533+
For Welch ttest-
534+
535+
- 1: Will consider the first factor in 'between_factor_list'
536+
537+
- 2: Will consider the first factor in 'within_factor_list'
538+
523539
Examples
524540
--------
541+
525542
For calculating Mixed ANOVA, on all the parameters, with standardisation, NOT averaging across stimuli of the same type
526543
and considering Subject_type and Stimuli_type as between and within group factors respectively
527544

‎PyTrack/Stimulus.py

+3
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ class Stimulus:
5757

5858
def __init__(self, path, name="id_rather_not", stim_type="doesnt_matter", sensor_names=["EyeTracker"], data=None, start_time=0, end_time=-1, roi_time=-1, json_file=None, subject_name="buttersnaps", aoi=None):
5959

60+
path = path.replace("\\", "/")
61+
6062
self.name = name
6163
self.path = path
6264
self.stim_type = stim_type
@@ -1864,6 +1866,7 @@ def groupHeatMap(sub_list, stim_name, json_file, save_fig=False):
18641866
with open(json_file) as json_f:
18651867
json_data = json.load(json_f)
18661868
path = json_data["Path"]
1869+
path = path.replace("\\", "/")
18671870
width = json_data["Analysis_Params"]["EyeTracker"]["Display_width"]
18681871
height = json_data["Analysis_Params"]["EyeTracker"]["Display_height"]
18691872
aoi_coords = json_data["Analysis_Params"]["EyeTracker"]["aoi"]

‎PyTrack/formatBridge.py

+2
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,8 @@ def generateCompatibleFormat(exp_path, device, stim_list_mode="NA", start='START
267267
268268
"""
269269

270+
exp_path = exp_path.replace("\\", "/")
271+
270272
if os.path.isdir(exp_path):
271273

272274
exp_info = exp_path + "/" + exp_path.split("/")[-1] + ".json"

‎README.md

+22-13
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
[![Documentation Status](https://readthedocs.org/projects/pytrack-ntu/badge/?version=latest)](https://pytrack-ntu.readthedocs.io/en/latest/?badge=latest)
12
[![Build Status](https://travis-ci.org/titoghose/PyTrack.svg?branch=master)](https://travis-ci.org/titoghose/PyTrack)
23
[![codecov](https://codecov.io/gh/titoghose/PyTrack/branch/master/graph/badge.svg)](https://codecov.io/gh/titoghose/PyTrack)
34
[![Documentation Status](https://readthedocs.org/projects/pytrack-ntu/badge/?style=flat-square)](https://pytrack-ntu.rtfd.io)
@@ -33,19 +34,24 @@ PyTrack can generate a variety of plots. The visualization is through an interac
3334

3435

3536
# Table of Contents
36-
1. [Documentation](#documentation)
37-
2. [Installation](#installation)
38-
3. [Sample Data](#sample-data)
39-
4. [Using PyTrack](#using-pytrack)
40-
1. [Setup](#setup)
41-
2. [Running PyTrack](#running-pytrack)
42-
5. [Advanced Functionality](#advanced-functionality)
43-
1. [Statistical Tests](#statistical-tests)
44-
2. [Accessing extracted features as a dictionary](#accessing-extracted-features-as-a-dictionary)
45-
3. [Using PyTrack in Stand-alone mode](#using-pytrack-in-stand-alone-mode)
46-
6. [Authors](#authors)
47-
7. [License](#license)
48-
8. [Acknowledgments](#acknowledgments)
37+
- [PyTrack](#PyTrack)
38+
- [Feature Extraction](#Feature-Extraction)
39+
- [Statistical Analysis](#Statistical-Analysis)
40+
- [Visualization](#Visualization)
41+
- [Table of Contents](#Table-of-Contents)
42+
- [Documentation](#Documentation)
43+
- [Installation](#Installation)
44+
- [Sample Data](#Sample-Data)
45+
- [Using PyTrack](#Using-PyTrack)
46+
- [Setup](#Setup)
47+
- [Running PyTrack](#Running-PyTrack)
48+
- [Advanced Functionality](#Advanced-Functionality)
49+
- [Statistical Tests](#Statistical-Tests)
50+
- [Accessing extracted features as a dictionary](#Accessing-extracted-features-as-a-dictionary)
51+
- [Using PyTrack in Stand-alone mode](#Using-PyTrack-in-Stand-alone-mode)
52+
- [Authors](#Authors)
53+
- [License](#License)
54+
- [Acknowledgments](#Acknowledgments)
4955

5056
# Documentation
5157
The detailed documentation for the methods and classes of PyTrack can be found [here](https://pytrack-ntu.readthedocs.io/en/latest/)
@@ -180,6 +186,9 @@ Now, follow these steps:
180186
```python
181187
from PyTrack.formatBridge import generateCompatibleFormat
182188

189+
# For windows the path will look like
190+
# a. exp_path="complete\\path\\to\\NTU_Experiment"
191+
# or b. exp_path=r"complete\path\to\NTU_Experiment"
183192
generateCompatibleFormat(exp_path="complete/path/to/NTU_Experiment",
184193
device="eyelink",
185194
stim_list_mode='NA',

0 commit comments

Comments
 (0)
Please sign in to comment.