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

Uncertainty in time-histories #116

Open
jsantner opened this issue Jun 14, 2018 · 3 comments
Open

Uncertainty in time-histories #116

jsantner opened this issue Jun 14, 2018 · 3 comments

Comments

@jsantner
Copy link

Background

While working on #115 , I had gotten to a point where I thought I had solved my issues - the error message had changed significantly but all Travis tests passed. I figured I now had some problem with my particular input file. But, after working further, it seems there is an issue when using uncertainty in time-histories.
Am I formatting the uncertainty incorrectly somehow? Should I just skip the validation step? Or, is PyKED unable to handle uncertainty in time-histories?

Code sample, preferably able to be copy-pasted and run with no changes

See my forked version of the code here: https://github.com/jsantner/PyKED/tree/uncertainty
In this commit, I altered one of the yaml files to include uncertainty in the time history:

time-histories:
       - type: volume
         time:
           units: s
           column: 0
         quantity:
           units: cm3
           column: 1
        uncertainty:  
            type: relative
            value: 0.01
         values:
           filename: rcm_history.csv 

Expected behavior

I didn't expect any error messages

Actual behavior, including any error messages

I receive the following traceback, with equivalent results in the Travis job linked here.

  File "C:/Users/jsantne/Documents/GitHub/rcm-workshop/workshop.py", line 84, in load_files
    database.append(pyked.ChemKED(fpath))

  File "c:\users\jsantne\documents\github\pyked-jsantner\pyked\chemked.py", line 122, in __init__
    self.validate_yaml(self._properties)

  File "c:\users\jsantne\documents\github\pyked-jsantner\pyked\chemked.py", line 183, in validate_yaml
    for key, value in validator.errors.items():

  File "C:\Users\jsantne\AppData\Local\Continuum\Anaconda3\lib\site-packages\cerberus\validator.py", line 391, in errors
    return self.error_handler(self._errors)

  File "C:\Users\jsantne\AppData\Local\Continuum\Anaconda3\lib\site-packages\cerberus\errors.py", line 473, in __call__
    self.extend(errors)

  File "C:\Users\jsantne\AppData\Local\Continuum\Anaconda3\lib\site-packages\cerberus\errors.py", line 375, in extend
    self.add(error)

  File "C:\Users\jsantne\AppData\Local\Continuum\Anaconda3\lib\site-packages\cerberus\errors.py", line 482, in add
    self.insert_logic_error(error)

  File "C:\Users\jsantne\AppData\Local\Continuum\Anaconda3\lib\site-packages\cerberus\errors.py", line 549, in insert_logic_error
    raise NotImplementedError

NotImplementedError

PyKED/ChemKED version, Python version, OS version

PyKED version: my own forked repo that can read csv files for tiem history
Python version: 3.6
OS version: Windows 10

@bryanwweber
Copy link
Member

bryanwweber commented Jun 15, 2018

What version of Cerberus do you have installed? You should install 1.1 (but not 1.2, because that's broken for another reason).

It looks like your spacing is not correct, the uncertainty key needs to be vertically aligned with the time key. Make sure you're using spaces, not tabs, to handle the indentation.

@bryanwweber
Copy link
Member

bryanwweber commented Jun 15, 2018

If you really want to get into the weeds of fixing this and related issues, we're discussing changing how the validation works over here: #103

@jsantner
Copy link
Author

I have Cerberus 1.1. I saw that my error is added to the list of errors instead of being raised in cerberus 1.2, but like you said - 1.2 is broken for another reason. I fixed my spacing, but it still doesn't work (see here: https://travis-ci.org/jsantner/PyKED/builds/392733269). Do you have any examples including uncertainty in time-history that don't raise a NotImplementedError?

For now, I'll just have to use skip_validation=True

I'll look at #103 and get involved there, thanks.

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