-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
46 changed files
with
2,149 additions
and
375 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
@import 'theme.css'; | ||
|
||
div[class^='highlight-breakdowns'] pre { | ||
line-height: 1.15 !important; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
"An example to show off Breakdowns" | ||
import os | ||
import pickle | ||
import pint | ||
from gpkit.breakdowns import Breakdowns | ||
|
||
if pint.__version__.split(".") > ["0", "9"]: | ||
# the code to create solar.p is in ./breakdowns/solartest.py | ||
filepath = os.path.dirname(os.path.realpath(__file__)) + os.sep + "solar.p" | ||
sol = pickle.load(open(filepath, "rb")) | ||
bds = Breakdowns(sol) | ||
|
||
print("Cost breakdown (as seen in solution tables)") | ||
print("==============") | ||
bds.plot("cost") | ||
|
||
print("Variable breakdowns (note the two methods of access)") | ||
print("===================") | ||
varkey, = sol["variables"].keymap[("Mission.FlightSegment.AircraftPerf" | ||
".AircraftDrag.Poper")] | ||
bds.plot(varkey) | ||
bds.plot("AircraftPerf.AircraftDrag.MotorPerf.Q") | ||
|
||
print("Combining the two above by increasing maxwidth") | ||
print("----------------------------------------------") | ||
bds.plot("AircraftPerf.AircraftDrag.Poper", maxwidth=105) | ||
|
||
print("Model sensitivity breakdowns (note the two methods of access)") | ||
print("============================") | ||
bds.plot("model sensitivities") | ||
bds.plot("Aircraft") | ||
|
||
print("Exhaustive variable breakdown traces (and configuration arguments)") | ||
print("====================================") | ||
# often useful as a reference point when reading traces | ||
bds.plot("AircraftPerf.AircraftDrag.Poper", height=12) | ||
# includes factors, can be useful for reading traces as well | ||
bds.plot("AircraftPerf.AircraftDrag.Poper", showlegend=True) | ||
print("\nPermissivity = 2 (the default)") | ||
print("----------------") | ||
bds.trace("AircraftPerf.AircraftDrag.Poper") | ||
print("\nPermissivity = 1 (stops at Pelec = v·i)") | ||
print("----------------") | ||
bds.trace("AircraftPerf.AircraftDrag.Poper", permissivity=1) | ||
|
||
# you can also produce Plotly treemaps/icicle plots of your breakdowns | ||
fig = bds.treemap("model sensitivities", returnfig=True) | ||
fig = bds.icicle("cost", returnfig=True) | ||
# uncommenting any of the below makes and shows the plot directly | ||
# bds.icicle("model sensitivities") | ||
# bds.treemap("cost") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
from solar.solar import * | ||
Vehicle = Aircraft(Npod=3, sp=True) | ||
M = Mission(Vehicle, latitude=[20]) | ||
M.cost = M[M.aircraft.Wtotal] | ||
|
||
M.localsolve().save("solar.p") |
Oops, something went wrong.