1- # to analyze Electrical Penetration Graph (EGP; https://epgsystems.eu) data,
2- # first create a lookup table using load-epg-make-lut.py. then use the .aq8
3- # files directly using this plugin. the .D0x files that stylet+ automatically
4- # creates can be deleted (as can any .A0x files).
1+ # .aq8 files from Electrical Penetration Graph (EGP; https://epgsystems.eu)
2+ # systems can be read in directly. the .D0x files that stylet+ automatically
3+ # creates are not needed (nor are any .A0x files).
54
65#audio_read_plugin="load-epg"
7- #audio_read_plugin_kwargs={"nchan":8, "lut_file":"load-epg-lut.npy",
8- # "ncomments":3, "Fs":"smpl.frq= ([0-9.]+)Hz"}
6+ #audio_read_plugin_kwargs={"nchan":8, ncomments":3, "Fs":"smpl.frq= ([0-9.]+)Hz"}
97
108import re
119import numpy as np
@@ -30,15 +28,13 @@ def audio_read(fullpath_aq8_rec, start_tic, stop_tic,
3028 fid .seek (4 * nchan * start_tic , 1 )
3129 b = fid .read (4 * nchan * (stop_tic - start_tic ))
3230
33- v = np .frombuffer (b , dtype = np .uint32 )
31+ v = np .frombuffer (b , dtype = np .float32 )
3432 a = np .reshape (v , (- 1 ,nchan ))
3533
3634 chs = audio_read_rec2ch ()[rec ]
3735 s = a [:, chs ]
3836
39- i = np .searchsorted (lut [:,0 ], s )
40- m = np .take (lut [:,1 ], i )
41- c = (m / 10 * np .iinfo (np .int16 ).max ).astype (np .int16 )
37+ c = (s / 10 * np .iinfo (np .int16 ).max ).astype (np .int16 )
4238
4339 return sampling_rate , (nsamples ,len (chs )), c
4440
@@ -49,5 +45,4 @@ def audio_read_rec2ch(nchan=8, **kw):
4945 return {chr (65 + i ):[i ] for i in range (nchan )}
5046
5147def audio_read_init (lut_file = "load-epg-lut.npy" , ** kw ):
52- script_dir = os .path .abspath (os .path .dirname (__file__ ))
53- global lut = np .load (os .path .join (script_dir , lut_file ))
48+ pass
0 commit comments