OxWearables / biobankAccelerometerAnalysis

Extracting meaningful health information from large accelerometer datasets
https://biobankaccanalysis.readthedocs.io/en/latest/index.html
Other
187 stars 63 forks source link

unexpected data issue when importing ax3 files #249

Closed RitaPeralta closed 9 months ago

RitaPeralta commented 9 months ago

I have been trying to process CWA files from ax3 but I keep getting this error message at the end of the summarizing porecess. I tried two different files and then a tried a sample file available online. I still gives the same error message. Can you help me figure out the possible problem? below the output thanks Rita

(accelerometer) C:\Users\anari>accprocess C:\Users\anari\Downloads\longitudinal_data\longitudinal_data.cwa Processing file 'C:\Users\anari\Downloads\longitudinal_data\longitudinal_data.cwa' with these arguments:

activityClassification : True activityModel : walmsley calOffset : [0.0, 0.0, 0.0] calSlope : [1.0, 1.0, 1.0] calTemp : [0.0, 0.0, 0.0] calibrationSphereCriteria : 0.3 csvSampleRate : None csvStartRow : 1 csvStartTime : None csvTimeFormat : yyyy-MM-dd HH:mm:ss.SSSxxxx '['VV']' csvTimeXYZTempColsIndex : 0,1,2,3,4 deleteIntermediateFiles : True endTime : None epochFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-epoch.csv.gz epochPeriod : 30 extractFeatures : True fourierFrequency : False fourierWithAcc : False inputFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data.cwa intensityDistribution : False m10l5 : False meanTemp : None mgCpLPA : 45 mgCpMPA : 100 mgCpVPA : 400 nonWearFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-nonWearBouts.csv.gz npyFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data.npy npyOutput : False outputFolder : C:\Users\anari\Downloads\longitudinal_data processInputFile : True psd : False rawDataParser : AccelerometerParser rawFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data.csv.gz rawOutput : False resampleMethod : linear sampleRate : 100 skipCalibration : False startTime : None stationaryFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-stationaryPoints.csv.gz stationaryStd : 13 summaryFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-summary.json timeSeriesDateColumn : False timeShift : 0 timeZone : Europe/London tsFile : C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-timeSeries.csv.gz useFilter : True verbose : False

2024-02-06 00:00:21 === Calibrating === Intermediate file: C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-stationaryPoints.csv.gz Device was programmed with delayed start time Session start: 2013-02-19T13:00Z[Europe/London]

2024-02-06 00:00:39 === Extracting features === Intermediate file: C:\Users\anari\Downloads\longitudinal_data\longitudinal_data-epoch.csv.gz Device was programmed with delayed start time Session start: 2013-02-19T13:00Z[Europe/London]

2024-02-06 00:01:38 === Summarizing === Traceback (most recent call last): File "C:\Users\anari\miniconda3\envs\accelerometer\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\anari\miniconda3\envs\accelerometer\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\anari\miniconda3\envs\accelerometer\Scripts\accProcess.exe__main__.py", line 7, in File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\accProcess.py", line 330, in main epochData, labels = accelerometer.summarisation.getActivitySummary( File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\summarisation.py", line 120, in getActivitySummary data, labels = classification.activityClassification(data, activityModel, mgCpLPA, mgCpMPA, mgCpVPA) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\classification.py", line 51, in activityClassification featureCols = joblib.load(getFileFromTar(modelPath, 'featureCols')) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\classification.py", line 509, in getFileFromTar b.write(t.extractfile(targetFile).read()) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2350, in extractfile tarinfo = self.getmember(member) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 1969, in getmember tarinfo = self._getmember(name.rstrip('/')) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2635, in _getmember members = self.getmembers() File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 1980, in getmembers self._load() # all members, we first have to File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2675, in _load tarinfo = self.next() File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2582, in next raise ReadError("unexpected end of data") tarfile.ReadError: unexpected end of data

chanshing commented 9 months ago

From your error message, I suspect that the downloaded ML model file is corrupted somehow. Can you try reinstalling?

# Change to the accelerometer virtual environment
$ conda activate accelerometer  # you should now see (accelerometer) in front of your prompt
# Uninstall accelerometer package
$ pip uninstall accelerometer
# Install again
$ pip install accelerometer
RitaPeralta commented 9 months ago

Hi thanks for the quick reply I tried what you suggested but it still gives the same error. I have also python 3.10 installed to be able to use py-actigraphy. Do you think there may be any conflict? Rita Note: below the error message

