Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

buzcode format typechecking #85

Open
DavidTingley opened this issue Aug 17, 2017 · 29 comments
Open

buzcode format typechecking #85

DavidTingley opened this issue Aug 17, 2017 · 29 comments

Comments

@DavidTingley
Copy link
Collaborator

-isCellinfo
-isBehavior
-isState
-isPopInfo
-isLFP
-isEvent
-etc, etc

@DavidTingley
Copy link
Collaborator Author

see 585685f for an example

@DavidTingley
Copy link
Collaborator Author

isEvent and isLFP done, 5fa1ccb

@DavidTingley
Copy link
Collaborator Author

DavidTingley commented Sep 1, 2017

isBehavior done,72317529365facac15066a497d1690e0a09b0625

we still need:
-isState
-isPopInfo
-isSessionInfo

@dlevenstein
Copy link
Collaborator

dlevenstein commented Sep 1, 2017 via email

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@juneshuoyang
Copy link
Contributor

juneshuoyang commented Sep 1, 2017

@brendonw1 please see the email communication below.

David wrote:
Partially correct. These functions (so far) aren't meant to check the quality of an entire recording/experiment, rather the individual structures that store parts of the data of an experiment (are all of the required fields present and formatted correctly?). We could eventually wrap them into a 'isCompleteRecording.m' function that satisfies point 1.

Sam wrote:
here is where the minimally complete datatype will be useful

June and I discussed yesterday that we need to formalize two things

  1. the minimally complete data required for an experiment to be included in buzcode format. this will likely change, but we need to decide what our inclusion criteria will be for the database at least at this point in history. for example, if you don't know the region of your shanks, the data is garbage.

  2. the minimal information we want to extract and make searchable in a database. this is obviously a subset of 1.

I imagine that these helper functions will return TRUE only when point 1 is met

David wrote:
Sure, it is a list of function we'll eventually create that check the .mat structs we are using and returns true/false if they conform to our data standard. Essentially the same as something like the matlab builtin function isinterger.m but for the more complicated structures we're making.

June wrote:
Hi David,

I am sorry I do not understand the purpose of this typechecking or this issue (#85) overall.

Can you provide some instructions?

Thank you in advance,
June

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@juneshuoyang
Copy link
Contributor

juneshuoyang commented Sep 1, 2017

Mat Struct IO Function Typecheking Function
SessionInfo bz_getSeeionInfo (To be built)
PopInfo ? (To be built)
CellInfo bz_GetSpikes bz_isCellInfo
LFP bz_GetLFP bz_isLFP
Events bz_LoadEvents bz_isEvent
States bz_LoadStates (To be built)
Manipulation ? ?
Behavior ? ?

@DavidTingley @dlevenstein

I need some help with these:

  1. Please help replace the question marks and confirm the information in the rest of the table above.
  • where can I find bz_isBehavior?
  1. When do you expect users to use these typechecking functions?

  2. Within the IO folder, I can find SaveFeatures.m and bz_GetWidebandData.m. Are these two functions related with any data conversion procedures? If yes, how?

  3. Any other functions not in the IO folder will be useful for converting data in the new format?

@dlevenstein
Copy link
Collaborator

Ah, I'd made a bz_LoadBehavior function a while ago but saved it on my personal github as opposed to buzcode. Just added it to the io folder

https://github.com/buzsakilab/buzcode/blob/master/io/bz_LoadBehavior.m

Note: this may need to be updated to match formatting/functionality of bz_LoadEvents etc.

@dlevenstein
Copy link
Collaborator

dlevenstein commented Sep 1, 2017

  1. The other question marks, to my knowledge, aren't built yet.
    Note also that the standards for some of them aren't yet fully established and should be discussed and documented. (i.e. Manipulation, as I discussed with @samamckenzie yesterday)

  2. Type checking functions should probably be used within the loading functions to make sure that the structure fits the guidelines. Most of the time we'll be loading states/events/etc using these i/o functions and the output will cause issues down the line if things don't conform.
    Any other times you can think of?

David will know more about 3) and 4) than I, the answers are no to the best of my knowledge.

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@samamckenzie
Copy link
Collaborator

samamckenzie commented Sep 1, 2017 via email

@dlevenstein
Copy link
Collaborator

dlevenstein commented Sep 1, 2017

Yes - I think we assume absence of data type is absence in the experiment.

I agree re: traces.
Proposal: Manipulation should have a similar form to the other buzcode formats:
file: baseName.manipulationType.manipulation.mat
-contains structure named manipulationType
manipulationType.timestamps
manipulationType.data (maybe a different name here, magnitude?)
(others needed/suggested?)

