-
Notifications
You must be signed in to change notification settings - Fork 50
Fix plotting issues #600
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
Merged
Merged
Fix plotting issues #600
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
99dd9aa
Increase timeout, move plot before error message
AntoineGautier 3265537
Guard against missing data, refactor with ajax and Promise
AntoineGautier 8f8dbca
Bump JS dependencies
AntoineGautier 5f3f4a6
Version and release notes
AntoineGautier a30b4f9
Add recursive wait for plotly, format
AntoineGautier 24143ee
Merge branch 'master' into issue599_fixPlot
AntoineGautier 7f9277f
Check if server is accessible first, fix function name [ci skip]
AntoineGautier 4c51b4f
Remove controller w/ timeout
AntoineGautier 60426f3
Remove retry button, add dummy favicon
AntoineGautier 86da620
Propagate changes to plot template from pyfunnel
AntoineGautier 77da92b
Update dependencies and changelog, clean imports
AntoineGautier ee9cf06
Specify build tools in setup
AntoineGautier 4696af2
Specify encoding to avoid JSONDecodeError: Unexpected UTF-8 BOM
AntoineGautier File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 |
---|---|---|
@@ -1 +1 @@ | ||
5.2.0 | ||
5.2.1 |
This file contains hidden or 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 |
---|---|---|
|
@@ -7,10 +7,6 @@ | |
# [email protected] 2011-02-23 | ||
####################################################### | ||
# | ||
from collections import defaultdict | ||
from contextlib import contextmanager | ||
import difflib | ||
import fnmatch | ||
import functools | ||
import glob | ||
import io | ||
|
@@ -24,19 +20,24 @@ | |
import sys | ||
import tempfile | ||
import time | ||
import webbrowser | ||
from collections import defaultdict | ||
from contextlib import contextmanager | ||
|
||
# Third-party module or package imports. | ||
import numpy as np | ||
import simplejson | ||
|
||
# Code repository sub-package imports. | ||
import pyfunnel | ||
from buildingspy.development import error_dictionary_openmodelica | ||
from buildingspy.development import error_dictionary_optimica | ||
from buildingspy.development import error_dictionary_dymola | ||
from buildingspy.io.outputfile import Reader | ||
from buildingspy.io.postprocess import Plotter | ||
|
||
import buildingspy.io.outputfile as of | ||
import buildingspy.io.reporter as rep | ||
from buildingspy.development import ( | ||
error_dictionary_dymola, | ||
error_dictionary_openmodelica, | ||
error_dictionary_optimica, | ||
) | ||
from buildingspy.io.outputfile import Reader | ||
from buildingspy.io.postprocess import Plotter | ||
|
||
|
||
def runSimulation(worDir, cmd): | ||
|
@@ -2237,6 +2238,13 @@ def _compareResults(self, data_idx, oldRefFulFilNam, y_sim, y_tra, refFilNam, an | |
newStatistics = self._check_statistics( | ||
old_results, y_tra, stage, newTrajectories, newStatistics, model_name) | ||
|
||
if newTrajectories: | ||
if self._comp_tool == 'legacy': | ||
print("(Close plot window to continue.)") | ||
self._legacy_plot(y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, matFilNam) | ||
else: | ||
self._funnel_plot(model_name) | ||
|
||
# If the users selected "Y" or "N" (to not accept or reject any new results) in previous tests, | ||
# or if the script is run in batch mode, then don't plot the results. | ||
# If we found an error, plot the results, and ask the user to accept or | ||
|
@@ -2256,13 +2264,6 @@ def _compareResults(self, data_idx, oldRefFulFilNam, y_sim, y_tra, refFilNam, an | |
print( | ||
f" update reference files with new {self._color_BOLD}trajectories{self._color_ERROR}?{self._color_ENDC}") | ||
|
||
if newTrajectories: | ||
if self._comp_tool == 'legacy': | ||
print("(Close plot window to continue.)") | ||
self._legacy_plot(y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, matFilNam) | ||
else: | ||
self._funnel_plot(model_name) | ||
|
||
while not (ans == "n" or ans == "y" or ans == "Y" or ans == "N"): | ||
ans = input(" Enter: y(yes), n(no), Y(yes for all), N(no for all): ") | ||
|
||
|
@@ -2311,7 +2312,7 @@ def _funnel_plot(self, model_name, browser=None): | |
server = pyfunnel.MyHTTPServer(('', 0), pyfunnel.CORSRequestHandler, | ||
str_html=content, url_html='funnel') | ||
# Start the browser instance. | ||
server.browse(list_files, browser=browser) | ||
server.browse(list_files, browser=browser, timeout=60) | ||
|
||
def _legacy_plot(self, y_sim, t_ref, y_ref, noOldResults, timOfMaxErr, model_name): | ||
"""Plot comparison results generated by legacy comparison algorithm.""" | ||
|
@@ -3880,7 +3881,7 @@ def _get(model, key, data): | |
return 0 | ||
|
||
with open(self._statistics_log, 'r') as f: | ||
staVal = simplejson.loads(f.read()) | ||
staVal = json.loads(f.read()) | ||
data = [] | ||
for case in staVal['testCase']: | ||
if 'translate' in case: | ||
|
@@ -3902,7 +3903,7 @@ def _get(model, key, data): | |
temp['simulation']['state_events'] = case['simulate']['state_events'] if 'state_events' in case['simulate'] else 0 | ||
temp['simulation']['success'] = case['simulate']['result'] | ||
data.append(temp) | ||
dataJson = simplejson.dumps(data) | ||
dataJson = json.dumps(data) | ||
return dataJson | ||
|
||
def run(self): | ||
|
@@ -4135,7 +4136,7 @@ def run(self): | |
# For Dymola: store available simulation info into | ||
# self._comp_info used for reporting. | ||
val = self._run_simulation_info() | ||
self._comp_info = simplejson.loads(val) | ||
self._comp_info = json.loads(val) | ||
|
||
r = self._checkReferencePoints(ans) | ||
if r != 0: # In case of comparison error. Comparison warnings are handled | ||
|
@@ -4153,8 +4154,8 @@ def run(self): | |
if not self._skip_verification or self._rewrite_configuration_file: | ||
# For OpenModelica and OPTIMICA: store available translation and simulation info | ||
# into self._comp_info used for reporting or for rewriting the configuration file. | ||
with open(self._simulator_log_file, 'r') as f: | ||
self._comp_info = simplejson.loads(f.read()) | ||
with open(self._simulator_log_file, 'r', encoding='utf-8-sig') as f: | ||
self._comp_info = json.loads(f.read()) | ||
|
||
if not self._skip_verification: | ||
r = self._checkReferencePoints(ans='N') | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.