(base) C:\Users\anari>conda activate accelerometer

(accelerometer) C:\Users\anari>uninstall accelerometer package 'uninstall' is not recognized as an internal or external command, operable program or batch file.

(accelerometer) C:\Users\anari>pip uninstall accelerometer Found existing installation: accelerometer 7.1.1 Uninstalling accelerometer-7.1.1: Would remove:

c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer-7.1.1.dist-info*

c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer*

c:\users\anari\miniconda3\envs\accelerometer\scripts\acccollatesummary.exe c:\users\anari\miniconda3\envs\accelerometer\scripts\accplot.exe c:\users\anari\miniconda3\envs\accelerometer\scripts\accprocess.exe c:\users\anari\miniconda3\envs\accelerometer\scripts\accwritecmds.exe Would not remove (might be manually added):

c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\models\walmsley\20220210_sk_1_0_2.tar Proceed (Y/n)? y Successfully uninstalled accelerometer-7.1.1

(accelerometer) C:\Users\anari>pip install accelerometer Collecting accelerometer Using cached accelerometer-7.1.1-py3-none-any.whl.metadata (6.6 kB) Requirement already satisfied: numpy==1.21. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (1.21.6) Requirement already satisfied: scipy==1.7. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (1.7.3) Requirement already satisfied: matplotlib==3.5. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (3.5.3) Requirement already satisfied: pandas==1.3. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (1.3.5) Requirement already satisfied: tqdm==4.65. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (4.65.2) Requirement already satisfied: statsmodels==0.13. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (0.13.5) Requirement already satisfied: joblib==1.1. in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (1.1.1) Requirement already satisfied: imbalanced-learn==0.8.1 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (0.8.1) Requirement already satisfied: scikit-learn==1.0.2 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from accelerometer) (1.0.2) Requirement already satisfied: cycler>=0.10 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (0.12.1) Requirement already satisfied: fonttools>=4.22.0 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (4.47.2) Requirement already satisfied: kiwisolver>=1.0.1 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (1.4.5) Requirement already satisfied: packaging>=20.0 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (23.2) Requirement already satisfied: pillow>=6.2.0 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (10.2.0) Requirement already satisfied: pyparsing>=2.2.1 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (3.1.1) Requirement already satisfied: python-dateutil>=2.7 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from matplotlib==3.5.->accelerometer) (2.8.2) Requirement already satisfied: pytz>=2017.3 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from pandas==1.3.->accelerometer) (2024.1) Requirement already satisfied: threadpoolctl>=2.0.0 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from scikit-learn==1.0.2->accelerometer) (3.2.0) Requirement already satisfied: patsy>=0.5.2 in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from statsmodels==0.13.->accelerometer) (0.5.6) Requirement already satisfied: colorama in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from tqdm==4.65.->accelerometer) (0.4.6) Requirement already satisfied: six in c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages (from patsy>=0.5.2->statsmodels==0.13.->accelerometer) (1.16.0) Using cached accelerometer-7.1.1-py3-none-any.whl (1.5 MB) Installing collected packages: accelerometer Successfully installed accelerometer-7.1.1

(accelerometer) C:\Users\anari>cd: C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS A sintaxe do nome do ficheiro, do nome do diretório ou da etiqueta do volume é incorreta.

(accelerometer) C:\Users\anari>cd C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS

(accelerometer) C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS>accprocess 83107.cwa Processing file '83107.cwa' with these arguments:

activityClassification : True activityModel : walmsley calOffset : [0.0, 0.0, 0.0] calSlope : [1.0, 1.0, 1.0] calTemp : [0.0, 0.0, 0.0] calibrationSphereCriteria : 0.3 csvSampleRate : None csvStartRow : 1 csvStartTime : None csvTimeFormat : yyyy-MM-dd HH:mm:ss.SSSxxxx '['VV']' csvTimeXYZTempColsIndex : 0,1,2,3,4 deleteIntermediateFiles : True endTime : None epochFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-epoch.csv.gz epochPeriod : 30 extractFeatures : True fourierFrequency : False fourierWithAcc : False inputFile : 83107.cwa intensityDistribution : False m10l5 : False meanTemp : None mgCpLPA : 45 mgCpMPA : 100 mgCpVPA : 400 nonWearFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-nonWearBouts.csv.gz npyFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107.npy npyOutput : False outputFolder : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS processInputFile : True psd : False rawDataParser : AccelerometerParser rawFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107.csv.gz rawOutput : False resampleMethod : linear sampleRate : 100 skipCalibration : False startTime : None stationaryFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-stationaryPoints.csv.gz stationaryStd : 13 summaryFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-summary.json timeSeriesDateColumn : False timeShift : 0 timeZone : Europe/London tsFile : C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-timeSeries.csv.gz useFilter : True verbose : False

