code: def baseline_roi_fit(gta, make_plots=False, minmax_npred=[1e3, np.inf]):
      
      gta.free_sources(False)
      gta.write_roi('base_roi', make_plots=make_plots)
      
      gta.free_sources(True, minmax_npred=[1e3, np.inf])
      gta.optimize()
      gta.free_sources(False)      
      gta.print_roi()
docs: Do baseline fitting for a target Region of Interest
  
      Parameters
      ----------
  
      gta : `fermipy.gtaanalysis.GTAnalysis`
          The analysis object
  
      make_plots : bool
          Flag to make standard analysis plots
  
      minmax_npred : tuple or list
          Range of number of predicted coutns for which to free sources in initial fitting.