Am 2/4/25 um 01:26 schrieb Matthias Klumpp:
Am Mo., 3. Feb. 2025 um 18:45 Uhr schrieb Alois Schlögl <alois.schlo...@gmail.com>:

    [...]
    Dear Matthias,


    thanks for your offer to help. From my point of view, this would be
    appreciated.
    Please find below my assessment of the state of stimfit in debian:

    - It should be possible bring stimfit 0.16.4-1.1 into
    bookworm-backports
    as is.

    - Concerning sid, this might be tricky because of the current
    dependency
    on the old distutils. At this time, I'm not positive that I could
    do the
    migration to numpy>=2 and the new distutils within the time frame
    of the
    release of trixie. If you know how to address this, your
    contribution is
    most welcome.


Oh wow, this is a lot more than I expected, and that also explains why the package isn't in unstable yet...
I can have a look though!

    - What is possible is disabling the embedded python (using
    "./configure
    --disable-python ..."). That's what we call "stimfit-lite" on the
    project homepage https://github.com/neurodroid/stimfit . What I can
    offer is preparing an upload for a stimfit-lite (w/o python
    support) for
    Debian.
    - This would mean that the debian package "python3-stfio" would
    not be
    available. Some of its functionality could be replaced by
    python3-biosig
    <https://packages.debian.org/unstable/python3-biosig> . [1] provides
    some starting points how to do this. However, full compatibility
    is not
    available at this time.


Our lab uses python3-stfio specifically to load CED binary CFS files, which as far as I know can't be reliably done with any other tool. So, it would be neat to keep that support. Migrating Python build systems is just about the least fun thing I can imagine, but the Numpy transition might not be too bad depending on how stimfit uses it (I have done that in a different project and it was simple, however, usage of the API was also fairly basic there).

I'll have a look...

Best,
    Matthias

--
I welcome VSRE emails. See http://vsre.info/

You should be able to load your CED binary CFS file with the attached script demo2.py when adapting FILENAME and installing biosig for python like this:

sudo apt install python3-biosig

or
sudo apt install libbiosig-dev
# set up your python env
pip install biosig

# adapt FILENAME in demo2.py and run
python demo2.py


If it does not work, let me know

Alois

####### Demo for Python interface to BioSig" #####################
###
###  Copyright (C) 2009,2016 Alois Schloegl <alois.schlo...@ist.ac.at>
###  This file is part of the "BioSig for Python" repository
###  at http://biosig.sf.net/
###
##############################################################

# download and extract 
#   http://www.biosemi.com/download/BDFtestfiles.zip 
# into /tmp/
# then run this demo 
#
# on linux you can run instead  
#   make test 

import sys
import biosig
import numpy as np
import matplotlib.pyplot as plt
import json

def printf(format, *args):
    sys.stdout.write(format % args)

## read header 
FILENAME="/home/schloegl/data/test/cfs/BaseDemo/Leak.cfs"
FILENAME="/home/schloegl/data/test/cfs/20190417_A0AA.dat"
FILENAME="/home/schloegl/data/test/cfs/minis.dat"
FILENAME="data/Newtest17-256.bdf"

HDR=biosig.header(FILENAME)
#print HDR
## extracting header fields
H=json.loads(HDR)
print(H["Filename"])
print(H["TYPE"])
print(H["Samplingrate"])
Fs=H["Samplingrate"]
NS=len(H["CHANNEL"])	# number of channels
T0=H["StartOfRecording"]
print(Fs,NS,T0)

### read and display data ###
A=biosig.data(FILENAME)
NS=np.size(A,1)		# number of channels

fig = plt.figure()
ax  = fig.add_subplot(111)
h   = plt.plot(np.arange(np.size(A,0))/H["Samplingrate"],A[:,0]);
ax.set_xlabel('time [s]')
# plt.show()

rec={"dt" : 1000.0/Fs, "xunits": "ms", "channel" : [] }
for chan in list(range(NS)):
	name=H["CHANNEL"][chan]["Label"]	# name of channel
	unit=H["CHANNEL"][chan]["PhysicalUnit"]	# units of channel
	printf("#%d:\t%s\t[%s]\n", chan, name, unit)

### get all sweeps, breaks-in-recording
selpos=[0]
if hasattr(H,"EVENT"):
    for k in list(range(len(H["EVENT"]))):
        if (H["EVENT"][k]["TYP"] == '0x7ffe'):
            selpos.append(round(H["EVENT"][k]["POS"]*H["Samplingrate"]))

selpos.append(np.size(A,0))

### data from channel m and sweep c can be obtained by:
m=0	# channel
c=0	# segment, trace, sweep number
d = A[selpos[c]:selpos[c+1]-1,m]

### display data
fig = plt.figure()
k=0
for m in list(range(NS)):
	for c in list(range(len(selpos)-1)):
		k = k+1
		ax  = fig.add_subplot(NS,len(selpos)-1,k)
		d   = A[selpos[c]:selpos[c+1]-1,m]
		h   = plt.plot(np.arange(np.size(d,0))/H["Samplingrate"],d)
		# TODO:
		# REC[m].append((c,d));
		# rec["channel"].append((chan, [{"name": name, "yunits": unit, 'section': []}]))
		# rec["channel"][m]["section"].insert(c,d)
plt.show()

Reply via email to