kylemath / pyoptical

Imagent optical imaging interface to MNE loading
MIT License
4 stars 1 forks source link

Load and parse boxy data with boxy2mne #15

Closed kuziekj closed 4 years ago

kuziekj commented 4 years ago

Made changes to boxy2mne function:

-loads and parses a boxy data file (both types, including older boxy files) -combines this boxy data with the info structure created from the .mtg and .tol files -returns four variables (three mne objects containing either raw ac, raw dc, or raw phase data, and an object containing channel distances) -currently designed to only take in a single boxy data file, but this can cause issues since some .mtg files want multiple data files and contain more channels than a single data file. So boxy2mne will only consider the same number of channels in the .mtg file as there are channels in the boxy data file

boxy2mne was tested using data files from the ARR experiment, several practice recordings, and file in the data folder. Data appears to load and parse correctly, resulting in n_channels X n_samples.

Also made changes to test2.py to take into account the changes made to boxy2mne.

kylemath commented 4 years ago

ok @kuziekj so do we want this to return all three ac, dc, and ph, or i think rather one of two options

  1. parameter to input to specificy which output is requested
  2. return all three in one big data structure (i prefer this one), then these could be different channel types (like 'eog', and 'eeg', 'meg')
kuziekj commented 4 years ago

Okay, boxy2mne should be updated to output a single dictionary containing values for the ac, dc, and phase objects, and for the distances.

kylemath commented 4 years ago

@kuziekj - I don't like that actually, since it is different from what the nirx.py outputs we want to output a Raw object, which includes the data and the info, packaged into one, perhaps we should merge what we have no and start a new branch for that?

kylemath commented 4 years ago

we can remove the dist output and the distance calculation, as those are done on the .raw object after once this loading has happened using the mne functions,

we want to embed the location of the "channels" - midpoint of source and detector, into the info.chs as I show here: https://github.com/kylemath/pyoptical/issues/9

kuziekj commented 4 years ago

made some changes to boxy2mne:

-can read either tol or elp files types -adds channel locations (mean of source and detector coords) to info -channel labels now indicate if the data is ac, dc, or ph -outputs a single raw object only (data in the raw object is a combination of ac,dc, and ph data) -requires arguments to be named -removed distance calculations

also updated test2.py

kylemath commented 4 years ago

@kuziekj Differences between example (top) and our info.chs

{'loc': array(
[-4.01877067e-02,  4.46422957e-02,  1.23576592e-01, 
-4.16132047e-02,   2.67997753e-02,  1.29904394e-01, 
-3.76195887e-02,  6.32285163e-02,   1.15728028e-01,  7.60000000e+02,             nan,             nan
'unit_mul': 0, 
'range': 1.0, 
'cal': 1.0, 
'kind': 1100 (FIFFV_FNIRS_CH), 
'coil_type': 302 (FIFFV_COIL_FNIRS_RAW), 
'unit': 107 (FIFF_UNIT_V), 
'coord_frame': 0 (FIFFV_COORD_UNKNOWN), 
'ch_name': 'S1_D1 760', 
'scanno': 1, 
'logno': 1}

{'loc': array(
[3.39876037e-02, 6.84032339e-02, 7.45343585e-02,
1.64620133e-02,  7.40030084e-02, 7.31428970e-02,
 5.15131940e-02, 6.28034595e-02, 7.59258200e-02, 
 8.30000000e+02,            nan,            nan]), 
 'unit_mul': 0, 
 'range': 1.0, 
 'cal': 1.0, 
 'kind': 502 (FIFFV_MISC_CH), 
 'coil_type': 0 (FIFFV_COIL_NONE), 
 'unit': -1 (FIFF_UNIT_NONE), 
 'coord_frame': 0 (FIFFV_COORD_UNKNOWN), 
 'ch_name': 'AC LI03LG01 830', 
 'scanno': 1, 
 'logno': 1}