Example #1
0
# In[ ]:

config.fit.fit_range.min = 1 * u.TeV
config.fit.fit_range.max = 10 * u.TeV
config.flux_points.energy = {"min": "1 TeV", "max": "10 TeV", "nbins": 3}

# We're all set.
# But before we go on let's see how to save or import `AnalysisConfig` objects though YAML files.

# ### Using YAML configuration files
#
# One can export/import the `AnalysisConfig` to/from a YAML file.

# In[ ]:

config.write("config.yaml", overwrite=True)

# In[ ]:

config = AnalysisConfig.read("config.yaml")
print(config)

# ## Running the analysis
#
# We first create an `~gammapy.analysis.Analysis` object from our configuration.

# In[ ]:

analysis = Analysis(config)

# ###  Observation selection
Example #2
0
def cli_make_config(filename, overwrite):
    """Writes default configuration file."""
    config = AnalysisConfig()
    config.write(filename, overwrite=overwrite)
    log.info(f"Configuration file produced: {filename}")