cyclus / cymetric

http://fuelcycle.org/user/cymetric/index.html
Other
5 stars 20 forks source link

Error running example problem #172

Closed abachma2 closed 4 years ago

abachma2 commented 4 years ago

When I try to run examples/agent_entryexit.py I get a KeyError for each of the tables used in the data base ('CommissioningSeries' and 'DecommissioningSeries'). When I look at the output file (recycle.sqlite) using a database browser and using the .dict method of cymetric I can see that these tables are in the database, but it seems that cymetric can't open them for some reason. Problem has been replicated by @gwenchee.

I am running through the current example to learn how to use Cymetric, but also to develop examples for issues #103 and #134. So if the objective of the example needs to be changed. then guidance on what the new problem should be would be appreciated.

bam241 commented 4 years ago

could tell us more about the kind of error you are seing when trying to open your cyclus output file with cymetric ?

abachma2 commented 4 years ago

The exact error message I get is:

KeyError Traceback (most recent call last)

in () 1 # Store the tables as pandas DataFrames ----> 2 comm = evaler.eval('CommissioningSeries') 3 decomm = evaler.eval('DecomSchedule') /home/amandabachmann/.local/lib/python3.6/site-packages/cymetric/evaluator.py in eval(self, metric, conds) 53 if rawkey in self.rawcache: 54 return self.rawcache[rawkey] ---> 55 m = self.get_metric(metric) 56 frames = [] 57 for dep in m.dependencies: /home/amandabachmann/.local/lib/python3.6/site-packages/cymetric/evaluator.py in get_metric(self, metric) 45 """Checks if metric is already in the registry; adds it if not.""" 46 if metric not in self.metrics: ---> 47 self.metrics[metric] = METRIC_REGISTRY[metric](self.db) 48 return self.metrics[metric] 49 KeyError: 'CommissioningSeries' And I get the same message when I run the command below it with the table 'DecommissioningSeries'. It does not do this with some of the other tables in the database, such as "BuildSchedule". I also noticed that if I rerun the input file given in the same folder (recycle.xml), then the CommissioningSeries and DecommissioningSeries tables are not in the new output. I did not know if this means that in the 5 years since this example problem was written that cyclus and cymetric have been updated to not include/interpret this data
bam241 commented 4 years ago

thx problem is those metrics are not know by cymetric. you can find [here] the list of metrics cymetric is aware of.

if they exist in the file and are natively created in the output file (I mean by cyclus not by some archetypes) then they should be added into the list. if they are specific to archetypes they should live in myarchetypes_root_metrics.py in the cymetric folder (in the cymetric repo)

does it make sense ?

abachma2 commented 4 years ago

Yes. Thank you. I will go ahead and close the issue then.

bam241 commented 4 years ago

I also noticed that if I rerun the input file given in the same folder (recycle.xml), then the CommissioningSeries and DecommissioningSeries tables are not in the new output. I did not know if this means that in the 5 years since this example problem was written that cyclus and cymetric have been updated to not include/interpret this data

You are perfectly correct ! sorry I did not read that paragraph :(

Example should be updated to use DecommissionSeries and BuildSeries instead.

abachma2 commented 4 years ago

Closed with updated from PR #173