diff --git a/doc/source/user_manual/getting_started/python.rst b/doc/source/user_manual/getting_started/python.rst index 768672d..117b47b 100644 --- a/doc/source/user_manual/getting_started/python.rst +++ b/doc/source/user_manual/getting_started/python.rst @@ -22,29 +22,26 @@ To illustrate how to use ctools from Python, below is a working example of an event list simulation using the :ref:`ctobssim` class. An instance ``sim`` of the :ref:`ctobssim` class is generated and user parameters are set for this instance using the ``[ ]`` operator. -Note that specific methods exist for [file], [string], [real], [integer], -and [boolean] parameter types (see the :ref:`reference` for a list of -parameters and their types). +See the :ref:`reference` for a list of parameters and their types). The ``execute()`` method executes the :ref:`ctobssim` class in the same way as if it were executed from the command line. .. code-block:: python - >>> import gammalib - >>> import ctools - >>> sim = ctools.ctobssim() - >>> sim["inmodel"].filename("${CTOOLS}/share/models/crab.xml") - >>> sim["outevents"].filename("events.fits") - >>> sim["caldb"].string("prod2") - >>> sim["irf"].string("South_50h") - >>> sim["ra"].real(83.63) - >>> sim["dec"].real(22.01) - >>> sim["rad"].real(5.0) - >>> sim["tmin"].real(0.0) - >>> sim["tmax"].real(1800.0) - >>> sim["emin"].real(0.1) - >>> sim["emax"].real(100.0) - >>> sim.execute() + import ctools + sim = ctools.ctobssim() + sim["inmodel"] = "${CTOOLS}/share/models/crab.xml" + sim["outevents"] = "events.fits" + sim["caldb"] = "prod2" + sim["irf"] = "South_50h" + sim["ra"] = 83.63 + sim["dec"] = 22.01 + sim["rad"] = 5.0 + sim["tmin"] = 0 + sim["tmax"] = 1800 + sim["emin"] = 0.1 + sim["emax"] = 100 + sim.execute() Alternatively, you may "run" the :ref:`ctobssim` tool using @@ -364,5 +361,3 @@ You now have learned the basics of using ctools and GammaLib within Python. To go beyond these initial steps you may check the Python scripts in the ``examples`` folder that provide useful analysis examples. Check the ``README`` file in that folder for an explanation of the scripts. - - diff --git a/examples/benchmark_cta_analysis.py b/examples/benchmark_cta_analysis.py index 452489e..947288e 100755 --- a/examples/benchmark_cta_analysis.py +++ b/examples/benchmark_cta_analysis.py @@ -55,27 +55,27 @@ def unbinned_pipeline(duration): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax sim.run() # Select events select = ctools.ctselect(sim.obs()) - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad_select) - select["tmin"].real(tstart) - select["tmax"].real(tstop) - select["emin"].real(emin) - select["emax"].real(emax) + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad_select + select["tmin"] = tstart + select["tmax"] = tstop + select["emin"] = emin + select["emax"] = emax select.run() # Get ctlike start CPU time @@ -124,31 +124,31 @@ def binned_pipeline(duration): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax sim.run() # Bin events into counts map bin = ctools.ctbin(sim.obs()) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["xref"].real(ra) - bin["yref"].real(dec) - bin["proj"].string(proj) + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["xref"] = ra + bin["yref"] = dec + bin["proj"] = proj bin.run() # Get ctlike start CPU time @@ -197,83 +197,83 @@ def stacked_pipeline(duration): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax sim.run() # Bin events into counts map bin = ctools.ctbin(sim.obs()) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["proj"].string(proj) - bin["xref"].real(ra) - bin["yref"].real(dec) + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["proj"] = proj + bin["xref"] = ra + bin["yref"] = dec bin.run() # Create exposure cube expcube = ctools.ctexpcube(sim.obs()) - expcube["incube"].filename("NONE") - expcube["caldb"].string(caldb) - expcube["irf"].string(irf) - expcube["ebinalg"].string("LOG") - expcube["emin"].real(emin) - expcube["emax"].real(emax) - expcube["enumbins"].integer(enumbins) - expcube["nxpix"].integer(nxpix) - expcube["nypix"].integer(nypix) - expcube["binsz"].real(binsz) - expcube["coordsys"].string(coordsys) - expcube["proj"].string(proj) - expcube["xref"].real(ra) - expcube["yref"].real(dec) + expcube["incube"] = "NONE" + expcube["caldb"] = caldb + expcube["irf"] = irf + expcube["ebinalg"] = "LOG" + expcube["emin"] = emin + expcube["emax"] = emax + expcube["enumbins"] = enumbins + expcube["nxpix"] = nxpix + expcube["nypix"] = nypix + expcube["binsz"] = binsz + expcube["coordsys"] = coordsys + expcube["proj"] = proj + expcube["xref"] = ra + expcube["yref"] = dec expcube.run() # Create PSF cube psfcube = ctools.ctpsfcube(sim.obs()) - psfcube["incube"].filename("NONE") - psfcube["caldb"].string(caldb) - psfcube["irf"].string(irf) - psfcube["ebinalg"].string("LOG") - psfcube["emin"].real(emin) - psfcube["emax"].real(emax) - psfcube["enumbins"].integer(enumbins) - psfcube["nxpix"].integer(10) - psfcube["nypix"].integer(10) - psfcube["binsz"].real(1.0) - psfcube["coordsys"].string(coordsys) - psfcube["proj"].string(proj) - psfcube["xref"].real(ra) - psfcube["yref"].real(dec) + psfcube["incube"] = "NONE" + psfcube["caldb"] = caldb + psfcube["irf"] = irf + psfcube["ebinalg"] = "LOG" + psfcube["emin"] = emin + psfcube["emax"] = emax + psfcube["enumbins"] = enumbins + psfcube["nxpix"] = 10 + psfcube["nypix"] = 10 + psfcube["binsz"] = 1.0 + psfcube["coordsys"] = coordsys + psfcube["proj"] = proj + psfcube["xref"] = ra + psfcube["yref"] = dec psfcube.run() # Create background cube bkgcube = ctools.ctbkgcube(sim.obs()) - bkgcube["incube"].filename("NONE") - bkgcube["ebinalg"].string("LOG") - bkgcube["emin"].real(emin) - bkgcube["emax"].real(emax) - bkgcube["enumbins"].integer(enumbins) - bkgcube["nxpix"].integer(10) - bkgcube["nypix"].integer(10) - bkgcube["binsz"].real(1.0) - bkgcube["coordsys"].string(coordsys) - bkgcube["proj"].string(proj) - bkgcube["xref"].real(ra) - bkgcube["yref"].real(dec) + bkgcube["incube"] = "NONE" + bkgcube["ebinalg"] = "LOG" + bkgcube["emin"] = emin + bkgcube["emax"] = emax + bkgcube["enumbins"] = enumbins + bkgcube["nxpix"] = 10 + bkgcube["nypix"] = 10 + bkgcube["binsz"] = 1.0 + bkgcube["coordsys"] = coordsys + bkgcube["proj"] = proj + bkgcube["xref"] = ra + bkgcube["yref"] = dec bkgcube.run() # Attach background model to observation container diff --git a/examples/check_models.py b/examples/check_models.py index bcc78be..dad457b 100755 --- a/examples/check_models.py +++ b/examples/check_models.py @@ -61,27 +61,27 @@ def pipeline(model_name): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax sim.run() # Select events select = ctools.ctselect(sim.obs()) - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad_select) - select["tmin"].real(tstart) - select["tmax"].real(tstop) - select["emin"].real(emin) - select["emax"].real(emax) + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad_select + select["tmin"] = tstart + select["tmax"] = tstop + select["emin"] = emin + select["emax"] = emax select.run() # Perform maximum likelihood fitting diff --git a/examples/make_spectrum.py b/examples/make_spectrum.py index fc3668b..48a9688 100755 --- a/examples/make_spectrum.py +++ b/examples/make_spectrum.py @@ -48,16 +48,16 @@ def make_spectrum(): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax sim.run() # Generate an energy binning diff --git a/examples/make_ts_distributions.py b/examples/make_ts_distributions.py index 85c5338..6937af0 100755 --- a/examples/make_ts_distributions.py +++ b/examples/make_ts_distributions.py @@ -61,22 +61,22 @@ def create_ts(loge, emin, emax, ntrials=100, duration=180000.0, \ # Setup cstsdist tool tsdist = cstsdist() - tsdist["inmodel"].filename("$CTOOLS/share/models/crab.xml") - tsdist["srcname"].string("Crab") - tsdist["outfile"].filename(outfile) - tsdist["ntrials"].integer(ntrials) - tsdist["caldb"].string("prod2") - tsdist["irf"].string("South_50h") - tsdist["ra"].real(83.63) - tsdist["dec"].real(22.01) - tsdist["emin"].real(float(emin)) - tsdist["emax"].real(float(emax)) - tsdist["enumbins"].integer(int(enumbins)) - tsdist["tmin"].real(0.0) - tsdist["tmax"].real(float(duration)) - tsdist["rad"].real(5.0) - tsdist["npix"].integer(200) - tsdist["binsz"].real(0.05) + tsdist["inmodel"] = "$CTOOLS/share/models/crab.xml" + tsdist["srcname"] = "Crab" + tsdist["outfile"] = outfile + tsdist["ntrials"] = ntrials + tsdist["caldb"] = "prod2" + tsdist["irf"] = "South_50h" + tsdist["ra"] = 83.63 + tsdist["dec"] = 22.01 + tsdist["emin"] = emin + tsdist["emax"] = emax + tsdist["enumbins"] = enumbins + tsdist["tmin"] = 0 + tsdist["tmax"] = duration + tsdist["rad"] = 5.0 + tsdist["npix"] = 200 + tsdist["binsz"] = 0.05 #tsdist["debug"].boolean(True) # Optionally open the log file diff --git a/examples/pipeline_binned_disk.py b/examples/pipeline_binned_disk.py index 35847f6..c9f52e5 100755 --- a/examples/pipeline_binned_disk.py +++ b/examples/pipeline_binned_disk.py @@ -117,8 +117,8 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ """ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) - sim["outevents"].filename("obs.xml") + sim["debug"] = debug + sim["outevents"] = "obs.xml" sim.execute() # Bin events by looping over all observations in the container @@ -132,18 +132,18 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ # Bin events for that observation bin = ctools.ctbin() - bin["inobs"].filename(eventfile) - bin["outcube"].filename(cubefile) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["usepnt"].boolean(True) - bin["proj"].string(proj) + bin["inobs"] = eventfile + bin["outcube"] = cubefile + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["usepnt"] = True + bin["proj"] = proj bin.execute() # Set observation ID @@ -160,15 +160,15 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ # Perform maximum likelihood fitting like = ctools.ctlike() - like["inobs"].filename("obs_cube.xml") - like["inmodel"].filename(model) - like["outmodel"].filename("fit_results.xml") - like["expcube"].filename("NONE") - like["psfcube"].filename("NONE") - like["bkgcube"].filename("NONE") - like["caldb"].string(caldb) - like["irf"].string(irf) - like["debug"].boolean(True) # Switch this always on for results in console + like["inobs"] = "obs_cube.xml" + like["inmodel"] = model + like["outmodel"] = "fit_results.xml" + like["expcube"] = "NONE" + like["psfcube"] = "NONE" + like["bkgcube"] = "NONE" + like["caldb"] = caldb + like["irf"] = irf + like["debug"] = True # Switch this always on for results in console like.execute() # Return diff --git a/examples/pipeline_binned_mem.py b/examples/pipeline_binned_mem.py index 563ecb6..210b3c2 100755 --- a/examples/pipeline_binned_mem.py +++ b/examples/pipeline_binned_mem.py @@ -111,7 +111,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ """ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) + sim["debug"] = debug sim.run() # Bin events by looping over all observations in the container @@ -125,16 +125,16 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ # Bin events for that observation bin = ctools.ctbin(container) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["usepnt"].boolean(True) - bin["proj"].string(proj) + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["usepnt"] = True + bin["proj"] = proj bin.run() # Append result to observations @@ -142,7 +142,7 @@ def run_pipeline(obs, emin=0.1, emax=100.0, \ # Perform maximum likelihood fitting like = ctools.ctlike(obs) - like["debug"].boolean(True) # Switch this always on for results in console + like["debug"] = True # Switch this always on for results in console like.run() # Return diff --git a/examples/pipeline_stacked_disk.py b/examples/pipeline_stacked_disk.py index 32d2e20..2b7cec0 100755 --- a/examples/pipeline_stacked_disk.py +++ b/examples/pipeline_stacked_disk.py @@ -116,104 +116,104 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ """ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) - sim["outevents"].filename("obs.xml") + sim["debug"] = debug + sim["outevents"] = "obs.xml" sim.execute() # Bin events into counts map bin = ctools.ctbin() - bin["inobs"].filename("obs.xml") - bin["outcube"].filename("cntcube.fits") - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["proj"].string(proj) - bin["xref"].real(ra) - bin["yref"].real(dec) - bin["debug"].boolean(debug) + bin["inobs"] = "obs.xml" + bin["outcube"] = "cntcube.fits" + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["proj"] = proj + bin["xref"] = ra + bin["yref"] = dec + bin["debug"] = debug bin.execute() # Create exposure cube expcube = ctools.ctexpcube() - expcube["inobs"].filename("obs.xml") - expcube["incube"].filename("cntcube.fits") - expcube["outcube"].filename("expcube.fits") - expcube["caldb"].string(caldb) - expcube["irf"].string(irf) - expcube["ebinalg"].string("LOG") - expcube["emin"].real(emin) - expcube["emax"].real(emax) - expcube["enumbins"].integer(enumbins) - expcube["nxpix"].integer(nxpix) - expcube["nypix"].integer(nypix) - expcube["binsz"].real(binsz) - expcube["coordsys"].string(coordsys) - expcube["proj"].string(proj) - expcube["xref"].real(ra) - expcube["yref"].real(dec) - expcube["debug"].boolean(debug) + expcube["inobs"] = "obs.xml" + expcube["incube"] = "cntcube.fits" + expcube["outcube"] = "expcube.fits" + expcube["caldb"] = caldb + expcube["irf"] = irf + expcube["ebinalg"] = "LOG" + expcube["emin"] = emin + expcube["emax"] = emax + expcube["enumbins"] = enumbins + expcube["nxpix"] = nxpix + expcube["nypix"] = nypix + expcube["binsz"] = binsz + expcube["coordsys"] = coordsys + expcube["proj"] = proj + expcube["xref"] = ra + expcube["yref"] = dec + expcube["debug"] = debug expcube.execute() # Create PSF cube psfcube = ctools.ctpsfcube() - psfcube["inobs"].filename("obs.xml") - psfcube["incube"].filename("NONE") - psfcube["outcube"].filename("psfcube.fits") - psfcube["caldb"].string(caldb) - psfcube["irf"].string(irf) - psfcube["ebinalg"].string("LOG") - psfcube["emin"].real(emin) - psfcube["emax"].real(emax) - psfcube["enumbins"].integer(enumbins) - psfcube["nxpix"].integer(10) - psfcube["nypix"].integer(10) - psfcube["binsz"].real(1.0) - psfcube["coordsys"].string(coordsys) - psfcube["proj"].string(proj) - psfcube["xref"].real(ra) - psfcube["yref"].real(dec) - psfcube["debug"].boolean(debug) + psfcube["inobs"] = "obs.xml" + psfcube["incube"] = "NONE" + psfcube["outcube"] = "psfcube.fits" + psfcube["caldb"] = caldb + psfcube["irf"] = irf + psfcube["ebinalg"] = "LOG" + psfcube["emin"] = emin + psfcube["emax"] = emax + psfcube["enumbins"] = enumbins + psfcube["nxpix"] = 10 + psfcube["nypix"] = 10 + psfcube["binsz"] = 1.0 + psfcube["coordsys"] = coordsys + psfcube["proj"] = proj + psfcube["xref"] = ra + psfcube["yref"] = dec + psfcube["debug"] = debug psfcube.execute() # Create background cube bkgcube = ctools.ctbkgcube() - bkgcube["inobs"].filename("obs.xml") - bkgcube["inmodel"].filename(model) - bkgcube["incube"].filename("cntcube.fits") - bkgcube["outcube"].filename("bkgcube.fits") - bkgcube["outmodel"].filename("model_bkg.xml") - bkgcube["caldb"].string(caldb) - bkgcube["irf"].string(irf) - bkgcube["ebinalg"].string("LOG") - bkgcube["emin"].real(emin) - bkgcube["emax"].real(emax) - bkgcube["enumbins"].integer(enumbins) - bkgcube["nxpix"].integer(10) - bkgcube["nypix"].integer(10) - bkgcube["binsz"].real(1.0) - bkgcube["coordsys"].string(coordsys) - bkgcube["proj"].string(proj) - bkgcube["xref"].real(ra) - bkgcube["yref"].real(dec) - bkgcube["debug"].boolean(debug) + bkgcube["inobs"] = "obs.xml" + bkgcube["inmodel"] = model + bkgcube["incube"] = "cntcube.fits" + bkgcube["outcube"] = "bkgcube.fits" + bkgcube["outmodel"] = "model_bkg.xml" + bkgcube["caldb"] = caldb + bkgcube["irf"] = irf + bkgcube["ebinalg"] = "LOG" + bkgcube["emin"] = emin + bkgcube["emax"] = emax + bkgcube["enumbins"] = enumbins + bkgcube["nxpix"] = 10 + bkgcube["nypix"] = 10 + bkgcube["binsz"] = 1.0 + bkgcube["coordsys"] = coordsys + bkgcube["proj"] = proj + bkgcube["xref"] = ra + bkgcube["yref"] = dec + bkgcube["debug"] = debug bkgcube.execute() # Perform maximum likelihood fitting like = ctools.ctlike() - like["inobs"].filename("cntcube.fits") - like["inmodel"].filename("model_bkg.xml") - like["outmodel"].filename("fit_results.xml") - like["expcube"].filename("expcube.fits") - like["psfcube"].filename("psfcube.fits") - like["bkgcube"].filename("bkgcube.fits") - like["caldb"].string(caldb) - like["irf"].string(irf) - like["debug"].boolean(True) # Switch this always on for results in console + like["inobs"] = "cntcube.fits" + like["inmodel"] = "model_bkg.xml" + like["outmodel"] = "fit_results.xml" + like["expcube"] = "expcube.fits" + like["psfcube"] = "psfcube.fits" + like["bkgcube"] = "bkgcube.fits" + like["caldb"] = caldb + like["irf"] = irf + like["debug"] = True # Switch this always on for results in console like.execute() # Return diff --git a/examples/pipeline_stacked_mem.py b/examples/pipeline_stacked_mem.py index 1a694f5..1a13f1c 100755 --- a/examples/pipeline_stacked_mem.py +++ b/examples/pipeline_stacked_mem.py @@ -113,74 +113,74 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ """ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) + sim["debug"] = debug sim.run() # Bin events into counts map bin = ctools.ctbin(sim.obs()) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(enumbins) - bin["nxpix"].integer(nxpix) - bin["nypix"].integer(nypix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coordsys) - bin["proj"].string(proj) - bin["xref"].real(ra) - bin["yref"].real(dec) - bin["debug"].boolean(debug) + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = enumbins + bin["nxpix"] = nxpix + bin["nypix"] = nypix + bin["binsz"] = binsz + bin["coordsys"] = coordsys + bin["proj"] = proj + bin["xref"] = ra + bin["yref"] = dec + bin["debug"] = debug bin.run() # Create exposure cube expcube = ctools.ctexpcube(sim.obs()) - expcube["incube"].filename("NONE") - expcube["ebinalg"].string("LOG") - expcube["emin"].real(emin) - expcube["emax"].real(emax) - expcube["enumbins"].integer(enumbins) - expcube["nxpix"].integer(nxpix) - expcube["nypix"].integer(nypix) - expcube["binsz"].real(binsz) - expcube["coordsys"].string(coordsys) - expcube["proj"].string(proj) - expcube["xref"].real(ra) - expcube["yref"].real(dec) - expcube["debug"].boolean(debug) + expcube["incube"] = "NONE" + expcube["ebinalg"] = "LOG" + expcube["emin"] = emin + expcube["emax"] = emax + expcube["enumbins"] = enumbins + expcube["nxpix"] = nxpix + expcube["nypix"] = nypix + expcube["binsz"] = binsz + expcube["coordsys"] = coordsys + expcube["proj"] = proj + expcube["xref"] = ra + expcube["yref"] = dec + expcube["debug"] = debug expcube.run() # Create PSF cube psfcube = ctools.ctpsfcube(sim.obs()) - psfcube["incube"].filename("NONE") - psfcube["ebinalg"].string("LOG") - psfcube["emin"].real(emin) - psfcube["emax"].real(emax) - psfcube["enumbins"].integer(enumbins) - psfcube["nxpix"].integer(10) - psfcube["nypix"].integer(10) - psfcube["binsz"].real(1.0) - psfcube["coordsys"].string(coordsys) - psfcube["proj"].string(proj) - psfcube["xref"].real(ra) - psfcube["yref"].real(dec) - psfcube["debug"].boolean(debug) + psfcube["incube"] = "NONE" + psfcube["ebinalg"] = "LOG" + psfcube["emin"] = emin + psfcube["emax"] = emax + psfcube["enumbins"] = enumbins + psfcube["nxpix"] = 10 + psfcube["nypix"] = 10 + psfcube["binsz"] = 1.0 + psfcube["coordsys"] = coordsys + psfcube["proj"] = proj + psfcube["xref"] = ra + psfcube["yref"] = dec + psfcube["debug"] = debug psfcube.run() # Create background cube bkgcube = ctools.ctbkgcube(sim.obs()) - bkgcube["incube"].filename("NONE") - bkgcube["ebinalg"].string("LOG") - bkgcube["emin"].real(emin) - bkgcube["emax"].real(emax) - bkgcube["enumbins"].integer(enumbins) - bkgcube["nxpix"].integer(10) - bkgcube["nypix"].integer(10) - bkgcube["binsz"].real(1.0) - bkgcube["coordsys"].string(coordsys) - bkgcube["proj"].string(proj) - bkgcube["xref"].real(ra) - bkgcube["yref"].real(dec) - bkgcube["debug"].boolean(debug) + bkgcube["incube"] = "NONE" + bkgcube["ebinalg"] = "LOG" + bkgcube["emin"] = emin + bkgcube["emax"] = emax + bkgcube["enumbins"] = enumbins + bkgcube["nxpix"] = 10 + bkgcube["nypix"] = 10 + bkgcube["binsz"] = 1.0 + bkgcube["coordsys"] = coordsys + bkgcube["proj"] = proj + bkgcube["xref"] = ra + bkgcube["yref"] = dec + bkgcube["debug"] = debug bkgcube.run() # Attach background model to observation container @@ -192,7 +192,7 @@ def run_pipeline(obs, ra=83.63, dec=22.01, emin=0.1, emax=100.0, \ # Perform maximum likelihood fitting like = ctools.ctlike(bin.obs()) - like["debug"].boolean(True) # Switch this always on for results in console + like["debug"] = True # Switch this always on for results in console like.run() # Return diff --git a/examples/pipeline_unbinned_disk.py b/examples/pipeline_unbinned_disk.py index 65fefe6..fd72465 100755 --- a/examples/pipeline_unbinned_disk.py +++ b/examples/pipeline_unbinned_disk.py @@ -118,32 +118,32 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) - sim["outevents"].filename("obs.xml") + sim["debug"] = debug + sim["outevents"] = "obs.xml" sim.execute() # Select events select = ctools.ctselect() - select["inobs"].filename("obs.xml") - select["outobs"].filename("obs_selected.xml") - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad) - select["emin"].real(emin) - select["emax"].real(emax) - select["tmin"].real(tmin) - select["tmax"].real(tmax) - select["debug"].boolean(debug) + select["inobs"] = "obs.xml" + select["outobs"] = "obs_selected.xml" + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad + select["emin"] = emin + select["emax"] = emax + select["tmin"] = tmin + select["tmax"] = tmax + select["debug"] = debug select.execute() # Perform maximum likelihood fitting like = ctools.ctlike() - like["inobs"].filename("obs_selected.xml") - like["inmodel"].filename(model) - like["outmodel"].filename("fit_results.xml") - like["caldb"].string(caldb) - like["irf"].string(irf) - like["debug"].boolean(True) # Switch this always on for results in console + like["inobs"] = "obs_selected.xml" + like["inmodel"] = model + like["outmodel"] = "fit_results.xml" + like["caldb"] = caldb + like["irf"] = irf + like["debug"] = True # Switch this always on for results in console like.execute() # Return diff --git a/examples/pipeline_unbinned_mem.py b/examples/pipeline_unbinned_mem.py index db16193..89fcb86 100755 --- a/examples/pipeline_unbinned_mem.py +++ b/examples/pipeline_unbinned_mem.py @@ -111,24 +111,24 @@ def run_pipeline(obs, ra=83.63, dec=22.01, rad=3.0, \ """ # Simulate events sim = ctools.ctobssim(obs) - sim["debug"].boolean(debug) + sim["debug"] = debug sim.run() # Select events select = ctools.ctselect(sim.obs()) - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad) - select["emin"].real(emin) - select["emax"].real(emax) - select["tmin"].real(tmin) - select["tmax"].real(tmax) - select["debug"].boolean(debug) + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad + select["emin"] = emin + select["emax"] = emax + select["tmin"] = tmin + select["tmax"] = tmax + select["debug"] = debug select.run() # Perform maximum likelihood fitting like = ctools.ctlike(select.obs()) - like["debug"].boolean(True) # Switch this always on for results in console + like["debug"] = True # Switch this always on for results in console like.run() # Return diff --git a/pyext/ctools/analysisutils.py b/pyext/ctools/analysisutils.py index 748e900..be634c7 100644 --- a/pyext/ctools/analysisutils.py +++ b/pyext/ctools/analysisutils.py @@ -260,17 +260,17 @@ class Analyser(base): bin = ct.ctbin() bin["evfile"] = self.m_evtfile bin["outfile"] = self.m_cntfile - bin["ebinalg"].string(self.m_ebinalg) - bin["emin"].real(self.m_emin) - bin["emax"].real(self.m_emax) + bin["ebinalg"] = self.m_ebinalg + bin["emin"] = self.m_emin + bin["emax"] = self.m_emax Nbdecade = log10(self.m_emax)-log10(self.m_emin)#Compute the number of decade - bin["enumbins"].integer(int(self.m_enumbins*Nbdecade)) - bin["usepnt"].boolean(self.m_usepnt) # Use pointing for map centre - bin["nxpix"].integer(self.m_nxpix) - bin["nypix"].integer(self.m_nypix) - bin["binsz"].real(self.m_binsz) - bin["coordsys"].string(self.m_coordsys) - bin["proj"].string(self.m_proj) + bin["enumbins"] = int(self.m_enumbins*Nbdecade) + bin["usepnt"] = self.m_usepnt # Use pointing for map centre + bin["nxpix"] = self.m_nxpix + bin["nypix"] = self.m_nypix + bin["binsz"] = self.m_binsz + bin["coordsys"] = self.m_coordsys + bin["proj"] = self.m_proj # Optionally open the log file if log: @@ -278,7 +278,7 @@ class Analyser(base): # Optionally switch-on debugging model if debug: - bin["debug"].boolean(True) + bin["debug"] = True # Run ctbin application. This will loop over all observations in # the container and bin the events in counts maps @@ -302,11 +302,11 @@ class Analyser(base): else: self.like["infile"] = self.m_evtfile - self.like["stat"].string(self.m_stat) - self.like["caldb"].string(self.m_caldb) - self.like["irf"].string(self.m_irf) + self.like["stat"] = self.m_stat + self.like["caldb"] = self.m_caldb + self.like["irf"] = self.m_irf self.like["srcmdl"] = self.m_xml - self.like["edisp"].boolean(self.m_edisp) + self.like["edisp"] = self.m_edisp self.like["outmdl"] = self.m_xml_out # Optionally open the log file @@ -314,7 +314,7 @@ class Analyser(base): self.like.logFileOpen() # Optionally switch-on debugging model if debug: - self.like["debug"].boolean(True) + self.like["debug"] = True def fit(self,log=False,debug=False): self.validate() diff --git a/pyext/ctools/obsutils.py b/pyext/ctools/obsutils.py index 4bb159e..6f632c5 100755 --- a/pyext/ctools/obsutils.py +++ b/pyext/ctools/obsutils.py @@ -45,8 +45,8 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, # Allocate ctobssim application and set parameters sim = ctools.ctobssim(obs) - sim["seed"].integer(seed) - sim["edisp"].boolean(edisp) + sim["seed"] = seed + sim["edisp"] = edisp # Optionally open the log file if log: @@ -54,10 +54,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, # Optionally switch-on debugging model if debug: - sim["debug"].boolean(True) + sim["debug"] = True # Set chatter level - sim["chatter"].integer(chatter) + sim["chatter"] = chatter # Run ctobssim application. This will loop over all observations in the # container and simulation the events for each observation. Note that @@ -85,16 +85,16 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, # Allocate ctbin application and set parameters bin = ctools.ctbin(sim.obs()) - bin["ebinalg"].string("LOG") - bin["emin"].real(emin) - bin["emax"].real(emax) - bin["enumbins"].integer(nbins) - bin["usepnt"].boolean(True) # Use pointing for map centre - bin["nxpix"].integer(npix) - bin["nypix"].integer(npix) - bin["binsz"].real(binsz) - bin["coordsys"].string(coord) - bin["proj"].string(proj) + bin["ebinalg"] = "LOG" + bin["emin"] = emin + bin["emax"] = emax + bin["enumbins"] = nbins + bin["usepnt"] = True # Use pointing for map centre + bin["nxpix"] = npix + bin["nypix"] = npix + bin["binsz"] = binsz + bin["coordsys"] = coord + bin["proj"] = proj # Optionally open the log file if log: @@ -102,10 +102,10 @@ def sim(obs, log=False, debug=False, chatter=2, edisp=False, seed=0, nbins=0, # Optionally switch-on debugging model if debug: - bin["debug"].boolean(True) + bin["debug"] = True # Set chatter level - bin["chatter"].integer(chatter) + bin["chatter"] = chatter # Run ctbin application. This will loop over all observations in # the container and bin the events in counts maps @@ -154,13 +154,13 @@ def fit(obs, log=False, debug=False, chatter=2, edisp=False): # Optionally switch-on debugging model if debug: - like["debug"].boolean(True) + like["debug"] = True # Set chatter level - like["chatter"].integer(chatter) + like["chatter"] = chatter # Optionally apply energy dispersion - like["edisp"].boolean(edisp) + like["edisp"] = edisp # Run ctlike application. like.run() @@ -189,7 +189,7 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2): error = ctools.cterror(obs) # Set cterror parameters - error["srcname"].string(srcname) + error["srcname"] = srcname # Optionally open the log file if log: @@ -197,10 +197,10 @@ def cterror(obs, srcname, log=False, debug=False, chatter=2): # Optionally switch-on debugging model if debug: - error["debug"].boolean(True) + error["debug"] = True # Set chatter level - error["chatter"].integer(chatter) + error["chatter"] = chatter # Run cterror application. error.run() @@ -625,13 +625,13 @@ def spectrum(obs, source, ebounds): # Clone observations and reset energy thresholds select = ctools.ctselect(obs) - select["ra"].value("UNDEF") - select["dec"].value("UNDEF") - select["rad"].value("UNDEF") - select["tmin"].real(0.0) - select["tmax"].real(0.0) - select["emin"].real(ebounds.emin(i).TeV()) - select["emax"].real(ebounds.emax(i).TeV()) + select["ra"] = "UNDEF" + select["dec"] = "UNDEF" + select["rad"] = "UNDEF" + select["tmin"] = 0 + select["tmax"] = 0 + select["emin"] = ebounds.emin(i).TeV() + select["emax"] = ebounds.emax(i).TeV() select.run() # Refit and write out to spectrum diff --git a/scripts/cslightcrv.py b/scripts/cslightcrv.py index 2ebdcec..c66c23c 100755 --- a/scripts/cslightcrv.py +++ b/scripts/cslightcrv.py @@ -378,13 +378,13 @@ class cslightcrv(ctools.cscript): # Select events select = ctools.ctselect(self.obs) - select["emin"].real(self.m_emin) - select["emax"].real(self.m_emax) - select["tmin"].real(tmin.convert(select.time_reference())) - select["tmax"].real(tmax.convert(select.time_reference())) - select["rad"].value("UNDEFINED") - select["ra"].value("UNDEFINED") - select["dec"].value("UNDEFINED") + select["emin"] = self.m_emin + select["emax"] = self.m_emax + select["tmin"] = tmin.convert(select.time_reference()) + select["tmax"] = tmax.convert(select.time_reference()) + select["rad"] = "UNDEFINED" + select["ra"] = "UNDEFINED" + select["dec"] = "UNDEFINED" select.run() # Retrieve observation @@ -399,18 +399,18 @@ class cslightcrv(ctools.cscript): # Bin events bin = ctools.ctbin(select.obs()) - bin["usepnt"].boolean(False) - bin["ebinalg"].string("LOG") - bin["xref"].real(self.m_xref) - bin["yref"].real(self.m_yref) - bin["binsz"].real(self.m_binsz) - bin["nxpix"].integer(self.m_nxpix) - bin["nypix"].integer(self.m_nypix) - bin["enumbins"].integer(self.m_ebins) - bin["emin"].real(self.m_emin) - bin["emax"].real(self.m_emax) - bin["coordsys"].string(self.m_coordsys) - bin["proj"].string(self.m_proj) + bin["usepnt"] = False + bin["ebinalg"] = "LOG" + bin["xref"] = self.m_xref + bin["yref"] = self.m_yref + bin["binsz"] = self.m_binsz + bin["nxpix"] = self.m_nxpix + bin["nypix"] = self.m_nypix + bin["enumbins"] = self.m_ebins + bin["emin"] = self.m_emin + bin["emax"] = self.m_emax + bin["coordsys"] = self.m_coordsys + bin["proj"] = self.m_proj bin.run() # Header @@ -419,19 +419,19 @@ class cslightcrv(ctools.cscript): # Create exposure cube expcube = ctools.ctexpcube(select.obs()) - expcube["incube"].filename("NONE") - expcube["usepnt"].boolean(False) - expcube["ebinalg"].string("LOG") - expcube["xref"].real(self.m_xref) - expcube["yref"].real(self.m_yref) - expcube["binsz"].real(self.m_binsz) - expcube["nxpix"].integer(self.m_nxpix) - expcube["nypix"].integer(self.m_nypix) - expcube["enumbins"].integer(self.m_ebins) - expcube["emin"].real(self.m_emin) - expcube["emax"].real(self.m_emax) - expcube["coordsys"].string(self.m_coordsys) - expcube["proj"].string(self.m_proj) + expcube["incube"] = "NONE" + expcube["usepnt"] = False + expcube["ebinalg"] = "LOG" + expcube["xref"] = self.m_xref + expcube["yref"] = self.m_yref + expcube["binsz"] = self.m_binsz + expcube["nxpix"] = self.m_nxpix + expcube["nypix"] = self.m_nypix + expcube["enumbins"] = self.m_ebins + expcube["emin"] = self.m_emin + expcube["emax"] = self.m_emax + expcube["coordsys"] = self.m_coordsys + expcube["proj"] = self.m_proj expcube.run() # Header @@ -440,19 +440,19 @@ class cslightcrv(ctools.cscript): # Create psf cube psfcube = ctools.ctpsfcube(select.obs()) - psfcube["incube"].filename("NONE") - psfcube["usepnt"].boolean(False) - psfcube["ebinalg"].string("LOG") - psfcube["xref"].real(self.m_xref) - psfcube["yref"].real(self.m_yref) - psfcube["binsz"].real(self.m_binsz) - psfcube["nxpix"].integer(self.m_nxpix) - psfcube["nypix"].integer(self.m_nypix) - psfcube["enumbins"].integer(self.m_ebins) - psfcube["emin"].real(self.m_emin) - psfcube["emax"].real(self.m_emax) - psfcube["coordsys"].string(self.m_coordsys) - psfcube["proj"].string(self.m_proj) + psfcube["incube"] = "NONE" + psfcube["usepnt"] = False + psfcube["ebinalg"] = "LOG" + psfcube["xref"] = self.m_xref + psfcube["yref"] = self.m_yref + psfcube["binsz"] = self.m_binsz + psfcube["nxpix"] = self.m_nxpix + psfcube["nypix"] = self.m_nypix + psfcube["enumbins"] = self.m_ebins + psfcube["emin"] = self.m_emin + psfcube["emax"] = self.m_emax + psfcube["coordsys"] = self.m_coordsys + psfcube["proj"] = self.m_proj psfcube.run() # Header @@ -461,19 +461,19 @@ class cslightcrv(ctools.cscript): # Create background cube bkgcube = ctools.ctbkgcube(select.obs()) - bkgcube["incube"].filename("NONE") - bkgcube["usepnt"].boolean(False) - bkgcube["ebinalg"].string("LOG") - bkgcube["xref"].real(self.m_xref) - bkgcube["yref"].real(self.m_yref) - bkgcube["binsz"].real(self.m_binsz) - bkgcube["nxpix"].integer(self.m_nxpix) - bkgcube["nypix"].integer(self.m_nypix) - bkgcube["enumbins"].integer(self.m_ebins) - bkgcube["emin"].real(self.m_emin) - bkgcube["emax"].real(self.m_emax) - bkgcube["coordsys"].string(self.m_coordsys) - bkgcube["proj"].string(self.m_proj) + bkgcube["incube"] = "NONE" + bkgcube["usepnt"] = False + bkgcube["ebinalg"] = "LOG" + bkgcube["xref"] = self.m_xref + bkgcube["yref"] = self.m_yref + bkgcube["binsz"] = self.m_binsz + bkgcube["nxpix"] = self.m_nxpix + bkgcube["nypix"] = self.m_nypix + bkgcube["enumbins"] = self.m_ebins + bkgcube["emin"] = self.m_emin + bkgcube["emax"] = self.m_emax + bkgcube["coordsys"] = self.m_coordsys + bkgcube["proj"] = self.m_proj bkgcube.run() # Set new binned observation @@ -531,8 +531,8 @@ class cslightcrv(ctools.cscript): # Create upper limit object ulimit = ctools.ctulimit(like.obs()) - ulimit["srcname"].string(self.m_srcname) - ulimit["eref"].real(1.0) + ulimit["srcname"] = self.m_srcname + ulimit["eref"] = 1.0 # Try to run upper limit and catch exceptions try: diff --git a/scripts/csresmap.py b/scripts/csresmap.py index 1ab36fe..19b4221 100755 --- a/scripts/csresmap.py +++ b/scripts/csresmap.py @@ -217,20 +217,20 @@ class csresmap(ctools.cscript): # Create countsmap bin = ctools.ctbin(self.obs) - bin["nxpix"].integer(self.m_nxpix) - bin["nypix"].integer(self.m_nypix) - bin["proj"].string(self.m_proj) - bin["coordsys"].string(self.m_coordsys) - bin["xref"].real(self.m_xref) - bin["yref"].real(self.m_yref) - bin["enumbins"].integer(self.m_enumbins) - bin["ebinalg"].string(self.m_ebinalg) - bin["emin"].real(self.m_emin) - bin["emax"].real(self.m_emax) - bin["binsz"].real(self.m_binsz) - bin["chatter"].integer(self.m_chatter) - bin["clobber"].boolean(self.m_clobber) - bin["debug"].boolean(self.m_debug) + bin["nxpix"] = self.m_nxpix + bin["nypix"] = self.m_nypix + bin["proj"] = self.m_proj + bin["coordsys"] = self.m_coordsys + bin["xref"] = self.m_xref + bin["yref"] = self.m_yref + bin["enumbins"] = self.m_enumbins + bin["ebinalg"] = self.m_ebinalg + bin["emin"] = self.m_emin + bin["emax"] = self.m_emax + bin["binsz"] = self.m_binsz + bin["chatter"] = self.m_chatter + bin["clobber"] = self.m_clobber + bin["debug"] = self.m_debug bin.run() # Store counts map as residual map. Note that we need a @@ -250,9 +250,9 @@ class csresmap(ctools.cscript): # Create model map model = ctools.ctmodel(self.obs) model.cube(bin.cube()) - model["chatter"].integer(self.m_chatter) - model["clobber"].boolean(self.m_clobber) - model["debug"].boolean(self.m_debug) + model["chatter"] = self.m_chatter + model["clobber"] = self.m_clobber + model["debug"] = self.m_debug model.run() # Get model map into GSkymap object diff --git a/scripts/csspec.py b/scripts/csspec.py index d5379a9..163afdb 100755 --- a/scripts/csspec.py +++ b/scripts/csspec.py @@ -322,13 +322,13 @@ class csspec(ctools.cscript): # Select events select = ctools.ctselect(self.obs) - select["emin"].real(emin.TeV()) - select["emax"].real(emax.TeV()) - select["tmin"].value("UNDEFINED") - select["tmax"].value("UNDEFINED") - select["rad"].value("UNDEFINED") - select["ra"].value("UNDEFINED") - select["dec"].value("UNDEFINED") + select["emin"] = emin.TeV() + select["emax"] = emax.TeV() + select["tmin"] = "UNDEFINED" + select["tmax"] = "UNDEFINED" + select["rad"] = "UNDEFINED" + select["ra"] = "UNDEFINED" + select["dec"] = "UNDEFINED" select.run() # Retrieve observation @@ -343,18 +343,18 @@ class csspec(ctools.cscript): # Bin events bin = ctools.ctbin(select.obs()) - bin["usepnt"].boolean(False) - bin["ebinalg"].string("LOG") - bin["xref"].real(self.m_xref) - bin["yref"].real(self.m_yref) - bin["binsz"].real(self.m_binsz) - bin["nxpix"].integer(self.m_nxpix) - bin["nypix"].integer(self.m_nypix) - bin["enumbins"].integer(self.m_ebins) - bin["emin"].real(emin.TeV()) - bin["emax"].real(emax.TeV()) - bin["coordsys"].string(self.m_coordsys) - bin["proj"].string(self.m_proj) + bin["usepnt"] = False + bin["ebinalg"] = "LOG" + bin["xref"] = self.m_xref + bin["yref"] = self.m_yref + bin["binsz"] = self.m_binsz + bin["nxpix"] = self.m_nxpix + bin["nypix"] = self.m_nypix + bin["enumbins"] = self.m_ebins + bin["emin"] = emin.TeV() + bin["emax"] = emax.TeV() + bin["coordsys"] = self.m_coordsys + bin["proj"] = self.m_proj bin.run() # Header @@ -363,19 +363,19 @@ class csspec(ctools.cscript): # Create exposure cube expcube = ctools.ctexpcube(select.obs()) - expcube["incube"].filename("NONE") - expcube["usepnt"].boolean(False) - expcube["ebinalg"].string("LOG") - expcube["xref"].real(self.m_xref) - expcube["yref"].real(self.m_yref) - expcube["binsz"].real(self.m_binsz) - expcube["nxpix"].integer(self.m_nxpix) - expcube["nypix"].integer(self.m_nypix) - expcube["enumbins"].integer(self.m_ebins) - expcube["emin"].real(emin.TeV()) - expcube["emax"].real(emax.TeV()) - expcube["coordsys"].string(self.m_coordsys) - expcube["proj"].string(self.m_proj) + expcube["incube"] = "NONE" + expcube["usepnt"] = False + expcube["ebinalg"] = "LOG" + expcube["xref"] = self.m_xref + expcube["yref"] = self.m_yref + expcube["binsz"] = self.m_binsz + expcube["nxpix"] = self.m_nxpix + expcube["nypix"] = self.m_nypix + expcube["enumbins"] = self.m_ebins + expcube["emin"] = emin.TeV() + expcube["emax"] = emax.TeV() + expcube["coordsys"] = self.m_coordsys + expcube["proj"] = self.m_proj expcube.run() # Header @@ -384,19 +384,19 @@ class csspec(ctools.cscript): # Create psf cube psfcube = ctools.ctpsfcube(select.obs()) - psfcube["incube"].filename("NONE") - psfcube["usepnt"].boolean(False) - psfcube["ebinalg"].string("LOG") - psfcube["xref"].real(self.m_xref) - psfcube["yref"].real(self.m_yref) - psfcube["binsz"].real(self.m_binsz) - psfcube["nxpix"].integer(self.m_nxpix) - psfcube["nypix"].integer(self.m_nypix) - psfcube["enumbins"].integer(self.m_ebins) - psfcube["emin"].real(emin.TeV()) - psfcube["emax"].real(emax.TeV()) - psfcube["coordsys"].string(self.m_coordsys) - psfcube["proj"].string(self.m_proj) + psfcube["incube"] = "NONE" + psfcube["usepnt"] = False + psfcube["ebinalg"] = "LOG" + psfcube["xref"] = self.m_xref + psfcube["yref"] = self.m_yref + psfcube["binsz"] = self.m_binsz + psfcube["nxpix"] = self.m_nxpix + psfcube["nypix"] = self.m_nypix + psfcube["enumbins"] = self.m_ebins + psfcube["emin"] = emin.TeV() + psfcube["emax"] = emax.TeV() + psfcube["coordsys"] = self.m_coordsys + psfcube["proj"] = self.m_proj psfcube.run() # Header @@ -405,19 +405,19 @@ class csspec(ctools.cscript): # Create background cube bkgcube = ctools.ctbkgcube(select.obs()) - bkgcube["incube"].filename("NONE") - bkgcube["usepnt"].boolean(False) - bkgcube["ebinalg"].string("LOG") - bkgcube["xref"].real(self.m_xref) - bkgcube["yref"].real(self.m_yref) - bkgcube["binsz"].real(self.m_binsz) - bkgcube["nxpix"].integer(self.m_nxpix) - bkgcube["nypix"].integer(self.m_nypix) - bkgcube["enumbins"].integer(self.m_ebins) - bkgcube["emin"].real(emin.TeV()) - bkgcube["emax"].real(emax.TeV()) - bkgcube["coordsys"].string(self.m_coordsys) - bkgcube["proj"].string(self.m_proj) + bkgcube["incube"] = "NONE" + bkgcube["usepnt"] = False + bkgcube["ebinalg"] = "LOG" + bkgcube["xref"] = self.m_xref + bkgcube["yref"] = self.m_yref + bkgcube["binsz"] = self.m_binsz + bkgcube["nxpix"] = self.m_nxpix + bkgcube["nypix"] = self.m_nypix + bkgcube["enumbins"] = self.m_ebins + bkgcube["emin"] = emin.TeV() + bkgcube["emax"] = emax.TeV() + bkgcube["coordsys"] = self.m_coordsys + bkgcube["proj"] = self.m_proj bkgcube.run() # Set new binned observation @@ -475,8 +475,8 @@ class csspec(ctools.cscript): # Create upper limit object ulimit = ctools.ctulimit(like.obs()) - ulimit["srcname"].string(self.m_srcname) - ulimit["eref"].real(elogmean.TeV()) + ulimit["srcname"] = self.m_srcname + ulimit["eref"] = elogmean.TeV() # Try to run upper limit and catch exceptions try: diff --git a/test/test_ctbin.py b/test/test_ctbin.py index 0e15eef..91c8999 100755 --- a/test/test_ctbin.py +++ b/test/test_ctbin.py @@ -64,19 +64,19 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctbin bin = ctools.ctbin() - bin["inobs"].filename(self.events_name) - bin["outcube"].filename("cntmap.fits") - bin["ebinalg"].string("LOG") - bin["emin"].real(0.1) - bin["emax"].real(100.0) - bin["enumbins"].integer(20) - bin["nxpix"].integer(200) - bin["nypix"].integer(200) - bin["binsz"].real(0.02) - bin["coordsys"].string("CEL") - bin["proj"].string("CAR") - bin["xref"].real(83.63) - bin["yref"].real(22.01) + bin["inobs"] = self.events_name + bin["outcube"] = "cntmap.fits" + bin["ebinalg"] = "LOG" + bin["emin"] = 0.1 + bin["emax"] = 100.0 + bin["enumbins"] = 20 + bin["nxpix"] = 200 + bin["nypix"] = 200 + bin["binsz"] = 0.02 + bin["coordsys"] = "CEL" + bin["proj"] = "CAR" + bin["xref"] = 83.63 + bin["yref"] = 22.01 # Run tool self.test_try("Run ctbin") diff --git a/test/test_ctbkgcube.py b/test/test_ctbkgcube.py index b2b4d88..3957ae1 100755 --- a/test/test_ctbkgcube.py +++ b/test/test_ctbkgcube.py @@ -67,24 +67,24 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctbkgcube bkgcube = ctools.ctbkgcube() - bkgcube["inobs"].filename(self.events_name) - bkgcube["inmodel"].filename(self.bkg_model) - bkgcube["incube"].filename("NONE") - bkgcube["outcube"].filename("bkgcube.fits") - bkgcube["outmodel"].filename("bkgcube.xml") - bkgcube["caldb"].string(self.caldb) - bkgcube["irf"].string(self.irf) - bkgcube["ebinalg"].string("LOG") - bkgcube["emin"].real(0.1) - bkgcube["emax"].real(100.0) - bkgcube["enumbins"].integer(20) - bkgcube["nxpix"].integer(10) - bkgcube["nypix"].integer(10) - bkgcube["binsz"].real(0.4) - bkgcube["coordsys"].string("CEL") - bkgcube["proj"].string("CAR") - bkgcube["xref"].real(83.63) - bkgcube["yref"].real(22.01) + bkgcube["inobs"] = self.events_name + bkgcube["inmodel"] = self.bkg_model + bkgcube["incube"] = "NONE" + bkgcube["outcube"] = "bkgcube.fits" + bkgcube["outmodel"] = "bkgcube.xml" + bkgcube["caldb"] = self.caldb + bkgcube["irf"] = self.irf + bkgcube["ebinalg"] = "LOG" + bkgcube["emin"] = 0.1 + bkgcube["emax"] = 100 + bkgcube["enumbins"] = 20 + bkgcube["nxpix"] = 10 + bkgcube["nypix"] = 10 + bkgcube["binsz"] = 0.4 + bkgcube["coordsys"] = "CEL" + bkgcube["proj"] = "CAR" + bkgcube["xref"] = 83.63 + bkgcube["yref"] = 22.01 # Run tool self.test_try("Run ctbkgcube") diff --git a/test/test_ctbutterfly.py b/test/test_ctbutterfly.py index 34aa9c8..1dfeeec 100755 --- a/test/test_ctbutterfly.py +++ b/test/test_ctbutterfly.py @@ -67,14 +67,14 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctbutterfly butterfly = ctools.ctbutterfly() - butterfly["inobs"].filename(self.events_name) - butterfly["inmodel"].filename(self.model_name) - butterfly["srcname"].string("Crab") - butterfly["caldb"].string(self.caldb) - butterfly["irf"].string(self.irf) - butterfly["emin"].real(0.1) - butterfly["emax"].real(100) - butterfly["outfile"].filename("butterfly.txt") + butterfly["inobs"] = self.events_name + butterfly["inmodel"] = self.model_name + butterfly["srcname"] = "Crab" + butterfly["caldb"] = self.caldb + butterfly["irf"] = self.irf + butterfly["emin"] = 0.1 + butterfly["emax"] = 100 + butterfly["outfile"] = "butterfly.txt" # Run tool self.test_try("Run ctbutterfly") diff --git a/test/test_ctcubemask.py b/test/test_ctcubemask.py index 01c426c..acd3166 100755 --- a/test/test_ctcubemask.py +++ b/test/test_ctcubemask.py @@ -65,14 +65,14 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctcubemask mask = ctools.ctcubemask() - mask["inobs"].filename(self.cntmap_name) - mask["regfile"].filename(self.regfile) - mask["outcube"].filename("filtered_cntmap.fits") - mask["ra"].real(83.63) - mask["dec"].real(22.01) - mask["rad"].real(2.0) - mask["emin"].real(0.1) - mask["emax"].real(100.0) + mask["inobs"] = self.cntmap_name + mask["regfile"] = self.regfile + mask["outcube"] = "filtered_cntmap.fits" + mask["ra"] = 83.63 + mask["dec"] = 22.01 + mask["rad"] = 2.0 + mask["emin"] = 0.1 + mask["emax"] = 100 # Run tool self.test_try("Run ctcubemask") diff --git a/test/test_ctexpcube.py b/test/test_ctexpcube.py index 6c376de..e971bbe 100755 --- a/test/test_ctexpcube.py +++ b/test/test_ctexpcube.py @@ -66,22 +66,22 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctexpcube expcube = ctools.ctexpcube() - expcube["inobs"].filename(self.events_name) - expcube["incube"].filename("NONE") - expcube["outcube"].filename("expcube.fits") - expcube["caldb"].string(self.caldb) - expcube["irf"].string(self.irf) - expcube["ebinalg"].string("LOG") - expcube["emin"].real(0.1) - expcube["emax"].real(100.0) - expcube["enumbins"].integer(20) - expcube["nxpix"].integer(200) - expcube["nypix"].integer(200) - expcube["binsz"].real(0.02) - expcube["coordsys"].string("CEL") - expcube["proj"].string("CAR") - expcube["xref"].real(83.63) - expcube["yref"].real(22.01) + expcube["inobs"] = self.events_name + expcube["incube"] = "NONE" + expcube["outcube"] = "expcube.fits" + expcube["caldb"] = self.caldb + expcube["irf"] = self.irf + expcube["ebinalg"] = "LOG" + expcube["emin"] = 0.1 + expcube["emax"] = 100 + expcube["enumbins"] = 20 + expcube["nxpix"] = 200 + expcube["nypix"] = 200 + expcube["binsz"] = 0.02 + expcube["coordsys"] = "CEL" + expcube["proj"] = "CAR" + expcube["xref"] = 83.63 + expcube["yref"] = 22.01 # Run tool self.test_try("Run ctexpcube") diff --git a/test/test_ctmodel.py b/test/test_ctmodel.py index 1fe30e9..d52e20f 100755 --- a/test/test_ctmodel.py +++ b/test/test_ctmodel.py @@ -66,30 +66,30 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctmodel from scratch model = ctools.ctmodel() - model["incube"].filename("NONE") - model["outcube"].filename("modmap.fits") - model["inmodel"].filename(self.model_name) - model["inobs"].filename("NONE") - model["expcube"].filename("NONE") - model["psfcube"].filename("NONE") - model["bkgcube"].filename("NONE") - model["caldb"].string(self.caldb) - model["irf"].string(self.irf) - model["rad"].real(5.0) - model["ra"].real(83.63) - model["dec"].real(22.01) - model["tmin"].real(0.0) - model["tmax"].real(1800.0) - model["emin"].real(0.1) - model["emax"].real(100.0) - model["enumbins"].integer(20) - model["nxpix"].integer(200) - model["nypix"].integer(200) - model["binsz"].real(0.02) - model["coordsys"].string("CEL") - model["proj"].string("CAR") - model["xref"].real(83.63) - model["yref"].real(22.01) + model["incube"] = "NONE" + model["outcube"] = "modmap.fits" + model["inmodel"] = self.model_name + model["inobs"] = "NONE" + model["expcube"] = "NONE" + model["psfcube"] = "NONE" + model["bkgcube"] = "NONE" + model["caldb"] = self.caldb + model["irf"] = self.irf + model["rad"] = 5 + model["ra"] = 83.63 + model["dec"] = 22.01 + model["tmin"] = 0 + model["tmax"] = 1800 + model["emin"] = 0.1 + model["emax"] = 100 + model["enumbins"] = 20 + model["nxpix"] = 200 + model["nypix"] = 200 + model["binsz"] = 0.02 + model["coordsys"] = "CEL" + model["proj"] = "CAR" + model["xref"] = 83.63 + model["yref"] = 22.01 # Run tool self.test_try("Run ctmodel") diff --git a/test/test_ctobssim.py b/test/test_ctobssim.py index 43c47de..3f06801 100755 --- a/test/test_ctobssim.py +++ b/test/test_ctobssim.py @@ -67,17 +67,17 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctobssim sim = ctools.ctobssim() - sim["inmodel"].filename(self.model_name) - sim["outevents"].filename("events.fits") - sim["caldb"].string(self.caldb) - sim["irf"].string(self.irf) - sim["ra"].real(83.63) - sim["dec"].real(22.01) - sim["rad"].real(10.0) - sim["tmin"].real(0.0) - sim["tmax"].real(1800.0) - sim["emin"].real(0.1) - sim["emax"].real(100.0) + sim["inmodel"] = self.model_name + sim["outevents"] = "events.fits" + sim["caldb"] = self.caldb + sim["irf"] = self.irf + sim["ra"] = 83.63 + sim["dec"] = 22.01 + sim["rad"] = 10.0 + sim["tmin"] = 0.0 + sim["tmax"] = 1800.0 + sim["emin"] = 0.1 + sim["emax"] = 100.0 # Run tool self.test_try("Run ctobssim") @@ -117,8 +117,8 @@ class Test(gammalib.GPythonTestSuite): # Set-up ctobssim sim = ctools.ctobssim(obs) - sim["outevents"].filename("sim_events.xml") - sim["inmodel"].filename(self.model_name) + sim["outevents"] = "sim_events.xml" + sim["inmodel"] = self.model_name # Run tool self.test_try("Run ctobssim") try: diff --git a/test/test_ctpsfcube.py b/test/test_ctpsfcube.py index 1cd3b89..5f08b72 100755 --- a/test/test_ctpsfcube.py +++ b/test/test_ctpsfcube.py @@ -66,24 +66,24 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctpsfcube psfcube = ctools.ctpsfcube() - psfcube["inobs"].filename(self.events_name) - psfcube["incube"].filename("NONE") - psfcube["outcube"].filename("psfcube.fits") - psfcube["caldb"].string(self.caldb) - psfcube["irf"].string(self.irf) - psfcube["ebinalg"].string("LOG") - psfcube["emin"].real(0.1) - psfcube["emax"].real(100.0) - psfcube["enumbins"].integer(20) - psfcube["nxpix"].integer(10) - psfcube["nypix"].integer(10) - psfcube["binsz"].real(0.4) - psfcube["coordsys"].string("CEL") - psfcube["proj"].string("CAR") - psfcube["xref"].real(83.63) - psfcube["yref"].real(22.01) - psfcube["amax"].real(0.3) - psfcube["anumbins"].integer(10) + psfcube["inobs"] = self.events_name + psfcube["incube"] = "NONE" + psfcube["outcube"] = "psfcube.fits" + psfcube["caldb"] = self.caldb + psfcube["irf"] = self.irf + psfcube["ebinalg"] = "LOG" + psfcube["emin"] = 0.1 + psfcube["emax"] = 100 + psfcube["enumbins"] = 20 + psfcube["nxpix"] = 10 + psfcube["nypix"] = 10 + psfcube["binsz"] = 0.4 + psfcube["coordsys"] = "CEL" + psfcube["proj"] = "CAR" + psfcube["xref"] = 83.63 + psfcube["yref"] = 22.01 + psfcube["amax"] = 0.3 + psfcube["anumbins"] = 10 # Run tool self.test_try("Run ctpsfcube") diff --git a/test/test_ctselect.py b/test/test_ctselect.py index 8f24a85..962948a 100755 --- a/test/test_ctselect.py +++ b/test/test_ctselect.py @@ -64,15 +64,15 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctselect select = ctools.ctselect() - select["inobs"].filename(self.events_name) - select["outobs"].filename("selected_events.fits") - select["ra"].real(83.63) - select["dec"].real(22.01) - select["rad"].real(3.0) - select["tmin"].real(0.0) - select["tmax"].real(1800.0) - select["emin"].real(0.1) - select["emax"].real(100.0) + select["inobs"] = self.events_name + select["outobs"] = "selected_events.fits" + select["ra"] = 83.63 + select["dec"] = 22.01 + select["rad"] = 3 + select["tmin"] = 0 + select["tmax"] = 1800 + select["emin"] = 0.1 + select["emax"] = 100 # Run tool self.test_try("Run ctselect") diff --git a/test/test_ctskymap.py b/test/test_ctskymap.py index 5226ed8..d368dd4 100755 --- a/test/test_ctskymap.py +++ b/test/test_ctskymap.py @@ -64,17 +64,17 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up ctskymap skymap = ctools.ctskymap() - skymap["inobs"].filename(self.events_name) - skymap["outmap"].filename("skymap.fits") - skymap["emin"].real(0.1) - skymap["emax"].real(100.0) - skymap["nxpix"].integer(200) - skymap["nypix"].integer(200) - skymap["binsz"].real(0.02) - skymap["coordsys"].string("CEL") - skymap["proj"].string("CAR") - skymap["xref"].real(83.63) - skymap["yref"].real(22.01) + skymap["inobs"] = self.events_name + skymap["outmap"] = "skymap.fits" + skymap["emin"] = 0.1 + skymap["emax"] = 100 + skymap["nxpix"] = 200 + skymap["nypix"] = 200 + skymap["binsz"] = 0.02 + skymap["coordsys"] = "CEL" + skymap["proj"] = "CAR" + skymap["xref"] = 83.63 + skymap["yref"] = 22.01 # Run tool self.test_try("Run ctskymap") diff --git a/test/test_cttsmap.py b/test/test_cttsmap.py index 1fcba9e..27ffa68 100755 --- a/test/test_cttsmap.py +++ b/test/test_cttsmap.py @@ -67,19 +67,19 @@ class Test(gammalib.GPythonTestSuite): """ # Set-up cttsmap tsmap = ctools.cttsmap() - tsmap["inobs"].filename(self.events_name) - tsmap["inmodel"].filename(self.model_name) - tsmap["srcname"].string("Crab") - tsmap["caldb"].string(self.caldb) - tsmap["irf"].string(self.irf) - tsmap["outmap"].filename("tsmap.fits") - tsmap["nxpix"].integer(5) - tsmap["nypix"].integer(5) - tsmap["binsz"].real(0.02) - tsmap["coordsys"].string("CEL") - tsmap["proj"].string("CAR") - tsmap["xref"].real(83.63) - tsmap["yref"].real(22.01) + tsmap["inobs"] = self.events_name + tsmap["inmodel"] = self.model_name + tsmap["srcname"] = "Crab" + tsmap["caldb"] = self.caldb + tsmap["irf"] = self.irf + tsmap["outmap"] = "tsmap.fits" + tsmap["nxpix"] = 5 + tsmap["nypix"] = 5 + tsmap["binsz"] = 0.02 + tsmap["coordsys"] = "CEL" + tsmap["proj"] = "CAR" + tsmap["xref"] = 83.63 + tsmap["yref"] = 22.01 # Run tool self.test_try("Run cttsmap") diff --git a/test/test_pipelines.py b/test/test_pipelines.py index f61692e..ce979b6 100755 --- a/test/test_pipelines.py +++ b/test/test_pipelines.py @@ -78,17 +78,17 @@ class Test(gammalib.GPythonTestSuite): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["outevents"].filename(events_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["outevents"] = events_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax self.test_try("Execute ctobssim") try: sim.execute() @@ -98,15 +98,15 @@ class Test(gammalib.GPythonTestSuite): # Select events select = ctools.ctselect() - select["inobs"].filename(events_name) - select["outobs"].filename(selected_events_name) - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad_select) - select["tmin"].real(tstart) - select["tmax"].real(tstop) - select["emin"].real(emin) - select["emax"].real(emax) + select["inobs"] = events_name + select["outobs"] = selected_events_name + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad_select + select["tmin"] = tstart + select["tmax"] = tstop + select["emin"] = emin + select["emax"] = emax self.test_try("Execute ctselect") try: select.execute() @@ -116,11 +116,11 @@ class Test(gammalib.GPythonTestSuite): # Perform maximum likelihood fitting like = ctools.ctlike() - like["inobs"].filename(selected_events_name) - like["inmodel"].filename(model_name) - like["outmodel"].filename(result_name) - like["caldb"].string(caldb) - like["irf"].string(irf) + like["inobs"] = selected_events_name + like["inmodel"] = model_name + like["outmodel"] = result_name + like["caldb"] = caldb + like["irf"] = irf self.test_try("Execute ctlike") try: like.execute() @@ -149,16 +149,16 @@ class Test(gammalib.GPythonTestSuite): # Simulate events sim = ctools.ctobssim() - sim["inmodel"].filename(model_name) - sim["caldb"].string(caldb) - sim["irf"].string(irf) - sim["ra"].real(ra) - sim["dec"].real(dec) - sim["rad"].real(rad_sim) - sim["tmin"].real(tstart) - sim["tmax"].real(tstop) - sim["emin"].real(emin) - sim["emax"].real(emax) + sim["inmodel"] = model_name + sim["caldb"] = caldb + sim["irf"] = irf + sim["ra"] = ra + sim["dec"] = dec + sim["rad"] = rad_sim + sim["tmin"] = tstart + sim["tmax"] = tstop + sim["emin"] = emin + sim["emax"] = emax self.test_try("Run ctobssim") try: sim.run() @@ -168,13 +168,13 @@ class Test(gammalib.GPythonTestSuite): # Select events select = ctools.ctselect(sim.obs()) - select["ra"].real(ra) - select["dec"].real(dec) - select["rad"].real(rad_select) - select["tmin"].real(tstart) - select["tmax"].real(tstop) - select["emin"].real(emin) - select["emax"].real(emax) + select["ra"] = ra + select["dec"] = dec + select["rad"] = rad_select + select["tmin"] = tstart + select["tmax"] = tstop + select["emin"] = emin + select["emax"] = emax self.test_try("Run ctselect") try: select.run()