Scheduled service maintenance on November 22


On Friday, November 22, 2024, between 06:00 CET and 18:00 CET, GIN services will undergo planned maintenance. Extended service interruptions should be expected. We will try to keep downtimes to a minimum, but recommend that users avoid critical tasks, large data uploads, or DOI requests during this time.

We apologize for any inconvenience.

generate_edf+C.py 1.3 KB

123456789101112131415161718192021222324252627282930313233
  1. """
  2. Generate minimal EDF+C file.
  3. See also pyedflib and format specifications
  4. https://github.com/holgern/pyedflib
  5. https://www.edfplus.info/
  6. Author: Julia Sprenger
  7. """
  8. from pyedflib import highlevel
  9. from pathlib import Path
  10. import numpy as np
  11. current_dir = Path(__file__).parent.absolute()
  12. # write an edf file with 5 channels á 265 samples (1 second)
  13. channel_names = ['ch1', 'ch2', 'ch3', 'ch4', 'ch5']
  14. dimensions = ['mV', 'uV', 'pA', '', 'C']
  15. transducer = ['unknown', 'A', 'B', '', 'Z']
  16. prefilter = ['true', 'false', 'false', 'true', 'true']
  17. signal_headers = highlevel.make_signal_headers(list_of_labels=channel_names, sample_rate=256)
  18. digital_min, digital_max = signal_headers[0]['digital_min'], signal_headers[0]['digital_max']
  19. signals = np.random.randint(digital_min, digital_max, size=(5, 256), dtype=np.int16)
  20. for i in range(len(signal_headers)):
  21. signal_headers[i]['dimension'] = dimensions[i]
  22. signal_headers[i]['transducer'] = transducer[i]
  23. signal_headers[i]['prefilter'] = prefilter[i]
  24. header = highlevel.make_header(patientname='patient_x', gender='Female')
  25. highlevel.write_edf(str(current_dir / 'edf+C.edf'), signals, signal_headers, header, digital=True)
  26. # export plain signal also as txt file (transposed for compatibility with AnalogSignal)
  27. np.savetxt(str(current_dir / 'edf+C.txt'), signals.T, fmt='%d')