IO Utilities Module
io_utils
file_utils
get_df_subj(df, i)
This function creates a subject-specific data frame with adjusted index.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
df
|
DataFrame
|
Subject data frame. |
required |
i
|
int
|
Subject number. |
required |
Returns:
Type | Description |
---|---|
DataFrame
|
Index-adjusted subject-specific data frame (df_subj). |
Source code in allinpy/io_utils/file_utils.py
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
|
load_data(f_names, expected_n_trials=400)
This function loads the adaptive learning BIDS data and checks if they are complete.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
f_names
|
list[Path]
|
List with all file names. |
required |
expected_n_trials
|
int
|
Expected number of trials. |
400
|
Returns:
Name | Type | Description |
---|---|---|
pd |
DataFrame
|
Data frame that contains all data. |
Source code in allinpy/io_utils/file_utils.py
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
sorted_nicely(input_list)
This function sorts the given iterable in the way that is expected.
Obtained from: https://arcpy.wordpress.com/2012/05/11/sorting-alphanumeric-strings-in-python
Parameters:
Name | Type | Description | Default |
---|---|---|---|
input_list
|
list
|
The iterable to be sorted. |
required |
Returns:
Type | Description |
---|---|
list
|
Sorted iterable. |
Source code in allinpy/io_utils/file_utils.py
68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
get_file_paths(folder_path, identifier)
This function extracts the file path.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
folder_path
|
Path
|
Relative path to current folder. |
required |
identifier
|
Path
|
Identifier for file of interest. |
required |
Returns:
Type | Description |
---|---|
list[str]
|
Absolute path to file (file_paths). |
Source code in allinpy/io_utils/file_utils.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
|