byte-physics / x-to-nwb

Convert various patch-clamp data formats to NWBv2
Other
3 stars 6 forks source link

wrong stimulus amplitude/frequency in converted abf files #5

Closed tmchartrand closed 3 years ago

tmchartrand commented 3 years ago

For the converted files I've looked at, all sweeps for a given long square pulse protocol (LSCOARSE) are fixed to the same stimulus amplitude, although it can be clearly seen from the responses that this is incorrect.

Oddly, this is not the case for a very similar repeat of the protocol, under the code STEPS#0. Maybe this is an issue with the protocol atf files (included) - I'm unclear what information is supposed to be in there. I do get the warning "Could not find the scale factor for the stimset {stimset}, using 1.0 as fallback.", but it seems that the scale factor is only applied at the protocol level, not each sweep, so is unlikely to be the issue.

A similar issue can be seen in the TRIPLE stimuli, which are supposed to be sets of three pulses at varying frequencies - after conversion, the stimulus frequency is identical across all repeats, although the response clearly shows different frequencies.

Here's an example: https://www.dropbox.com/s/kfwoclvbhc92j5k/abf_conversion_test.zip?dl=0 (pdf dump of converted file attached) H18.29.135.11.23.07.pdf

I've reached out to someone from the lab that recorded these for any insights he may have, will update here or loop him in directly when I get a response.

tmchartrand commented 3 years ago

Here's some info from Mansvelder lab folks on this issue:

We think the problem lies with the way we generated stimulus protocols in Clampex. For all stims that were scaled, we used atf files as attachments in protocols and these stim files were scaled outside of Clampex for each cell. We also had problems with getting the stimulus info from abf files, that’s why we started recording the actual stimulus in a separate channel. So all abf files should have one channel with the recording (usually it is IN#0) and one with the injected currents (IN#4). For our own analysis we used those recorded currents, although they are more noisy than pure stim files.

I'm still not clear with them exactly how the stimuli were scaled, but it sounds like that information may be challenging to extract. I'm not going to try to pursue using the stimulus recording channels directly, but it still might be helpful if you're able to look into this briefly and see if the scaling info is in the abf someplace we've missed.

tmchartrand commented 3 years ago

After further discussion it seems the primary issue here is that the atf stimulus templates were changed for each cell and yet not saved, so the information is likely not recoverable. Closing for now.