Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error #3

Open
vagnerfonseca opened this issue Dec 16, 2016 · 2 comments
Open

Error #3

vagnerfonseca opened this issue Dec 16, 2016 · 2 comments

Comments

@vagnerfonseca
Copy link

vagnerfonseca commented Dec 16, 2016

I encountered a small problem reading some files... There are series that are zeroed is the same is showing error in the physical procedure... Would it be possible to add a condition to the code if the value is other than 0?

readSignalFunctions.R

line 146-161

if (physical) {                                                             # conversion mut be possible
        digitalOk    <- hdr$sHeaders$digitalMin  <  hdr$sHeaders$digitalMax
        physicalOk   <- hdr$sHeaders$physicalMin != hdr$sHeaders$physicalMax
        digitalErr   <- sum (!digitalOk)
        physicalErr  <- sum (!physicalOk)
        if (digitalErr | physicalErr) {
            if (digitalErr & physicalErr) {
                msg <- "Illegal digital/physical min/max, use physical=FALSE"
            } else if (digitalErr) {
                msg <- "Illegal digital min/max, use physical=FALSE"
            } else if (physicalErr) {
                msg <- "Illegal physical min/max, use physical=FALSE"
            }
            stop (msg)
        }
    }
@vagnerfonseca
Copy link
Author

vagnerfonseca commented Dec 18, 2016

Hi
If you can modify the lines below will solve the channels with empty values.

        digitalOk    <- hdr$sHeaders$digitalMin  <  hdr$sHeaders$digitalMax && hdr$sHeaders$digitalMin  != 0 && hdr$sHeaders$digitalMax != 0
        physicalOk   <- hdr$sHeaders$physicalMin != hdr$sHeaders$physicalMax && hdr$sHeaders$physicalMin != 0 &&  hdr$sHeaders$physicalMax != 0

@Pisca46
Copy link
Owner

Pisca46 commented Dec 22, 2016

Dear Vagner Fonseca,
Thank you for your close look to the efdReader. However, I am afraid I missed your point.
As fas as I ma aware, the conditions in line 147-148 are exactly as in the EDF+ specs . Zero values for digital/physical min/max are allowed. As an example a non-negative physical range may be mapped to the full digital range (-32,768 - 32,767) to achieve the maximum accuracy.
In other words, restricting the digital to physical mapping to those with non-zero digital/physical min/max values would render legal use of those values impossible.
As an alternative you may use readEdfSignals with the parameter 'physical' set to FALSE. This would eliminate the digital to physical mapping as well.
Or did I miss something?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants