Skip to content

MRG: Additions to fine-calc - #26

Merged
larsoner merged 4 commits into
larsoner:fine-calcfrom
wronk:fine-calc-fix
Apr 1, 2016
Merged

larsoner merged 4 commits into
larsoner:fine-calcfrom
wronk:fine-calc-fix

Conversation

@wronk

@wronk wronk commented Mar 28, 2016

Copy link
Copy Markdown
  • Indexing error
  • write fine calibration to .dat file
  • write round trip tests for loading/saving .dat files
  • After merging, open PR to update _read_fine_cal function within maxwell.py to use the new version of the function in _fine_calc.py that passes the calib. info in a dict

@larsoner

Copy link
Copy Markdown
Owner

Want to fix the docstring while you're in there?

@wronk

wronk commented Mar 28, 2016

Copy link
Copy Markdown
Author

Yep, np

@wronk

wronk commented Mar 28, 2016

Copy link
Copy Markdown
Author

So there's a little bit of inconsistency in the current read/write functions.
read_fine_cal takes a filename and returns a tuple of the channel names and their fine cal info:

return cal_chs, cal_ch_numbers

write_fine_cal, on the other hand, takes a calibration dict that currently must contain ch_names, locs, and imb_cals as keys. Should we standardize this? Do you care which function we remold? We usually want to get all the channel into one big array asap, so combining locs and imb_cals might make more sense.

@wronk

wronk commented Mar 28, 2016

Copy link
Copy Markdown
Author

Also, okay to put this load/write round trip test in test_maxwell.test_fine_calibration()?

@larsoner

Copy link
Copy Markdown
Owner

read_fine_cal takes a filename and returns a tuple of the channel names and their fine cal info:

I would probably make both deal with the "complete representation", i.e. the dict. Then whatever uses read_fine_cal should take the dict convert to cal_chs and cal_ch_numbers. Make sense?

Also, okay to put this load/write round trip test in test_maxwell.test_fine_calibration()?

It's a bit misleading because it's actually independent of Maxwell filtering. In principle fine cal could be used for other things, e.g. inversion. So I'd make a new file like test_fine_cal.py just for the IO. That way test_maxwell can be dedicated to actually doing MF.

Comment thread mne/preprocessing/_fine_cal.py Outdated
check_fname(fname, 'cal', ('.dat',))
raise NotImplementedError

# TODO: Figure out if write or write+binary mode is best

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use wb and e.g. cal_file.write((cal_str + '\n').encode('ASCII')), it's clear you're writing an ASCII-encoded file that way

@wronk

wronk commented Mar 31, 2016

Copy link
Copy Markdown
Author

I would probably make both deal with the "complete representation", i.e. the dict. Then whatever uses read_fine_cal should take the dict convert to cal_chs and cal_ch_numbers. Make sense?

Yep, sounds good. The inconsistency is actually in maxwell.py -- sorry for the mistake. I added a checkbox to update that function as soon as this gets merged.

@wronk wronk changed the title WIP: Additions to fine-calc MRG: Additions to fine-calc Mar 31, 2016
@wronk

wronk commented Mar 31, 2016

Copy link
Copy Markdown
Author

@Eric89GXL, ready for review :)

@larsoner

larsoner commented Apr 1, 2016

Copy link
Copy Markdown
Owner

Nice, thanks @wronk

