Skip to content

Commit

Permalink
Now added an exception so that the suite runs in a docker container w…
Browse files Browse the repository at this point in the history
…ithout raising an error if trying to plot
  • Loading branch information
David Topping authored and David Topping committed Jun 7, 2018
1 parent 46863f0 commit 18fe0d0
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 22 deletions.
2 changes: 1 addition & 1 deletion Aerosol/Property_calculation.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

import sys
import numpy
sys.path.append('/Code/Git_repos/UManSysProp_public/')
sys.path.append('/Users/davidtopping/Code/Git_repos/UManSysProp_public/')
from umansysprop import boiling_points
from umansysprop import vapour_pressures
from umansysprop import critical_properties
Expand Down
6 changes: 4 additions & 2 deletions Aerosol/f2py/Fixed_yield/ODE_solver_fixedyield.py
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ def dydt_func(t,y):
#Plot the change in concentration over time for a given specie. For the user to change / remove
#In a future release I will add this as a seperate module
if with_plots:

Plotting.stacked_bar(t_array,y_matrix,num_species_condensed,num_bins,numpy.array(y_mw[include_index]),NA)
try:
Plotting.stacked_bar(t_array,y_matrix,num_species_condensed,num_bins,numpy.array(y_mw[include_index]),NA)
except:
print("There is a problem using Matplotlib in your environment. If using this within a docker container, you will need to transfer the data to the host or configure your container to enable graphical displays. More information can be found at http://wiki.ros.org/docker/Tutorials/GUI ")

13 changes: 8 additions & 5 deletions Aerosol/f2py/ODE_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -315,10 +315,13 @@ def dydt_func(t,y):
#Plot the change in concentration over time for a given specie. For the user to change / remove
#In a future release I will add this as a seperate module
if plot_mass is True:
P.plot(t_array,SOA_matrix[:,0], marker='o')
P.title(exp_mod.name)
P.ylabel("SOA mass [micrograms/m3]")
P.xlabel("Time [seconds] since start of simulation")
P.show()
try:
P.plot(t_array,SOA_matrix[:,0], marker='o')
P.title(exp_mod.name)
P.ylabel("SOA mass [micrograms/m3]")
P.xlabel("Time [seconds] since start of simulation")
P.show()
except:
print("There is a problem using Matplotlib in your environment. If using this within a docker container, you will need to transfer the data to the host or configure your container to enable graphical displays. More information can be found at http://wiki.ros.org/docker/Tutorials/GUI ")


17 changes: 10 additions & 7 deletions ODE_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,12 +253,15 @@ def dydt_func(t,y):
#Plot the change in concentration over time for a given specie. For the user to change / remove
#In a future release I will add this as a seperate module
if with_plots:
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['APINENE']]), marker='o',label="APINENE")
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['PINONIC']]), marker='o',label="PINONIC")
P.title(exp_mod.name)
P.legend(loc='upper left')
P.ylabel("Concetration log10[molecules/cc]")
P.xlabel("Time [seconds] since start of simulation")
P.show()
try:
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['APINENE']]), marker='o',label="APINENE")
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['PINONIC']]), marker='o',label="PINONIC")
P.title(exp_mod.name)
P.legend(loc='upper left')
P.ylabel("Concetration log10[molecules/cc]")
P.xlabel("Time [seconds] since start of simulation")
P.show()
except:
print("There is a problem using Matplotlib in your environment. If using this within a docker container, you will need to transfer the data to the host or configure your container to enable graphical displays. More information can be found at http://wiki.ros.org/docker/Tutorials/GUI ")


18 changes: 11 additions & 7 deletions f2py/ODE_solver.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,12 +231,16 @@ def jacobian(t,y):
#Plot the change in concentration over time for a given specie. For the user to change / remove
#In a future release I will add this as a seperate module
if with_plots:
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['APINENE']]), marker='o',label="APINENE")
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['PINONIC']]), marker='o',label="PINONIC")
P.title(exp_mod.name)
P.legend(loc='upper left')
P.ylabel("Concetration log10[molecules/cc]")
P.xlabel("Time [seconds] since start of simulation")
P.show()

try:
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['APINENE']]), marker='o',label="APINENE")
P.plot(t_array,numpy.log10(y_matrix[:,species_dict2array['PINONIC']]), marker='o',label="PINONIC")
P.title(exp_mod.name)
P.legend(loc='upper left')
P.ylabel("Concetration log10[molecules/cc]")
P.xlabel("Time [seconds] since start of simulation")
P.show()
except:
print("There is a problem using Matplotlib in your environment. If using this within a docker container, you will need to transfer the data to the host or configure your container to enable graphical displays. More information can be found at http://wiki.ros.org/docker/Tutorials/GUI ")


0 comments on commit 18fe0d0

Please sign in to comment.