@@ -418,7 +418,7 @@ def stellar_sed(self, moddata):
418418 # check for any zero distance cases, requested parameters are directly on a model
419419 # in this case set the distance to 0.01 of the min distance so this model dominates
420420 tvals = dist2 [gsindxs ] == 0.0
421- if ( sum (tvals ) > 0 ) :
421+ if sum (tvals ) > 0 :
422422 dist2 [gsindxs [tvals ]] = 0.01 * np .min (dist2 [gsindxs [~ tvals ]])
423423
424424 weights = 1.0 / np .sqrt (dist2 [gsindxs ])
@@ -965,7 +965,14 @@ def fit_sampler(
965965
966966 return (outmod , flat_samples , sampler )
967967
968- def plot (self , obsdata , modinfo , resid_range = 10.0 , lyaplot = False ):
968+ def plot (
969+ self ,
970+ obsdata ,
971+ modinfo ,
972+ resid_range = 10.0 ,
973+ lyaplot = False ,
974+ xticks = [0.1 , 0.2 , 0.3 , 0.5 , 0.7 , 1.0 , 2.0 ],
975+ ):
969976 """
970977 Standard plot showing the data and best fit.
971978
@@ -979,6 +986,12 @@ def plot(self, obsdata, modinfo, resid_range=10.0, lyaplot=False):
979986
980987 resid_range : float
981988 percentage value for the +/- range for the residual plot
989+
990+ lyaplot : boolean
991+ set to add two panels giving the Ly-alpha fit and residuals
992+
993+ xticks : vector
994+ set to a vector of floats giving the values for the xticks
982995 """
983996 # plotting setup for easier to read plots
984997 fontsize = 16
@@ -1053,7 +1066,13 @@ def plot(self, obsdata, modinfo, resid_range=10.0, lyaplot=False):
10531066 multval = multlam * nvals
10541067
10551068 if first_pass :
1056- plabs = ["Obs" , "Star" , "w/ Foreground" , "w/ Dust Ext" , "w/ Dust+Gas Ext" ]
1069+ plabs = [
1070+ "Obs" ,
1071+ "Star" ,
1072+ "w/ Foreground" ,
1073+ "w/ Dust Ext" ,
1074+ "w/ Dust+Gas Ext" ,
1075+ ]
10571076 else :
10581077 plabs = [None , None , None , None , None ]
10591078
@@ -1062,15 +1081,28 @@ def plot(self, obsdata, modinfo, resid_range=10.0, lyaplot=False):
10621081 cax .plot (
10631082 cwaves , modsed_nofore [cspec ] * multlam , "c" + ptype , alpha = 0.2
10641083 )
1065- cax .plot (cwaves , modsed_nofore [cspec ] * multval , "c" + ptype , label = plabs [1 ])
1066- cax .plot (cwaves , modsed [cspec ] * multval , "b" + ptype , label = plabs [2 ])
1084+ cax .plot (
1085+ cwaves ,
1086+ modsed_nofore [cspec ] * multval ,
1087+ "c" + ptype ,
1088+ label = plabs [1 ],
1089+ )
1090+ cax .plot (
1091+ cwaves , modsed [cspec ] * multval , "b" + ptype , label = plabs [2 ]
1092+ )
10671093 else :
1068- cax .plot (cwaves , modsed [cspec ] * multval , "b" + ptype , label = plabs [1 ])
1094+ cax .plot (
1095+ cwaves , modsed [cspec ] * multval , "b" + ptype , label = plabs [1 ]
1096+ )
10691097 cax .plot (cwaves , modsed [cspec ] * multlam , "b" + ptype , alpha = 0.2 )
10701098 cax .plot (cwaves , ext_modsed [cspec ] * multlam , "g" + ptype , alpha = 0.2 )
1071- cax .plot (cwaves , ext_modsed [cspec ] * multval , "g" + ptype , label = plabs [3 ])
1099+ cax .plot (
1100+ cwaves , ext_modsed [cspec ] * multval , "g" + ptype , label = plabs [3 ]
1101+ )
10721102 cax .plot (cwaves , hi_ext_modsed [cspec ] * multlam , "r" + ptype , alpha = 0.2 )
1073- cax .plot (cwaves , hi_ext_modsed [cspec ] * multval , "r" + ptype , label = plabs [4 ])
1103+ cax .plot (
1104+ cwaves , hi_ext_modsed [cspec ] * multval , "r" + ptype , label = plabs [4 ]
1105+ )
10741106
10751107 gvals = obsdata .data [cspec ].fluxes > 0.0
10761108 cax .plot (
@@ -1152,11 +1184,12 @@ def plot(self, obsdata, modinfo, resid_range=10.0, lyaplot=False):
11521184 axes [1 ].set_xscale ("log" )
11531185 ax .set_yscale ("log" )
11541186
1155- ax .xaxis .set_major_formatter (ScalarFormatter ())
1156- ax .xaxis .set_minor_formatter (ScalarFormatter ())
1157- xticks = [0.1 , 0.2 , 0.3 , 0.5 , 0.7 , 1.0 , 2.0 ]
1158- ax .set_xticks (xticks , minor = True )
1159- ax .tick_params (axis = "x" , which = "minor" , labelsize = fontsize * 0.8 )
1187+ if xticks is not None :
1188+ for tax in [ax , axes [1 ]]:
1189+ tax .xaxis .set_major_formatter (ScalarFormatter ())
1190+ tax .xaxis .set_minor_formatter (ScalarFormatter ())
1191+ tax .set_xticks (xticks , minor = True )
1192+ tax .tick_params (axis = "x" , which = "minor" , labelsize = fontsize * 0.8 )
11601193
11611194 ydelt = yrange [1 ] - yrange [0 ]
11621195 yrange [0 ] = 10 ** (yrange [0 ] - 0.1 * ydelt )
0 commit comments