@larsoner
larsoner merged commit 21503a3 into larsoner:fine-calc Apr 1, 2016
larsoner added a commit that referenced this pull request Nov 20, 2020
…ast signal (mne-tools#7717)

* debugged import function, plotting locations kinda works, dists calculate, data flat

* fixed name for return in utils.py

* extra newline in boxy.py

* fixing newlines

* removed call to findfiducials

* removed mne calls

* revert to import mne to debug data

* working data load and plot, needed to divide expected data by 16 for each source

* pull sorce number from code

* working plotting with rescale

* fixed import of coreg function

* removed transform into fsaverage since it already was there

* working through bug plotting dig

* working example

* working version that loads in coordiantes and transforms correctly

* fixed review comments

* created gratton_emcp_epochs function in preprocessing/eog.py

* revert commit to master

* fix

* revert

* fix

* space
;

* initialize new branch with boxy.py file and folder in io with tests

* fixing eog nonchange

* fix

* fix

* rebase fix?

* fix?

* added dataset import information

* updated dataset stuff

* correct  hash from osf

* working data load

* debuging loading file

* debugged import function, plotting locations kinda works, dists calculate, data flat

* fixed name for return in utils.py

* extra newline in boxy.py

* fixing newlines

* removed call to findfiducials

* removed mne calls

* revert to import mne to debug data

* working data load and plot, needed to divide expected data by 16 for each source

* pull sorce number from code

* working plotting with rescale

* fixed import of coreg function

* removed transform into fsaverage since it already was there

* working through bug plotting dig

* working example

* working version that loads in coordiantes and transforms correctly

* fixed review comments

* created gratton_emcp_epochs function in preprocessing/eog.py

* revert commit to master

* fix

* revert

* fix

* space
;

* rebase from import to fix pandas use

* filetype now determined in RawBOXY and passed to _read_segment_file. Changed subjects_dir to use fetch_fsaverage as I was getting errors about surfaces or fiducial files missing

* removed pdb

* new data file with more files

* tested new dataset, added four new keys for four montages, and testing loading in each one in place of 001

* pulling in source detector plotting temporarily

* WIP trying to load multiple boxy files

* seems to be working...will find multiple files and combine all the data into a large array, with marker info added to the end from each file

* boxy.py now takes a datatype arguments to return only AC, DC, or Ph data

* changed tutorial to plot montage a and b

* updated dataset P1 with arr

* added new dataset with better variable names, removed look for .tol file

* made some changes based on comments. re-organised channels so lower wavelength is first, to keep scalp_coupling_index happy

* pushed the wrong tutorial file, this should fix that

* style changes for flake8 on boxy.py

* tested parsed data set, channel numbers considered across all montages, added messages indicating data size for all blocks and montages

* blocks are now appended together, so data is now n channels by (m timepoints x b blocks). removed block and montage indicators from channel labels, and change plot_80 tutorial to take the label changes into account

* added markers to indicate the end of each block. will also check for event files and place those in the marker channels, if the files exist

* marker channel kind is now stim instead of fnirs_raw, coords are no longer transformed

* went through entire boxy tutorial to create and compare epochs

* added a few messages to print if markers are found or not, for each montage and block

* updated dataset

* marker times were off, had to change so first_samp and last_samp refer to sample number in the data structure, not lines from the file

* phase data will be unwrapped, detrended, and outliers removed

* added conversion of phase to pico seconds

* initial push to create PR

* tutorial will now combine montages and plot results of this combination

* added wrong file to earlier commit

* working on adding two new data types, fnirs_ac and fnirs_ph

* made test script in temporary dev folder

* phase data will be unwrapped, detrended, and outliers removed

* added conversion of phase to pico seconds

* working on adding two new data types, fnirs_ac and fnirs_ph

* made test script in temporary dev folder

* all plots except haemo should now be able to handle fnirs_ph, might not need all of them though

* changed ph default scale

* removed some commented code

* added sections to plot both AC and Ph data

* changed time scale of ac data to 10 sec, replaced raw ac with haemo for plotting

* now only plots AC haemo and phase data. Cleaned up formatting

* plot_80 and boxy.py should now hopefully conform to pep8

* fixed flake8 on boxy.py

* flake8 on other files

* removed dev folder

* a few more

* only combined montages plotted, scales have been adjusted, fixed change in optical density

* in progress changes for testing

* further changes for tests

* fixed some apparent style issues, removed print statements added previously

* more fixes, and removed forgotten print commands

* fixes for style and CI tests

* start of making the tutorial a bit more simple

* removed some plots to keep total under 20, and keep CI test happy

* changed filter settings so an error is not returned

* quick change to see if comment characters change html test

* testing out a method of plotting hbo and hbr evoked

* added more to difference evoked subplot, fixed a missing variable

* removed code for older plots

* missing blank line at end of eog.py

* removed stray print statement

* made sure files are sorted in the correct order

* made changes for checklist

* table of contents should now display properly

* added references, and description, of boxy example dataset

* fixed style issue in plot_80

* addressed some checklist items

* updated info about boxy dataset

* should now only read in boxy data file (#26)

* should now only read in boxy data file

* added tutorial and test for loading boxy data, remove plot_80 tutorial and reference for now

* now will only load a single boxy file

Co-authored-by: Kyle Mathewson <[email protected]>

* Events from raw data file are added as annotations (#27)

* events from raw data file are added as annotations

* ignores conssecutive trigger repeats in digaux, added tests for filetypes and digaux

* fixed some typos

* fixed more spelling and style errors

* changed filenames to match testing data set (#29)

* changes to make ci tests happy

* removed print statements and references to old dataset

* removed extra blank space

* Addressing reviewer comments (#30)

* addressing comments

* addressed more comments. Reader will return all data types

* removed reference to fnirs_fd_phase

* removed reference to degrees for fnirs_fd_phase

* added line to return channel type

* working through review

* fixed indent bug

* adding new channel info throughout codebase

* fixing merging errors

* FIX: Fix constants, reading, tests

* ENH: Efficient read

* Update tutorials/io/plot_30_reading_fnirs_data.py

Co-authored-by: Robert Luke <[email protected]>

* Update tutorials/io/plot_30_reading_fnirs_data.py

Co-authored-by: Robert Luke <[email protected]>

* updated plot_30 tutorial boxy info

* typo

* FIX: SI units and backticks

* FIX: Unit

* FIX: Wording, comma

Co-authored-by: Jonathan Kuziek <[email protected]>
Co-authored-by: Eric Larson <[email protected]>
Co-authored-by: Robert Luke <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants