Skip to content

Commit

Permalink
Merge pull request #125 from ghammad/fix/bba
Browse files Browse the repository at this point in the history
En route to v1.2.1
  • Loading branch information
ghammad authored Apr 27, 2023
2 parents e21256b + 98c545e commit d045c06
Show file tree
Hide file tree
Showing 6 changed files with 37 additions and 8 deletions.
11 changes: 11 additions & 0 deletions docs/source/changelog.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ What's new

*************

v1.2.1 ("No worries", April 2023)
-------------------------------------------

This release aims to fix:

* Biobank Accelerometer Analysis file format: support file paths containing numerical characters and/or whitespaces;
* Actiwatch (CamNtech) file format: fix `issue #123 <https://github.com/ghammad/pyActigraphy/issues/123>`_ by upper casing the UUID.
* Batch reader: add missing types, 'BBA' and 'MESA'.

*************

v1.2 ("Let's go 3D", March 2023)
-------------------------------------------

Expand Down
10 changes: 8 additions & 2 deletions docs/source/pyActigraphy-Intro.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@
"* agd (Actigraph)\n",
"* atr (ActTrust)\n",
"* awd (Actiwatch)\n",
"* bba (Axivity or GeneActiv via the Biobankaccelerometer package)\n",
"* dqt (DaqTix)\n",
"* mesa (MESA dataset, hosted by the NSRR)\n",
"* mtn (MotionWatch8)\n",
"* rpx (Respironics)\n"
"* rpx (Respironics)\n",
"* tal (Tempatilumi)\n"
]
},
{
Expand All @@ -92,9 +95,12 @@
"* read_raw_agd\n",
"* read_raw_atr\n",
"* read_raw_awd\n",
"* read_raw_bba\n",
"* read_raw_dqt\n",
"* read_raw_mesa\n",
"* read_raw_mtn\n",
"* read_raw_rpx\n"
"* read_raw_rpx\n",
"* read_raw_tal\n"
]
},
{
Expand Down
2 changes: 1 addition & 1 deletion pyActigraphy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,4 @@
"viz"
]

__version__ = '1.2'
__version__ = '1.2.1'
2 changes: 1 addition & 1 deletion pyActigraphy/io/awd/awd.py
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ def __extract_awd_model(uuid):
)
match = re.match(pattern=r'^([A-Za-z])[0-9a-fA-F]+', string=uuid)
if match: # check if UUID matches the expected pattern
dcode = match.groups()[0]
dcode = match.groups()[0].upper()
if dcode in RawAWD.device_code.keys():
return dcode
else:
Expand Down
4 changes: 2 additions & 2 deletions pyActigraphy/io/bba/bba.py
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ def __read_baa_metadata_json(input_fname, metadata_fname):
# - INPUT DATA: input_fname = 'basename'-timeSeries.csv[.gz]

match_basename = re.match(
pattern=r'^(\w*)-timeSeries.csv(\.gz)?',
pattern=r'^(.+?)-timeSeries.csv(\.gz)?',
string=os.path.basename(input_fname)
)
if match_basename:
Expand All @@ -287,7 +287,7 @@ def __read_baa_metadata_json(input_fname, metadata_fname):

if not re.match(
pattern=r'{}.(cwa|CWA)(\.gz)?'.format(input_basename),
string=meta_data['file-name']
string=os.path.basename(meta_data['file-name'])
):
raise ValueError(
'Attempting to read a metadata file referring to another '
Expand Down
16 changes: 14 additions & 2 deletions pyActigraphy/io/reader/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@
from ..agd import read_raw_agd
from ..atr import read_raw_atr
from ..awd import read_raw_awd
from ..bba import read_raw_bba
from ..dqt import read_raw_dqt
from ..mesa import read_raw_mesa
from ..mtn import read_raw_mtn
from ..rpx import read_raw_rpx
from ..tal import read_raw_tal
Expand Down Expand Up @@ -231,8 +233,10 @@ def read_raw(
* AGD ((w)GT3X(+)), ActiGraph)
* ATR (ActTrust, Condor Instruments)
* AWD (ActiWatch 4, CamNtech)
* AWD (ActiWatch 4/7/L/L-Plus/T, CamNtech)
* BBA (Biobankaccelerometer)
* DQT (Daqtometers, Daqtix)
* MESA (MESA dataset, NSRR)
* MTN (MotionWatch8, CamNtech)
* RPX (Actiwatch, Respironics)
* TAL (Tempatilumi, CE Brasil)
Expand All @@ -257,7 +261,9 @@ def read_raw(
An object containing raw data
"""

supported_types = ['AGD', 'ATR', 'AWD', 'DQT', 'MTN', 'RPX', 'TAL']
supported_types = [
'AGD', 'ATR', 'AWD', 'BBA', 'DQT', 'MESA', 'MTN', 'RPX', 'TAL'
]
if reader_type not in supported_types:
raise ValueError(
'Type {0} unsupported. Supported types: {1}'.format(
Expand All @@ -284,9 +290,15 @@ def parallel_reader(
'AWD': lambda files: parallel_reader(
n_jobs, read_raw_awd, files, prefer, verbose, **kwargs
),
'BBA': lambda files: parallel_reader(
n_jobs, read_raw_bba, files, prefer, verbose, **kwargs
),
'DQT': lambda files: parallel_reader(
n_jobs, read_raw_dqt, files, prefer, verbose, **kwargs
),
'MESA': lambda files: parallel_reader(
n_jobs, read_raw_mesa, files, prefer, verbose, **kwargs
),
'MTN': lambda files: parallel_reader(
n_jobs, read_raw_mtn, files, prefer, verbose, **kwargs
),
Expand Down

0 comments on commit d045c06

Please sign in to comment.