2024-02-07 15:37:03 === Calibrating === Intermediate file: C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-stationaryPoints.csv.gz Device was programmed with delayed start time Session start: 2023-11-15T12:00Z[Europe/London]

2024-02-07 15:37:37 === Extracting features === Intermediate file: C:\Users\anari\OneDrive\Documents\ACTIGRAFIAS\83107-epoch.csv.gz Device was programmed with delayed start time Session start: 2023-11-15T12:00Z[Europe/London]

2024-02-07 15:39:51 === Summarizing === Traceback (most recent call last): File "C:\Users\anari\miniconda3\envs\accelerometer\lib\runpy.py", line 197, in _run_module_as_main return _run_code(code, main_globals, None, File "C:\Users\anari\miniconda3\envs\accelerometer\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\anari\miniconda3\envs\accelerometer\Scripts\accProcess.exe__main__.py", line 7, in File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\accProcess.py", line 330, in main epochData, labels = accelerometer.summarisation.getActivitySummary( File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\summarisation.py", line 120, in getActivitySummary data, labels = classification.activityClassification(data, activityModel, mgCpLPA, mgCpMPA, mgCpVPA) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\classification.py", line 51, in activityClassification featureCols = joblib.load(getFileFromTar(modelPath, 'featureCols')) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\classification.py", line 509, in getFileFromTar b.write(t.extractfile(targetFile).read()) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2350, in extractfile tarinfo = self.getmember(member) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 1969, in getmember tarinfo = self._getmember(name.rstrip('/')) File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2635, in _getmember members = self.getmembers() File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 1980, in getmembers self._load() # all members, we first have to File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2675, in _load tarinfo = self.next() File "C:\Users\anari\miniconda3\envs\accelerometer\lib\tarfile.py", line 2582, in next raise ReadError("unexpected end of data") tarfile.ReadError: unexpected end of data

On Tue, Feb 6, 2024 at 10:22 AM Shing Chan @.***> wrote:

From your error message, I suspect that the downloaded ML model file is corrupted somehow. Can you try reinstalling?

Change to the accelerometer virtual environment

$ conda activate accelerometer # you should now see (accelerometer) in front of your prompt# Uninstall accelerometer package $ pip uninstall accelerometer# Install again $ pip install accelerometer

— Reply to this email directly, view it on GitHub https://github.com/OxWearables/biobankAccelerometerAnalysis/issues/249#issuecomment-1929202059, or unsubscribe https://github.com/notifications/unsubscribe-auth/BF5X4EYYJNLPUWPJ6PBNIDTYSH75BAVCNFSM6AAAAABC3BVEN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMRZGIYDEMBVHE . You are receiving this because you authored the thread.Message ID: @.*** com>

chanshing commented 9 months ago

Thank you, that's helpful. It seems when you uninstalled, it didn't remove the model file. Can you remove this manually?

c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\models\walmsley\20220210_sk_1_0_2.tar

Once you delete that file, rerun accProcess again. It should download that model file from scratch.

RitaPeralta commented 9 months ago

Dear Shing Chan Thank you very much. It worked now Rita

On Wed, Feb 7, 2024 at 4:33 PM Shing Chan @.***> wrote:

Thank you, that's helpful. It seems when you uninstalled, it didn't remove the model file. Can you remove this manually?

c:\users\anari\miniconda3\envs\accelerometer\lib\site-packages\accelerometer\models\walmsley\20220210_sk_1_0_2.tar

Once you delete that file, rerun accProcess again. It should download that model file from scratch.

— Reply to this email directly, view it on GitHub https://github.com/OxWearables/biobankAccelerometerAnalysis/issues/249#issuecomment-1932429574, or unsubscribe https://github.com/notifications/unsubscribe-auth/BF5X4E3UHLJ4KPKFX7ZAE7TYSOUFVAVCNFSM6AAAAABC3BVEN2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTSMZSGQZDSNJXGQ . You are receiving this because you authored the thread.Message ID: @.*** com>