ContextLab / quail

A python toolbox for analyzing and plotting free recall data
http://cdl-quail.readthedocs.io/en/latest/
MIT License
20 stars 10 forks source link

weekly reports: simplifying syntax #32

Closed jeremymanning closed 7 years ago

jeremymanning commented 7 years ago

there's a lot of repeated/copied code-- e.g. copying the same command for experiments 1 -- 6. instead, these should be written as loops. we can specify a list of labels to go with each experiment number, and then each command should loop through that list to create the plots.

jeremymanning commented 7 years ago

also, given that these loops will be repeated, it'd be nice to have a function for creating the same type of plot for each of a list of eggs. e.g.:

myplotfun = <function for making a plot; argument: an Egg object> q.multiplot((egg1, egg2, egg3, ..., eggN), myplotfun)

andrewheusser commented 7 years ago

the analysis type is inferred by a field attached to the egg (egg.analysis_type) so the plot function knows what to do. Perhaps we can just extend the analyze and plot functions accept lists:

analyzed_list = q.analyze([egg1, egg2, egg3, ..., eggN], analysis='spc')
q.plot(analyzed_list)
andrewheusser commented 7 years ago

additionally, if there is a list of analyses, a list could also be returned:

analyzed_list = q.analyze(egg1, analysis=['spc', 'pfr','lagcrp','fungerprint'])
jeremymanning commented 7 years ago

Perfect-- and if there's a list of eggs and a list of symbols, it'd be a list of lists

andrewheusser commented 7 years ago

the analyze function can now do lists of eggs and analyses. i haven't implemented lists for the plotting function yet...wanted to get thoughts on the best way to do it. In particular, we'll want an easy way to handle different parameters for each plot, like the title or plot_style..and I havent figured out a great way to do it cleanly. ideas?

jeremymanning commented 7 years ago

Can we use a similar syntax to hypertools, but replace dataframes/matrices with eggs? In other words, allow each optional argument to be specified as a single value (applied to every egg's plot) or as a list of length number-of-eggs.

andrewheusser commented 7 years ago

this is a couple different issues, some of which are implemented, so im going to close this and reopen new issues with whats left.

-Analyze can now take lists of eggs and lists of analyses and return lists (or nested lists). -Plot can take a list of analyzed_data, and plot it

What's left is:

-Plot handling lists of key word args (which will require some refactoring)