Code Monkey home page Code Monkey logo

bptools's People

Contributors

bruskajp avatar kahana-sysadmin avatar maciekswat avatar mivade avatar zduey avatar

Watchers

 avatar  avatar  avatar

bptools's Issues

Errors when jacksheet numbers are over 256

Example traceback:

Traceback (most recent call last):
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/bin/ramulator-conf", line 11, in <module>
    load_entry_point('ramutils==2.1.10', 'console_scripts', 'ramulator-conf')()
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/ramutils/cli/expconf.py", line 196, in create_expconf
    use_classifier_excluded_leads=args.use_classifier_excluded_leads)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/ramutils/pipelines/ramulator_config.py", line 112, in make_ramulator_config
    use_common_reference).compute()
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/base.py", line 99, in compute
    (result,) = compute(self, traverse=False, **kwargs)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/base.py", line 206, in compute
    results = get(dsk, keys, **kwargs)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/threaded.py", line 75, in get
    pack_exception=pack_exception, **kwargs)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/local.py", line 521, in get_async
    raise_exception(exc, tb)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/compatibility.py", line 60, in reraise
    raise exc
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/local.py", line 290, in execute_task
    result = _execute_task(task, data)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/dask/local.py", line 271, in _execute_task
    return func(*args2)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/ramutils/tasks/_wrapper.py", line 22, in wrapper
    return func(*args, **kwargs)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/ramutils/tasks/odin.py", line 108, in generate_electrode_config
    ec.to_csv(csv_path)
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/bptools-1.3.0-py3.6.egg/bptools/odin/config.py", line 641, in to_csv
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/bptools-1.3.0-py3.6.egg/bptools/odin/config.py", line 595, in _export
  File "/home1/RAM_clinical/miniconda3/envs/ramutils/lib/python3.6/site-packages/bptools-1.3.0-py3.6.egg/bptools/odin/config.py", line 34, in _num_to_bank_label
KeyError: 4

Last few lines of jacksheet.txt:

220 RY14
221 RY15
222 RY16
223 ECG1
224 ECG2
258 DC09
259 DC10

standardize_label breaks for labels starting with numbers

This particularly affects Emory subjects (R1337E below):

Traceback (most recent call last):
  File "C:\Users\OdinUser\src\SYS3\rampy\ramulator\ramulator.py", line 1011, in load_experiment_config
    self.system_init()
  File "C:\Users\OdinUser\src\SYS3\rampy\ramulator\ramulator.py", line 1019, in system_init
    ret = self.init_experiment_runner()
  File "C:\Users\OdinUser\src\SYS3\rampy\ramulator\ramulator.py", line 400, in init_experiment_runner
    self.populate_electrode_table()
  File "C:\Users\OdinUser\src\SYS3\rampy\ramulator\ramulator.py", line 379, in populate_electrode_table
    self.configure_electrode_table(electrode_filename=electrode_filename, montage_filename=montage_filename)
  File "C:\Users\OdinUser\src\SYS3\rampy\ramulator\ramulator.py", line 798, in configure_electrode_table
    st = SeriesTransformation.create(electrode_filename, montage_file=montage_filename)
  File "c:\users\odinuser\src\bptools\bptools\transform.py", line 50, in create
    elec_conf = ElectrodeConfig(electrode_config_file)
  File "c:\users\odinuser\src\bptools\bptools\odin\config.py", line 248, in __init__
    self.read_config_file(filename)
  File "c:\users\odinuser\src\bptools\bptools\odin\config.py", line 417, in read_config_file
    contact.label = standardize_label(contact.label)
  File "c:\users\odinuser\src\bptools\bptools\util.py", line 43, in standardize_label
    label = ''.join(label.split())
AttributeError: 'long' object has no attribute 'split'

Standardizing labels still breaks Ramulator

Traceback (most recent call last):
  File "C:/Users/OdinUser/src/SYS3\rampy\ramulator\ramulator.py", line 1011, in load_experiment_config
    self.system_init()
  File "C:/Users/OdinUser/src/SYS3\rampy\ramulator\ramulator.py", line 1019, in system_init
    ret = self.init_experiment_runner()
  File "C:/Users/OdinUser/src/SYS3\rampy\ramulator\ramulator.py", line 400, in init_experiment_runner
    self.populate_electrode_table()
  File "C:/Users/OdinUser/src/SYS3\rampy\ramulator\ramulator.py", line 379, in populate_electrode_table
    self.configure_electrode_table(electrode_filename=electrode_filename, montage_filename=montage_filename)
  File "C:/Users/OdinUser/src/SYS3\rampy\ramulator\ramulator.py", line 798, in configure_electrode_table
    st = SeriesTransformation.create(electrode_filename, montage_file=montage_filename)
  File "c:\users\odinuser\src\bptools\bptools\transform.py", line 50, in create
    elec_conf = ElectrodeConfig(electrode_config_file)
  File "c:\users\odinuser\src\bptools\bptools\odin\config.py", line 256, in __init__
    self.read_config_file(filename)
  File "c:\users\odinuser\src\bptools\bptools\odin\config.py", line 425, in read_config_file
    contact.label = standardize_label(contact.label)
  File "c:\users\odinuser\src\bptools\bptools\util.py", line 59, in standardize_label
    if label[-2] == "0":
IndexError: string index out of range

as_recarray methods improperly convert bytes to str

Example from:

def contacts_as_recarray(self):
"""Return the monopolar contacts as a recarry.
This method exists for Ramulator compatibility.
"""
arr = np.recarray((len(self.contacts),), dtype=self._recarray_dtype)
for i, contact in enumerate(self.contacts):
arr[i]['jack_box_num'] = int(contact.port)
arr[i]['contact_name'] = str(contact.label)
# Not using surface area anymore because not used by Ramulator
# arr[i]['surface_area'] = float(contact.area)
arr[i]['description'] = str(contact.description)
return arr

Line 670 turns a byte string into a str something like "b'LA1'" instead of "LA1".

Area file typos can lead to cryptic errors

areas = [
area_map[area_map.label == row.electrode].area.values[0]
for _, row in js.iterrows()
]

This can result in errors like:

IndexError: index 0 is out of bounds for axis 0 with size 0

when there are typos so that the labels in the area file don't match those in the jacksheet (e.g., LOFD instead of LOFCD). Workaround: catch the IndexError and provide a helpful hint about the problem before re-raising the exception.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.