ghammad / pyActigraphy

Python-based open source package for actigraphy data analysis

Home Page:https://ghammad.github.io/pyActigraphy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Error - UnboundLocalError: local variable 'uuid' referenced before assignment

sakbioonline opened this issue · comments

Hello @ghammad,

Getting the above error when using the read_raw method for the Reposnic Actigraphy.

import pyActigraphy
import os

fpath = os.path.join('Actigraphy', 'E004.csv')
raw = pyActigraphy.io.read_raw_rpx(fpath)

I've attached my sample file.

E004.csv

Platform: Windows 11
PyActigraphy Version: 1.2.1

Best regards,
Abiola Saka

Hello @sakbioonline

Thank you for using the package and reporting this issue.

I had a look at your file and contrary to other Respironics files, its header does not contain any information about the device (type, uuid, etc). As the code tries to use this info, it fails with the error message you face.

Did you edit your file in any way? I suspect so since the the 3rd/4th line in your header are supposed (at least in the Respironics files I have seen so far) to be in a specific header section where one would actually also find the device type and uuid.

If you did edit the file, try to use the original file with pyactigraphy:

raw = read_raw_rpx('/Users/ghammad/Downloads/E004.csv',language='ENG_UK')

(Since the header is written in UK English, explicitly set it in the reader function so that it knows which convention it should use for the data time format: day first!)

Hope that helps.

Greg

@ghammad Thanks for your prompt response and resolution. Not at all, I did not edit the file. Can you show me how the sample header for a working file looks like, please?