Skip to content

Releases: andrewrosss/fmri-physio-log

0.3.3

07 Jul 02:21
Compare
Choose a tag to compare
  • Fixes #5. Thank you @berndf for the bug report and patch! :)
  • Drops support for python 3.8 in preparation for 3.8 reaching EOL in October 2024.
  • Updates README to describe how to use the lark CLI to (re)generate the parser.
  • Updates development dependencies/github actions/pre-commit to the latest versions.

Full Changelog: 0.3.2...0.3.3

0.3.2

23 Jan 03:40
Compare
Choose a tag to compare
  • Remove external dependency for parsing.

    • The dependency on pyparsing has been removed. Parsing is now done by a codegen'd parser. In particular, the parsing is handled by lark. However, lark is only a development dependency. The parser grammar is written in src/grammar.lark from which a generated file is produced (src/fmri_physio_log/_generated.py) and committed as part of the package. Thus, there is no production dependency on any external parsing library.
  • ~2x performance boost. The change to the generated parser has resulted in small perf win:

    v0.3.1 (Previously):

    $ git checkout 0.3.1 # + setup venv with pyparsing
    $ python -m timeit -v -n 10 -s "from fmri_physio_log import PhysioLog; from pathlib import Path; content = Path('samples/full/example_02.puls').read_text()" -- "PhysioLog(content)"
    raw times: 21.8 sec, 21.9 sec, 22.5 sec, 22.4 sec, 22.3 sec
    
    10 loops, best of 5: 2.18 sec per loop

    v0.3.2 (This release):

    $ git checkout 0.3.2 # + setup venv with lark
    $ python -m timeit -v -n 10 -s "from fmri_physio_log import PhysioLog; from pathlib import Path; content = Path('samples/full/example_02.puls').read_text()" -- "PhysioLog(content)"
    raw times: 9.73 sec, 9.6 sec, 9.59 sec, 9.58 sec, 9.6 sec
    
    10 loops, best of 5: 958 msec per loop
  • More ergonomic PhysioLog class.

    • Introduced a new .from_string classmethod. (Example below)

      • The plan is to turn PhysioLog in to a dataclass in the v0.4 release, PhysioLog.from_string is intended to be the replacement for directly calling the init method.
    • Introduced a new n_params kw-only argument to __init__ (and related classmethods). (Example below)

      • PhysioLog will try to heuristically deduce the number acquisition parameters at the beginning of the string/file, however previous this was the only behaviour. If you know better than PhysioLog you can now directly specify the number of parameters expected at the beginning of the file.
    • Introduced a new .data attribute. (Example below)

      • Similar to the previous point, related to flexibility of the PhysioLog class related to which values are "acquisition params" and which values are "data", this attribute will make the parsed "raw" data available to you (i.e. it's as list of the params + the data; no "splitting" by PhysioLog.

    Example:

    >>> from pathlib import Path
    >>> from fmri_physio_log import PhysioLog
    >>> content_str = Path('samples/short/example_01.ecg').read_text()
    >>> print(content_str)
    1 1 2 40 280 5002 LOGVERSION 102 6002 5002 TRIGGERMETHOD 10 6002 5002 MSGTYPE 103 6002 5002 MSGTYPE 220 eTriggerMethod: 10, minLimitCh1: 0, maxLimitCh1: 0, minLimitAVF: 0, maxLimitAVF: 0 6002 5002 MSGTYPE 210 6002 2048 10240 2048 10240 2048 5003
    ECG  Freq Per: 0 0
    PULS Freq Per: 148 405
    RESP Freq Per: 12 4660
    EXT  Freq Per: 0 0
    ECG  Min Max Avg StdDiff: 0 0 0 0
    PULS Min Max Avg StdDiff: 180 1142 498 17
    RESP Min Max Avg StdDiff: 4400 5740 4973 44
    EXT  Min Max Avg StdDiff: 0 0 0 0
    NrTrig NrMP NrArr AcqWin: 0 0 0 0
    LogStartMDHTime:  45927805
    LogStopMDHTime:   46228520
    LogStartMPCUTime: 45927897
    LogStopMPCUTime:  46227375
    6003
    
    >>> log = PhysioLog.from_string(content_str, n_params=7)
    >>> log.params
    (1, 1, 2, 40, 280, 2048, 10240)
    >>> log.ts
    [2048, 10240, 2048]
    >>> log.data
    [1, 1, 2, 40, 280, 2048, 10240, 2048, 10240, 2048]
    

0.3.2rc2

18 Nov 05:56
Compare
Choose a tag to compare
0.3.2rc2 Pre-release
Pre-release
Bump version: 0.3.2rc1 → 0.3.2rc2

0.3.2rc1

16 Nov 05:45
Compare
Choose a tag to compare
0.3.2rc1 Pre-release
Pre-release
Bump version: 0.3.2rc0 → 0.3.2rc1

0.3.1

16 Jun 04:51
Compare
Choose a tag to compare
  • Fix broken README badge URL
  • Fix typos

0.3.0

16 Jun 04:17
Compare
Choose a tag to compare
  • Add support of EXT2 modality (#4). Thank you @berndf for the initial patch!
  • Drop support for python 3.7 in preparation for 3.7 reaching EOL on June 27, 2023.
  • Update code comments/documentation related to how pyparsing is used.
  • Include more sample files.
  • Expand test suite.

0.2.0

07 Mar 17:52
Compare
Choose a tag to compare

There are quite a few updates in this release. Most notably are some Breaking API changes and dropping numpy as a dependency. More exhaustively:

  • PhysioLog API has changed. The parameter passed to the initializer is now assumed to be a "content string" (i.e. the contents of the pmu file as a string) and NOT a file path.
    • NOTE: PhysioLog objects can still be instantiated from files via the new .from_file and .from_filename methods
  • PhysioLog can now handle files which have embedded "comments" (these are the informational sections nested in the data, quoted by 5002/6002 tags)
  • PhysioLog can now handle files which have the data spread across multiple lines (previously it was assumed all data would be present on the first line)
  • numpy has been dropped as a dependency, this means that the .ts attribute now returns a native python list[int] instead of a numpy array.
  • pyparsing is now a dependency.
    • The parsing logic has been re-written using pyparsing.
  • Python 3.6 support has been dropped
  • The test suite has been expanded
  • Sample physio-log (pmu) files can now be found under the samples/ directory

0.2.0rc1

07 Mar 16:51
Compare
Choose a tag to compare
0.2.0rc1 Pre-release
Pre-release
Bump version: 0.2.0rc0 → 0.2.0rc1

0.2.0rc0

07 Mar 16:46
Compare
Choose a tag to compare
0.2.0rc0 Pre-release
Pre-release
Bump version: 0.1.2 → 0.2.0rc0

0.1.2

28 Sep 08:32
Compare
Choose a tag to compare

Relax Dependencies

The package dependencies were needlessly restrictive (python=^3.8 and numpy=^1.19.2). These have been changed to:

  • python=^3.7
  • numpy=^1.15.4