question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I can’t figure out how to access a sensitivity…no matter what I try I get a key error. Here it is for one of the examples in the gpkit docs

In [20]: x = gpkit.Variable("x")

In [21]: x_min = gpkit.Variable("x_{min}", 2)

In [22]: sol = gpkit.Model(x, [x_min <= x]).solve()
Using solver 'cvxopt'
Solving for 1 variables.
Solving took 0.0114 seconds.

In [23]: assert sol.sens(x_min) == 1
---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-23-f25f4b83c012> in <module>()
----> 1 assert sol.sens(x_min) == 1

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/solution_array.pyc in sens(self, key)
     76     def sens(self, key):
     77         "Returns sensitivity of the given variable (unitless)."
---> 78         return NomialArray(self["variables"]["sensitivities"][key])
     79 
     80     def table(self, tables=("cost", "sweepvariables", "freevariables",

/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/gpkit/keydict.pyc in __getitem__(self, key)
     94         keys = self.keymap[key]
     95         if not keys:
---> 96             raise KeyError("%s was not found." % key)
     97         values = []
     98         for key in keys:

KeyError: 'sensitivities was not found.'

any help would be much appreciated…really need to access some sensitivies right now

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:8 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
bqpdcommented, Aug 6, 2016

Naw, it’s a bug! This should have been unit tested…

0reactions
mayorkcommented, Sep 12, 2016
Read more comments on GitHub >

github_iconTop Results From Across the Web

NEW SOL 2.2.3 IS AMAZING! How To Uninstall ... - YouTube
NEW SOL 2.2.3 IS AMAZING! How To Uninstall & Install SOL For Assetto Corsa!
Read more >
Remove white space between two plots resulting from grid ...
I'd like to eliminate the white space between my two forest plots that I plotted side-by-side using grid.arrange(). Before you vote down or ......
Read more >
Waterproof Sensitive Eye Cleanser - MAKE UP FOR EVER
Suggested Usage: Makeup Removal: -Soak a cotton pad in Sens' Eyes and place on a closed eyelid. -Once it has soaked into the...
Read more >
PSTrace Manual
Switch on PalmSens by pressing the power key until the display shows: “Selftest”. During the self test the voltage range of the instrument...
Read more >
When Beauty Products Cause Sun Sensitivity
Some of your favorite serums and creams could be increasing your sun sensitivity without you even knowing. The ingredients most likely to ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found