Пример #1
0
    def __init__(self):
        """The constructor
        
        Initializes the log

        Args:
        self: The object pointer
        """
        self.log = logger().get_log('configuration_manager')
Пример #2
0
 def __init__(self, fname=None, mode='w', 
              compression=None, compression_opts=0, **kwargs):
     super().__init__()
     
     self.log = logger().get_log("h5")
     if not fname: fname = "d.h5"
     if mode not in ['a', 'w', 'r+']:
         self.log.error("Invalid mode")
         return
     if compression in COMPRESSION_TYPES:
         self._compression = compression
     self._compression_opts = compression_opts
     kwargs.update(mode=mode)
     self._f = h5py.File(fname, **kwargs)
Пример #3
0
    def __init__(self,
                 filename="d.h5",
                 mode='w',
                 compression=None,
                 compression_opts=0,
                 **kwargs):
        super().__init__()
        self._schemas = {}
        self._tables = {}

        if not filename: filename = "d.h5"

        self.log = logger().get_log("table_writer")
        if mode not in ['a', 'w', 'r+']:
            return
        kwargs.update(mode=mode)
        self.open(filename, compression, compression_opts, **kwargs)
Пример #4
0
        def __init__(self, config_file=None):
            """Constructor
            Initializes the log and sets some the initial values of the 
            warehouse
            
            Args:
            self: The object pointer
            """
            self.log = logger().get_log("warehouse")

            c = configuration_manager()
            if not config_file: config_file = "conf/config.xml"
            if c.load(config_file):
                cfg = c.get("global")
                if cfg:
                    if 'name' in cfg:
                        self.NAME = cfg['name']
                    if 'version' in cfg:
                        self.VERSION = cfg['version']
Пример #5
0
 def __init__(self, fname=None, mode='r'):
     
     self.log = logger().get_log("h5")
     self._f = h5py.File(fname, mode)
Пример #6
0
 def __init__(self, filename, **kwargs):
     self.log = logger().get_log("table_reader")
     super().__init__()
     self._tables = {}
     kwargs.update(mode='r')
     self.open(filename, **kwargs)
Пример #7
0
 def __init__(self, fname=None):
     if fname:
         self._f = fits.open(fname)
     self.log = logger().get_log("from_fits")
     self._def = warehouse().get().fits_def
Пример #8
0
import numpy as np

from astropy.io import fits

from hpy.utils.fits import from_fits
from hpy.utils.warehouse import warehouse
from hpy.utils.data_container import data_container, Field
from hpy.core.h5table import h5table_writer, h5table_reader
from hpy.core.h5 import h5_writer, h5_reader

from hpy.log import logger
from hpy.log import logger_configuration

LOG_FILE_STR = "conf/log_config.xml"
DEFAULT_GLOBAL_CONFIG = "conf/config.xml"
log = logger().get_log('hpy')

HPY_MODE_MAP = {"bfits2hdf5": 0, "h5py": 1, "pytables": 2}

HDF5_FORMAT = {"bygroups": 0, "bytables": 1}

FITS_MODE_MAP = {"astropy": 0, "protozfits": 1}

DEFAULT_MODE = "h5py"
DEFAULT_FITS_MODE = "protozfits"
DEFAULT_HDF5_FORMAT = "bytables"


def init(file_configuration=None,
         log_file=LOG_FILE_STR,
         global_configuration=DEFAULT_GLOBAL_CONFIG):