swharden / pyABF

pyABF is a Python package for reading electrophysiology data from Axon Binary Format (ABF) files

Home Page:https://swharden.com/pyabf

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Acces to Telegraphed Gain

Asrilioss opened this issue · comments

Hi,

I didn't find a way to acces to the Telegraphed Gain of the Digitizer channel. I dont know if is possible to do so, I have acces to it if I double click on "Vm_scaled" in Clampfit for exemple it show Signal : Name, Units, V/mV, @ 0 V and telegraphed gain. But accessing it by coding would be perfect.

I ask that to code something how check if the gain didn't change between two folders.

Thanks you,

Hi @Asrilioss, this may be possible! It's a lot of info, but if you inspect the ABF header like this you may find the variable name you're looking for:

https://swharden.com/pyabf/tutorial/#inspect-the-abf-header

It will generate a report like: https://github.com/swharden/pyABF/blob/main/data/headers/2020_07_29_0062.md#adcsection

Maybe something like

print(myAbf._adcSection.fTelegraphAdditGain[0])

The 0 is the ADC channel, and you may need to try several numbers to get it right

Yeah I just found that I need to look at header I was looking headerV2 but your faster, thanks you for your answers and a fast one, this work perfectly, do you know if is a value I can change ?
Ty

this work perfectly

Great to hear! 🚀

do you know if is a value I can change?

Interesting question! I don't think so... that is read when the ABF is first loaded, and all the data is loaded and scaled by that value when the class is initialized, so changing it later probably won't have an effect

pyABF/src/pyabf/abf.py

Lines 466 to 484 in 06247e0

def _loadAndScaleData(self, fb: BufferedReader):
"""Load data from the ABF file and scale it by its scaleFactor."""
# read the data from the ABF file
fb.seek(self.dataByteStart)
raw = np.fromfile(fb, dtype=self._dtype, count=self.dataPointCount)
nRows = self.channelCount
nCols = int(self.dataPointCount/self.channelCount)
raw = np.reshape(raw, (nCols, nRows))
raw = np.transpose(raw)
# if data is int, scale it to float32 so we can scale it
self.data = raw.astype(np.float32)
# if the data was originally an int, it must be scaled
if self._dtype == np.int16:
for i in range(self.channelCount):
self.data[i] = np.multiply(self.data[i], self._dataGain[i])
self.data[i] = np.add(self.data[i], self._dataOffset[i])

However you could probably reach in and modify what's in abf.data[channel] based on your needs, then SetSweep() calls later would returned that modified data.

Good luck!