Ok, first: although the analysis module system is pretty well tested and functional, it has a few design decisions that I am no longer happy with. Most recently I have been working with a new analysis system that I think has a better architectural design, but it is considerably less mature (https://github.com/AllenInstitute/neuroanalysis). Moving forward, I will be focusing on this system and importing these tools into ACQ4 for online analysis. I am also considering implementing ACQ4 analysis modules just as regular modules (rather than having an entirely separate module system for analysis).
Maybe if you tell me more about what you want to do, then I can point you in the right direction?
Luke
Ok, first: although the analysis module system is pretty well tested and functional, it has a few design decisions that I am no longer happy with. Most recently I have been working with a new analysis system that I think has a better architectural design, but it is considerably less mature (https://github.com/AllenInstitute/neuroanalysis). Moving forward, I will be focusing on this system and importing these tools into ACQ4 for online analysis. I am also considering implementing ACQ4 analysis modules just as regular modules (rather than having an entirely separate module system for analysis).
Maybe if you tell me more about what you want to do, then I can point you in the right direction?
Luke
From: ac...@googlegroups.com <ac...@googlegroups.com> on behalf of Michael Graupner <graupner...@gmail.com>
Sent: Monday, October 30, 2017 7:48:26 AM
To: ac...@googlegroups.com
Subject: [acq4] writing a new ACQ4 analysis module
Hello,
I would like to write an analysis module in ACQ4 for ACQ4 data. Does some first step documentation exist somewhere on how to do this? I thought I have seen some instructions somewhere but cannot find it. Any hints would be greatly appreciated.
Thanks in advance.
Best,
Michael Graupner
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/CAFVjdW%2BwfaumyYb8q9%2BRXcosSAyk4ogcdzOX4X-9XF%2Bxq0VXHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/MWHPR12MB12948238C88B2DAD49E336E6C9590%40MWHPR12MB1294.namprd12.prod.outlook.com.
It’s a big topic! What makes a good analysis infrastructure? I have found analysis to be much more difficult to generalize than acquisition, so the tendency here is toward having a larger number of very small, reusable pieces. One of the themes you’ll see here is “separation of concerns” – as much as possible, keep your visualization code separate from analysis, separate from data reading, separate from database management, etc. This will allow you to build tools that are reusable, so that you don’t feel like you’re starting from scratch every time.
Things I have been working on:
* A data abstraction layer – something that represents the basic components in your data in a way that is agnostic to the actual format of the data on disk. This has two important benefits: 1) it future-proofs your code against changes in the data format over time, and 2) it forces you to separate the logic of reading your data from the logic of analyzing it. The “data model “ system in ACQ4 was a first attempt at this, but it turned out to be difficult to use. I am much happier with the data abstraction system here: https://github.com/AllenInstitute/neuroanalysis/blob/master/neuroanalysis/data.py
* Functions and classes that perform just one particular kind of analysis each, with no data handling (reading/writing) or user interface code. You will want to be able to call these functions many different ways, from many different contexts. (examples: neuroanalysis/fitting.py, event_detection.py, etc.)
* Reusable user interface tools. Making reusable UI tools is a lot more work than just writing the UI for a single specific use case. However, it begins to pay off in the cases where you want a similar functionality in more than one context. For example, a very common type of interaction for us is to plot a signal from which we will detect events (perhaps a calcium trace, or a recording of evoked synaptic currents), and on top of that we have a line showing the threshold at which events are detected, and tick marks showing the events that were detected. If the user moves the threshold line, then the events are re-detected and the tick marks update. Because we have repeated this motif in so many different places, it made sense to encapsulate it in a single class that creates the plot line, threshold line, tick marks, and a set of control parameters. Then for each specific use case, we can just insert these elements wherever they are needed in the UI. So a common theme here is that a reusable UI tool contains references to multiple UI elements (but does not attempt to assemble them into a final window or layout), and also the code that functionally connects these elements and calls out to the actual analysis functions.
* Reusable visualization tools. If you write the code to display the results of a particular analysis, keep it separate from the rest of your UI. Chances are good that you will want to display that same result again, but in a different context (for example, it’s common to visualize a result immediately after it is generated, but then to want to see the result later on by reloading from the stored analysis file or from a database).
* A set workflow for performing analyses, where each analysis generates a new file (don’t modify existing files). Ideally, these results become part of your data abstraction layer, so that you can re-load them alongside your data.
* A database for cataloging similar experiments. The point here is to take all of the “messy” raw data and force it all into nice rectangular tables, so that every experiment has the same format, and the results of the primary analyses for each experiment can be compared easily. For a small number of experiments, it might be easiest just to do this manually in a spreadsheet. As you get more and more experiments, it may become worthwhile to automatically construct this database from raw data (perhaps just saving it as a set of csv files, for example), so that it can be completely regenerated from raw data and analysis result files whenever you want to modify your analysis. For even larger experiments, you may eventually reach a point where you need a full SQL database to manage all of your data efficiently. ACQ4 has a database system based on sqlite that works reasonably well, and my latest project uses a postgres database. In both cases, building the database was a lot of work, but ultimately allowed us to do the high-level analyses that we needed.
That’s all for now. I think we could write a book on this topic when we are done..
--
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/CAFVjdW%2BwfaumyYb8q9%2BRXcosSAyk4ogcdzOX4X-9XF%2Bxq0VXHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+uns...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/MWHPR12MB12948238C88B2DAD49E336E6C9590%40MWHPR12MB1294.namprd12.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to
acq4+uns...@googlegroups.com.
To view this discussion on the web visit
https://groups.google.com/d/msgid/acq4/CAFVjdWKMdsKa51A1BbOC7DtOdv5o%2BMHz%2BOSAbeAHg1SaD7u70Q%40mail.gmail.com.
--
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/CAFVjdW%2BwfaumyYb8q9%2BRXcosSAyk4ogcdzOX4X-9XF%2Bxq0VXHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/MWHPR12MB12948238C88B2DAD49E336E6C9590%40MWHPR12MB1294.namprd12.prod.outlook.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/CAFVjdWKMdsKa51A1BbOC7DtOdv5o%2BMHz%2BOSAbeAHg1SaD7u70Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "ACQ4" group.
To unsubscribe from this group and stop receiving emails from it, send an email to acq4+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/acq4/MWHPR12MB1294C321434FC68EA35E6F8AC9500%40MWHPR12MB1294.namprd12.prod.outlook.com.
Dear Luke,thank you for providing all those insights. It makes sense when reading it.I didn't get one point : "A set workflow for performing analyses, where each analysis generates a new file (don’t modify existing files)." What do you mean by set workflow ?
At some point, I have to created data structures which contained all information, the raw data and the analyzed data related to an experiment. What do you think of that?
I tried to get an example of "neuroanalysis" working in order to see your ideas in practice. However, the raw data for"test_event_detection.py": "test_data/synaptic_events/events1.npz"or for"test_psp_fit.py": "psp.csv"seems to be missing. Or am I missing something?