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

Add customizations to support checking +12 degC/0 FEPs violations, other minor updates #28

Merged
merged 6 commits into from
Jan 5, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 58 additions & 0 deletions dpa_check/dpa_check.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,64 @@ def __init__(self):
super(DPACheck, self).__init__("1dpamzt", "dpa", valid_limits,
hist_limit)

def custom_prediction_plots(self, plots):
"""
Customization of prediction plots.

Parameters
----------
plots : dict of dicts
Contains the hooks to the plot figures, axes, and filenames
and can be used to customize plots before they are written,
e.g. add limit lines, etc.
"""
plots[self.name]['ax'].axhline(self.zero_feps_limit, linestyle='--',
color='dodgerblue', label="Zero FEPs",
linewidth=2.0)

def custom_prediction_viols(self, times, temp, viols, load_start):
"""
Custom handling of limit violations. This is for checking the
+12 degC violation if all FEPs are off.

Parameters
----------
times : NumPy array
The times for the predicted temperatures
temp : NumPy array
The predicted temperatures
viols : dict
Dictionary of violations information to add to
load_start : float
The start time of the load, used so that we only report
violations for times later than this time for the model
run.
"""
# Only check this violation when all FEPs are off
mask = self.predict_model.comp['fep_count'].dvals == 0
zf_viols = self._make_prediction_viols(times, temp, load_start,
self.zero_feps_limit,
"zero-feps", "min",
mask=mask)
viols["zero_feps"] = {"name": f"Zero FEPs ({self.zero_feps_limit} C)",
"type": "Min",
"values": zf_viols}

def custom_validation_plots(self, plots):
"""
Customization of validation plots.

Parameters
----------
plots : dict of dicts
Contains the hooks to the plot figures, axes, and filenames
and can be used to customize plots before they are written,
e.g. add limit lines, etc.
"""
plots[0]['lines']['ax'].axhline(self.zero_feps_limit, linestyle='--',
color='dodgerblue', zorder=-8,
linewidth=2, label="Zero FEPs")

def _calc_model_supp(self, model, state_times, states, ephem, state0):
"""
Update to initialize the dpa0 pseudo-node. If 1dpamzt
Expand Down
11 changes: 8 additions & 3 deletions dpa_check/tests/answers/JUL3018A_viol.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,12 @@
],
"run_start": "2018:205:00:42:38.816",
"limits": {
"yellow_hi": 37.2,
"plan_limit_hi": 35.2
}
"yellow_hi_limit": 37.2,
"plan_hi_limit": 35.2
},
"duration": [
"3.94",
"5.25",
"3.94"
]
}
2 changes: 1 addition & 1 deletion dpa_check/tests/dpa_test_spec.json
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@
0.7
],
"eclipse_comp": "eclipse",
"epoch": "2018:003",
"epoch": "2018:003:12:00:00",
"pitch_comp": "pitch",
"simz_comp": "sim_z",
"var_func": "linear"
Expand Down