@@ -58,7 +58,8 @@ def image_mpl(
58
58
npix_y = 300 ,
59
59
x_unit = units .au ,
60
60
v_unit = units .km / units .s ,
61
- method = 'nearest'
61
+ method = 'nearest' ,
62
+ save_fig = False
62
63
):
63
64
"""
64
65
Create plots of the channel maps of a synthetic observation (image) with matplotlib.
@@ -81,6 +82,8 @@ def image_mpl(
81
82
Unit of length for the vertical (y) axis.
82
83
method : str
83
84
Method to interpolate the scattered intensity data onto a regular image grid.
85
+ save_fig : bool
86
+ Whether to save the output figure.
84
87
85
88
Returns
86
89
-------
@@ -220,7 +223,8 @@ def image_mpl(
220
223
ax0 .set_xlabel ('Optical depth [.]' , labelpad = 11 )
221
224
ax2 .set_ylabel ('Relative optical depth' , labelpad = 15 )
222
225
223
- plt .savefig (f"{ im_dir } /image_{ f :0>3d} .png" , bbox_inches = 'tight' )
226
+ if save_fig :
227
+ plt .savefig (f"{ im_dir } /image_{ f :0>3d} .png" , bbox_inches = 'tight' )
224
228
225
229
figs .append (fig )
226
230
@@ -242,7 +246,8 @@ def image_plotly(
242
246
v_unit = units .km / units .s ,
243
247
method = 'nearest' ,
244
248
width = 620 , # Yields approx square channel map
245
- height = 540 # Yields approx square channel map
249
+ height = 540 , # Yields approx square channel map
250
+ save_fig = False
246
251
):
247
252
"""
248
253
Create plots of the channel maps of a synthetic observation (image) with plotly.
@@ -269,6 +274,8 @@ def image_plotly(
269
274
Width of the resulting figure.
270
275
height : float
271
276
Height of the resulting figure.
277
+ save_fig : bool
278
+ Whether to save the output figure.
272
279
273
280
Returns
274
281
-------
@@ -549,8 +556,9 @@ def image_plotly(
549
556
"scrollZoom" : True
550
557
}
551
558
552
- # Save figure as html file
553
- fig .write_html (f"{ im_dir } /image.html" , config = config )
559
+ if save_fig :
560
+ # Save figure as html file
561
+ fig .write_html (f"{ im_dir } /image.html" , config = config )
554
562
555
563
return fig .show (config = config )
556
564
0 commit comments