diff --git a/ChangeLog b/ChangeLog index 3fca953..c1e231f 100755 --- a/ChangeLog +++ b/ChangeLog @@ -1,9 +1,10 @@ -2021-04-29 +2021-04-30 * Version 2.0.0 released ======================== Add ASCL shields to "About" page (#3630) + Use file function constructor in csspec (#3626) Add BINS method to csspec (#3606) Add hidden "fix_spat" parameter to cttsmap (#3562) Add optimizer setter to ctlikelihood base class diff --git a/NEWS b/NEWS index a9b46c6..cc92779 100755 --- a/NEWS +++ b/NEWS @@ -1,6 +1,6 @@ New Features and Important Changes in ctools 2.0.0 -29 April 2021 +30 April 2021 Introduction @@ -287,6 +287,9 @@ None csspec - Generates Spectral Energy Distribution ----------------------------------------------- +The GModelSpectralFunc spectral model constructor is now used to convert any +spectral model into a file function before spectral model fitting (#3626). + Added BINS method that replaces the spectral model by a bin function that is implemented by the GammaLib class GModelSpectralBins. Using a bin function assures that spectral points are statistically independent (#3606). diff --git a/README.md b/README.md index cfa7aa6..89f17ce 100755 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ ctools information ================== -* Version: 2.0.0.dev (29 April 2021) +* Version: 2.0.0.dev (30 April 2021) * GammaLib dependency: 2.0.0.dev [![Build Status](https://cta-jenkins.irap.omp.eu/buildStatus/icon?job=ctools-integrate-os)](https://cta-jenkins.irap.omp.eu/job/ctools-integrate-os/) @@ -127,8 +127,8 @@ the following: $ conda install ctools -Unix Installation -================= +Linux Installation +================== To build and install ctools, simply type the following: $ ./configure @@ -161,14 +161,14 @@ ctools was correctly built. Make sure that all tests were successful. Macintosh OS X Installation ============================ -ctools is known to work on various flavors of OS X. To cope with +ctools is known to work on various flavors of Mac OS. To cope with different system versions and architectures, there are two Mac specific configure options: $ ./configure --enable-universalsdk[=PATH] creates a universal build of ctools. The optional argument specifies -which OSX SDK should be used to perform the build. This defaults to +which MacOS SDK should be used to perform the build. This defaults to "/Developer/SDKs/MacOSX.10.4u.sdk". Specify "/" when building on a 10.5 system or higher, especially when building 64-bit code. @@ -221,7 +221,8 @@ shared library (see "Known problems" below). Windows Installation ==================== -There have been no efforts so far to compile ctools under Windows. +On Windows ctools needs to be installed into a virtual machine running +a Linux distribution. Testing diff --git a/cscripts/csspec.py b/cscripts/csspec.py index 6b6c6e5..8f70550 100755 --- a/cscripts/csspec.py +++ b/cscripts/csspec.py @@ -368,23 +368,17 @@ class csspec(ctools.csobservation): ' Fixing "'+par.name()+'"') par.fix() - # Kludge: convert spectral model into a file function - nbins = self._ebounds.size() - num = nbins * 20 - energies = gammalib.GEnergies(num, self._ebounds.emin(0), - self._ebounds.emax(nbins-1)) - _, filename = tempfile.mkstemp() - f = open(filename, 'w') - spectral = model.spectral() - for energy in energies: - value = spectral.eval(energy) - f.write('%20.6f %20e\n' % (energy.MeV(), value)) - f.close() - spectral = gammalib.GModelSpectralFunc(filename, 1.0) + # Convert spectral model into a file function. The file + # function is logarithmically sampled in energy, with with + # 20 times the number of spectral bins + nbins = self._ebounds.size() + num = nbins * 50 + energies = gammalib.GEnergies(num, self._ebounds.emin(0), + self._ebounds.emax(nbins-1)) + spectral = gammalib.GModelSpectralFunc(model.spectral(), energies) model.spectral(spectral) self._log_string(gammalib.EXPLICIT, ' Converting spectral model ' - 'into file function via temporary file "%s"' % - filename) + 'into file function') # Free the normalisation parameter which is assumed to be # the first spectral parameter diff --git a/doc/source/admin/release_history/2.0.rst b/doc/source/admin/release_history/2.0.rst index c45b874..272f7d3 100644 --- a/doc/source/admin/release_history/2.0.rst +++ b/doc/source/admin/release_history/2.0.rst @@ -1,6 +1,6 @@ .. _2.0: -ctools 2.0 release (29 April 2021) +ctools 2.0 release (30 April 2021) ================================== Overview @@ -26,6 +26,8 @@ Improvements * [`3630 `_] - Add ASCL shields to **About** page +* [`3626 `_] - + Use file function constructor in csspec * [`3606 `_] - Add ``BINS`` method to :ref:`csspec` * [`3562 `_] -