def downloadData(idList, downloadPath):

    currentDir = os.getcwd()
    os.chdir(downloadPath)
    print("downloading data to the download dir")
    print("    --> " + downloadPath)

    # this controls verbosity of download
    lw.initialize_logger('download', verbose=1)
    # Downloads this to the download (local) directory
    for idNumb in idList:
        download_chandra_obsids([idNumb])
        # if needed, unzip the files
        print("unzipping")
        os.system("gunzip -r " + downloadPath + "/" + str(idNumb))

    # change back to the original directory
    os.chdir(currentDir)
# where a routine or symbol is defined
#


from ciao_contrib.logger_wrapper import initialize_logger, make_verbose_level, set_verbosity, handle_ciao_errors
from ciao_contrib.param_wrapper import open_param_file
from ciao_contrib.runtool import add_tool_history
from ciao_contrib._tools.fileio import outfile_clobber_checks
import pycrates
from pychips import (add_curve, print_window, set_plot_xlabel, set_plot_ylabel, clear_plot,
                     add_window, set_plot_title, limits, Y_AXIS)
from sherpa import ui
import paramio as pio

# Set up the logging/verbose code
initialize_logger(TOOLNAME)

# Use v<n> to display messages at the given verbose level.
# You can pick other names than v0,v1, ... v5 if desired.
#
v1 = make_verbose_level(TOOLNAME, 1)
v2 = make_verbose_level(TOOLNAME, 2)
v5 = make_verbose_level(TOOLNAME, 5)

LOGLEVELS = {5: logging.DEBUG,
             4: logging.INFO,
             3: logging.WARNING,
             2: logging.ERROR,
             1: logging.CRITICAL}

Exemplo n.º 3
0
# in general it is better to either be explicit or load
# into a separate namespace, so that you can find out
# where a routine or symbol is defined
#

from ciao_contrib.logger_wrapper import initialize_logger, make_verbose_level, set_verbosity, handle_ciao_errors
from ciao_contrib.param_wrapper import open_param_file
from ciao_contrib._tools.fileio import outfile_clobber_checks
import pycrates
from pychips import (add_curve, print_window, set_plot_xlabel, set_plot_ylabel,
                     clear_plot, add_window, set_plot_title, limits, Y_AXIS)
from sherpa import ui
import paramio as pio

# Set up the logging/verbose code
initialize_logger(TOOLNAME)

# Use v<n> to display messages at the given verbose level.
# You can pick other names than v0,v1, ... v5 if desired.
#
v1 = make_verbose_level(TOOLNAME, 1)
v2 = make_verbose_level(TOOLNAME, 2)
v5 = make_verbose_level(TOOLNAME, 5)

LOGLEVELS = {
    5: logging.DEBUG,
    4: logging.INFO,
    3: logging.WARNING,
    2: logging.ERROR,
    1: logging.CRITICAL
}
Exemplo n.º 4
0
import pypeline_io as io
import os
import config
import subprocess
import numpy as np
import acb
import cluster
import data_operations as do

try:
    from ciao_contrib.cda.data import download_chandra_obsids
    import ciao_contrib.logger_wrapper as lw

    lw.initialize_logger("download", verbose=1)
    from ciao_contrib import runtool as rt
except ImportError:
    print("Failed to import CIAO python scripts. ")
    raise


def download_data(cluster):
    # refactor to make use of the observation class

    io.set_working_directory(cluster.directory)
    print("Downloading observation id(s) {}".format(cluster.observation_ids))

    success = []
    if not isinstance(cluster.observation_ids, list):
        cluster.observation_ids = [cluster.observation_ids]
    for observation in cluster.observation_ids:
        print("Downloading data from observation {}".format(observation))
Exemplo n.º 5
0
# 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.
#

# KJG: 2016-09-13 check, no changes needed for P3
"""
Routines to support check_fov tool

"""

__all__ = ()

import ciao_contrib.logger_wrapper as lw

lgr = lw.initialize_logger("ciao_contrib.region.check_fov")
verb0 = lgr.verbose0
verb1 = lgr.verbose1

from region import *


class FOVFiles():
    """
    Manage a stack of Field of View (FOV) files
    """
    def __init__(self, infile):
        """
        Load a stack of Field of View files.  Celestial coordinates
        are used.