for example electrical stimulation could be in a file named
baseName.EStim.manipulation.mat
containing a structure called EStim
with fields EStim.timestamps, EStim.data
which shows the magnitude of electrical stimulation at each timestamp. This is also nice because it allows non-continuous manipulation (i.e. timestamps don't have to be each timepoint in the recording)
recommended samplingRate of the manipulation should match the LFP. Will/should this also be robust for different types of manipulations, for example, sensory stimulation?

UPDATE: put this in the wiki, feel free to improve/modify with discussion https://github.com/buzsakilab/buzcode/wiki/Data-Formatting-Standards#manipulation

@samamckenzie
Copy link
Collaborator

samamckenzie commented Sep 1, 2017 via email

@dlevenstein
Copy link
Collaborator

I think homecage would be tagged as such in the metadata, but no reason to have a whole behavior.mat file that just says "homecage".

On a related note, the behavior.mat guidelines need some refinement. They assume behavior correspond to navigation in space (i.e. x/y position), but actually some of the behaviors will not have this. For example, headfixed behavior, or whisking behavior.

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@DavidTingley
Copy link
Collaborator Author

DavidTingley commented Sep 1, 2017

@brendonw1, check out the example behavior struct in the repo. I think I'm the only one using this format at the moment and it's been working really well for me so far.

@dlevenstein, these fields can be empty and there is an .events sub-structure that I use to store trial information. Additionally, optional extra fields could be added (whiskerPosition, wheelPosition, etc).

@dlevenstein
Copy link
Collaborator

dlevenstein commented Sep 1, 2017

David and Rachel and I just updated the behavior.mat wiki. Could you give it a look through and see if it makes sense and would account for your behavior needs?

https://github.com/buzsakilab/buzcode/wiki/Data-Formatting-Standards#behavior

@DavidTingley I updated the example behavior.mat file in exampleDataStructs.
Saved as fbasename.positionTracking.behavior.mat.
Could you take a look over it and if you agree, delete the depreciated fbasename.behavior.mat?

@DavidTingley
Copy link
Collaborator Author

I've split this out as another issue #97 as there are several functions we will need to change or make for this.

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@dlevenstein
Copy link
Collaborator

much of this was designed with continuous-variable behavior in mind (i.e. x/y position), with the option for event-based behavior as well.

I had this question as well, i.e. much behavior is not continuous time but is in terms of start/stops of events. This sort of behavioral tagging will go in the behaviorName.events substructure (for example, I'll use EMGwhisking.events.whisks for whisking onset/offset). Or you can use positionTracking.events.movement to store on/offset of movement in homecage recordings

Most behavior tracking comes from a continuous signal (motion etc), which can still be stored for reference in the timestamps/samplingrate/datasubstructs

Do you think that addresses your concern?

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@dlevenstein
Copy link
Collaborator

dlevenstein commented Sep 1, 2017

I think I'm a little confused as to your concern then? You can have start/stop times in the events field of your behavior structure. Which are in seconds so can have whatever resolution you want.

If someone wants 20kHz resolution for a continuous signal, you would need a time point for each. But it sounds like what you're worried about is a 20kHz behaviorA vs behaviorB vector, which is not what we're imagining. The timestamps/datasubstrct is for continuous signals like position/orientation.

i.e. "scoring" behavior will be in stop/start times
timestamps/data will be only for continuous signals

(scored behavior would be saved in the events subfield. but we can change this is you would like, this is just what @DavidTingley and I came up with to meet halfway between our needs. it if needs updating, we can discuss and update, which is the point of discussion here (this has been the topic of all day discussion at this point...)) David and most everyone expressed need for a continuous behavior variable

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 1, 2017 via email

@dlevenstein
Copy link
Collaborator

Yes! It's unclear to me at this point where such a thing should live. Possibly could be in this data type...

But perhaps in a sessioninfo file? Either as part of the main metadata or as a separate recordingEpochs.sessionInfo.mat file which has Info about any major time windows of the recording (I.e homecage vs maze or times of merged .Dats)

@brendonw1
Copy link
Collaborator

brendonw1 commented Sep 2, 2017 via email

@dlevenstein
Copy link
Collaborator

A reminder here (for myself) that this issue will be completed once bz_isStates is completed.

@dlevenstein
Copy link
Collaborator

We might want to change this behavior.... it comes up when loading so many things (events etc)

Warning: one of the required fields for an behavior type does not exist

In bz_isBehavior (line 35)
In bz_LoadBehavior (line 46)
Warning: Your behavior structure does not meet buzcode standards. Sad.
In bz_LoadBehavior (line 49)
Warning: one of the required fields for an behavior type does not exist
In bz_isBehavior (line 35)
In bz_LoadBehavior (line 46)
Warning: Your behavior structure does not meet buzcode standards. Sad.
In bz_LoadBehavior (line 49)
Warning: one of the required fields for an behavior type does not exist
In bz_isBehavior (line 35)
In bz_LoadBehavior (line 46)
Warning: Your behavior structure does not meet buzcode standards. Sad.
In bz_LoadBehavior (line 49)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants