Esempio n. 1
0
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License along
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#

from sherpa.plot import plotter
from importlib import import_module
from sherpa.utils.logging import config_logger

logger = config_logger(__name__)

name = plotter.name

backend_map = {'pylab': 'plot_matplotlib', 'dummy': 'plot_dummy'}


def _update_globals(module):
    globals().update(
        (k, v) for k, v in module.__dict__.items() if k not in globals())


try:
    backend_module = import_module("." + backend_map[name], __name__)
except ImportError:
    backend_module = import_module(".plot_dummy", __name__)
Esempio n. 2
0
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License along
#  with this program; if not, write to the Free Software Foundation, Inc.,
#  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
#
from sherpa.utils import public
from sherpa.utils.logging import config_logger
import sherpa
import re

from . import plot_backend as backend

logger = config_logger(__name__)

ID_STR = '__ID'

try:
    import stk
except:
    logger.warning("could not import stk library. CIAO stack files and syntax will be disabled")


@public
def model_wrapper(func):
    def wrapfunc(self, model):
        """Run a model-setting function for each of the datasets."""
        datasets = self.filter_datasets()
        try: