Closed swharden closed 1 month ago
This seems to be some type of off-by-one error.
Load the ABF in ClampFit and save it as a new file with the "save as type" set to "floating point", then load that with pyabf
This may be helpful for implementing a true fix
header variable | broken ABF | saved ABF |
---|---|---|
nDataFormat | 0 (int) | 1 (float) |
lEpisodesPerRun | 30 | 29 |
lNumSamplesPerEpisode | 1000000 | 999995 |
nWaveformSource | all 1s | all 0s |
SynchArraySection.lLength | all 1000000 | all 999995 |
It looks like the number of points per sweep is sourced here
And for the file in question, the value returned is different.
print(abf1._dataSection._entryCount) # 29997952 - file that wont load
print(abf2._dataSection._entryCount) # 28999855 - file that will load
When lNumSamplesPerEpisode
times SweepCount
equals dataPointCount
things are okay...
Following-up, this works:
abf = pyabf.ABF(R"24215056.abf", loadData=False)
abf.dataPointCount = abf._protocolSection.lNumSamplesPerEpisode * abf._headerV2.lActualEpisodes
for i in range(abf.sweepCount):
abf.setSweep(i, channel=1)
print(abf.sweepY)
I think this issue is affecting the original file because it uses variable length sweeps and may need to be pulling sweep lengths from the SynchArraySection
(or not?)
Hi Scott,
Thanks a lot for following up on this. Is the problem due to variable length sweeps? I tonight PClams doesn’t save files with sweeps with variable lengths, anyway. I’m confused about how this happened in the first place.
reported in an email from Verjinia