@@ -272,49 +272,58 @@ def queryMetricsInGridPlots(
272272 print (f'Processing: { sim_type_map [sim_type ]} , { nsubs } subs' )
273273 for station in stations :
274274 for iteration in iterations :
275- # -------------------------------------- INITIALIZATION -----------------------------------------
276- # Init the classes
277- save_fig = True if station == stations [- 1 ] and iteration == iterations [- 1 ] else False
278- plotter = Plotting (sim_type , stories , # The class that plots the data
279- nsubs , magnitude ,
280- iteration , rupture_type ,
281- station , show_plots = show_plots , grid = True , dpi = dpi , file_type = file_type )
282- query = ProjectQueries (user , password , host , database , sim_type , linearity ,
283- mag_map .get (magnitude , 'None' ),
284- rup_map .get (rupture_type , 'None' ),
285- iteration ,
286- loc_map .get (station , 'None' ),
287- stories , nsubs , plotter , windows = windows , verbose = verbose )
288-
289- # -------------------------------------- EXECUTE THE MAIN QUERY ---------------------------------
290- # Get the results for zone = 'Las Condes', soil_category = 'B' and importance = 2
291- drift , spectra , base_shear , axes = query .getAllResults (save_drift , save_spectra , save_b_shear ,
292- structure_weight , xlim_sup = xlim_sup , verbose = verbose ,
293- drift_axes = drift_axes , spectra_axes = spectra_axes , base_shear_axes = base_shear_axes ,
294- save_fig = False , fig_size = fig_size )
295- drift_axes , spectra_axes , base_shear_axes = axes # update the axes
296-
297- # Fill dictionaries
298- sim_type_name = sim_type_map [sim_type ]
299- sim_name = f'{ sim_type_name } _20f{ nsubs } s_rup_bl_{ iteration } _s{ station } '
300- drifts_df_dict [sim_name ] = drift
301- spectra_df_dict [sim_name ] = spectra
302- base_shear_df_dict [sim_name ] = base_shear
303-
304- # -------------------------------------- PLOT THE RESULTS ---------------------------------
305- # Add plot of mean drifts
306- if iteration == iterations [- 1 ]:
307- # Plot mean drift
308- _plotMeanDriftColor (drifts_df_dict , plotter , xlim_sup , drift_axes , save_fig , fig_size ) if save_drift else None
275+ if not all ([save_drift == False , save_spectra == False , save_b_shear == False ]):
276+ # -------------------------------------- INITIALIZATION -----------------------------------------
277+ # Init the classes
278+ save_fig = True if station == stations [- 1 ] and iteration == iterations [- 1 ] else False
279+ plotter = Plotting (sim_type , stories , # The class that plots the data
280+ nsubs , magnitude ,
281+ iteration , rupture_type ,
282+ station , show_plots = show_plots , grid = True , dpi = dpi , file_type = file_type )
283+ query = ProjectQueries (user , password , host , database , sim_type , linearity ,
284+ mag_map .get (magnitude , 'None' ),
285+ rup_map .get (rupture_type , 'None' ),
286+ iteration ,
287+ loc_map .get (station , 'None' ),
288+ stories , nsubs , plotter , windows = windows , verbose = verbose )
309289
310- # Plot mean spectra
311- _plotMeanSpectraColor (spectra_df_dict , plotter , spectra_axes , save_fig , fig_size ) if save_spectra else None
290+ # -------------------------------------- EXECUTE THE MAIN QUERY ---------------------------------
291+ # Get the results for zone = 'Las Condes', soil_category = 'B' and importance = 2
292+ drift , spectra , base_shear , axes = query .getAllResults (save_drift , save_spectra , save_b_shear ,
293+ structure_weight , xlim_sup = xlim_sup , verbose = verbose ,
294+ drift_axes = drift_axes , spectra_axes = spectra_axes , base_shear_axes = base_shear_axes ,
295+ save_fig = False , fig_size = fig_size )
296+ drift_axes , spectra_axes , base_shear_axes = axes # update the axes
312297
313- # Plot mean base shear
314- _plotMeanBaseShearColor (base_shear_df_dict , plotter , base_shear_axes , save_fig , fig_size , Qmax ) if save_b_shear else None
315-
316- # Update tqdm
317- pbar .update (1 )
298+ # Fill dictionaries
299+ sim_type_name = sim_type_map [sim_type ]
300+ sim_name = f'{ sim_type_name } _20f{ nsubs } s_rup_bl_{ iteration } _s{ station } '
301+ drifts_df_dict [sim_name ] = drift
302+ spectra_df_dict [sim_name ] = spectra
303+ base_shear_df_dict [sim_name ] = base_shear
304+
305+ # -------------------------------------- PLOT THE RESULTS ---------------------------------
306+ # Add plot of mean drifts
307+ if iteration == iterations [- 1 ]:
308+ # Plot mean drift
309+ _plotMeanDriftColor (drifts_df_dict , plotter , xlim_sup , drift_axes , save_fig , fig_size ) if save_drift else None
310+
311+ # Plot mean spectra
312+ _plotMeanSpectraColor (spectra_df_dict , plotter , spectra_axes , save_fig , fig_size ) if save_spectra else None
313+
314+ # Plot mean base shear
315+ _plotMeanBaseShearColor (base_shear_df_dict , plotter , base_shear_axes , save_fig , fig_size , Qmax ) if save_b_shear else None
316+
317+ # Update tqdm
318+ pbar .update (1 )
319+ else :
320+ pbar .update (1 )
321+ sim_type_name = sim_type_map [sim_type ]
322+ sim_name = f'{ sim_type_name } _20f{ nsubs } s_rup_bl_{ iteration } _s{ station } '
323+ drifts_df_dict [sim_name ] = None
324+ spectra_df_dict [sim_name ] = None
325+ base_shear_df_dict [sim_name ] = None
326+ continue
318327 return drifts_df_dict , spectra_df_dict , base_shear_df_dict
319328
320329
0 commit comments