echemdata / galvani

Read proprietary file formats from electrochemical test stations
GNU General Public License v3.0
47 stars 30 forks source link

how to find Dtype for unknown columns ? #113

Closed oliverfernihough closed 6 months ago

oliverfernihough commented 6 months ago

i am running the galvani on some data in MPT from a BT-Lab

ususally the files work fine but i encountered, unknown column error for the following columns:

14: ("x", "<f4"), #unknown dtype 40: ("Q charge/mA.h", "<f8"), #unknown dtype 41: ("Q discharge/mA.h", "<f8"), #unknown dtype 119: ("Re(Y)/Ohm-1","<f4"), #unknown dtype 120: ("Im(Y)/Ohm-1","<f4"), #unknown dtype 121: ("|Y|/Ohm-1","<f4"), #unknown dtype 175: ("Efficiency/%", "<f8"), # unknown dtype 443: ("Capacity/mA.h", "<f4"), #unknown dtype

i added these lines of code to the VMPdata_colID_dtype_map

im not too sure of the dtype, maybe someone knows how i can find out what it is ?

Traceback (most recent call last): File "c:\Users...\Oliver - Personal\data_analysis\test galvani.py", line 5, in mpr_data = BioLogic.MPRfile(filepath) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "C:\Users\OliverFernihough\AppData\Local\Programs\Python\Python312\Lib\site-packages\galvani\BioLogic.py", line 541, in init self.data = np.frombuffer(main_data, dtype=self.dtype) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ ValueError: buffer size must be a multiple of element size

this is the error i got, which i think is to do with the dtype, i am a little new to decoding binary so any advice or help would be greatly appreciated

ml-evs commented 6 months ago

Your best bet is just to guess and then make sure the values match what you expect from other programs... the dtypes follow numpy's so e.g., f8 is an 8-byte/64-bit float (or double) and f4 is a 4-byte/32-bit float, if that wasn't already apparent.