Skip to content

Commit 3a078b9

Browse files
committed
no LUT needed for EPG files if read in as floating point instead of integer
1 parent 13c57e0 commit 3a078b9

File tree

3 files changed

+8
-44
lines changed

3 files changed

+8
-44
lines changed

src/load-epg-lut.npy

-189 KB
Binary file not shown.

src/load-epg-make-lut.py

Lines changed: 0 additions & 31 deletions
This file was deleted.

src/load-epg.py

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,9 @@
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

108
import re
119
import numpy as np
@@ -31,15 +29,13 @@ def audio_read(fullpath_aq8_rec, start_tic, stop_tic,
3129
fid.seek(4*nchan*start_tic, 1)
3230
b = fid.read(4*nchan*(stop_tic-start_tic))
3331

34-
v = np.frombuffer(b, dtype=np.uint32)
32+
v = np.frombuffer(b, dtype=np.float32)
3533
a = np.reshape(v, (-1,nchan))
3634

3735
chs = audio_read_rec2ch()[rec]
3836
s = a[:, chs]
3937

40-
i = np.searchsorted(lut[:,0], s)
41-
m = np.take(lut[:,1], i)
42-
c = (m / 10 * np.iinfo(np.int16).max).astype(np.int16)
38+
c = (s / 10 * np.iinfo(np.int16).max).astype(np.int16)
4339

4440
return sampling_rate, (nsamples,len(chs)), c
4541

@@ -49,6 +45,5 @@ def audio_read_exts(nchan=8, **kw):
4945
def audio_read_rec2ch(nchan=8, **kw):
5046
return {"rec"+chr(65+i):[i] for i in range(nchan)}
5147

52-
def audio_read_init(lut_file="load-epg-lut.npy", **kw):
53-
script_dir = os.path.abspath(os.path.dirname(__file__))
54-
global lut = np.load(os.path.join(script_dir, lut_file))
48+
def audio_read_init(**kw):
49+
pass

0 commit comments

Comments
 (0)