Skip to content

nigeLab_Parsing_Block

Page Hayley edited this page Jun 22, 2021 · 3 revisions

How does nigeLab automatically parse metadata?

Really, it doesn't; instead, nigeLab assumes that you will use a consistent naming convention for all your recordings of a given experiment. You can set that up here. You can also rename your recording files using any number of convenient batch filename renaming tools you can find online or use the handy naming configurator.

Example

Consider the first recording (Block) of the first Animal extracted using nigeLab_demo.m (if you haven't checked that, look here first). Its name is:

'R19-94_2019_05_27_Site2A-Solenoid-0_190527_100729'

The delimiter between fields, in this case, is the underscore. The delimiter separates the pieces of metadata included in the filename.

pars.Delimiter   = '_';

The naming convention is defined by assigning each piece (separated by the above delimiter) an assigned variable name in +nigeLab/+defaults/Block.m.

pars.NamingConvention={'$AnimalID','$Year','$Month','$Day','$RecID', '$RecDate' '$RecTime'}; 

If you have a different naming convention, you can modify this line of code to include the appropriate amount of fields and your variable names. Please note that the parsed metadata variables follow a CamelCase naming convention, which may be convenient to follow to facilitate future development. The characters $ and ~ are used to denote which variables you wish to keep or discard as metadata in the block.

pars.IncludeChar='$';
pars.DiscardChar='~';

There are two "special" metadata fields which must be parsed in some way, or else they will be automatically created using a random alphanumeric combination. These are:

  • AnimalID
  • BlockID

About SpecialMeta

The pars.Block.SpecialMeta structure lists the field names that have "special" parsing under pars.Block.SpecialMeta.SpecialVars. These designated fields should have the following sub-fields:

  • .vars : What variables (parsed from the filename using pars.NamingConvention) should be included in creating the new field identifier?
  • .cat : How are the parsed variables that go into the identifier concatenated? (Typically, '-' is good)

These "special" metadata use the VarExprDelimiter cell array to split up the "special variables" into corresponding metadata; that way if there is a "coarse" parsing (e.g. using '_' to denote variables that correspond to some fixed thing like a video angle or trial block metadata), each "coarse" element can have a "nested" fine element (e.g. if the coarse parsed variable value is 'Left-A', the "fine" parsed variable values are 'Left' and 'A').

Using the example above, you could create a unique BlockID with the 'AnimalID','Year','Month','Day',and 'RecID' variables.

pars.SpecialMeta.SpecialVars = {'BlockID'};
pars.SpecialMeta.BlockID.vars = {'AnimalID','Year','Month','Day','RecID'};
pars.SpecialMeta.BlockID.cat = '_';

The resultant BlockID should then be 'R19-94_2019_05_27_Site2A-Solenoid-0'.

Clone this wiki locally