def __init__(self): self.log = getModuleLogger(self) self._boundary = None self.protected_entities = {} self._load_protected_entities()
def __init__(self): self.log = getModuleLogger(self) self._boundary = None self.protected_entities = {} self._load_protected_entities()
def __init__(self, region): self.log = getModuleLogger(self) self.region = region self._reset_entities() self.log.debug("Loading protected entities") self._load_entities() self._refresh_cached_data()
def __init__(self, region): self.log = getModuleLogger(self) self.region = region self._reset_entities() self.log.debug("Loading protected entities") self._load_entities() self._refresh_cached_data()
def __init__(self, region, container, latitude, longitude): self.log = getModuleLogger(self) self._region = region self.container = container if not isinstance(container, ProtectedEntities): # TODO: raise an exception? self.log.error("Container is not a ProtectedEntities instance: " "got %s instead." % container.__class__.__name__) self._latitude = latitude self._longitude = longitude self._create_bounding_box()
def __init__(self, region, container, latitude, longitude): self.log = getModuleLogger(self) self._region = region self.container = container if not isinstance(container, ProtectedEntities): # TODO: raise an exception? self.log.error("Container is not a ProtectedEntities instance: " "got %s instead." % container.__class__.__name__) self._latitude = latitude self._longitude = longitude self._create_bounding_box()
def from_pickle(cls, filename): """ Loads the DataMap2D from a pickle with the specified ``filename``. See also: :meth:`to_pickle`. :param filename: destination filename :type filename: str :return: :rtype: :class:`DataMap2D` """ with open(filename, "r") as f: obj = pickle.load(f) if not hasattr(obj, 'log'): obj.log = getModuleLogger(obj) return obj
def from_pickle(cls, filename): """ Loads the DataMap2D from a pickle with the specified ``filename``. See also: :meth:`to_pickle`. :param filename: destination filename :type filename: str :return: :rtype: :class:`DataMap2D` """ with open(filename, "r") as f: obj = pickle.load(f) if not hasattr(obj, 'log'): obj.log = getModuleLogger(obj) return obj
def fetch_data(self): """Fetch the data described by this Specification. If none exists, the data will be made and then loaded. Components: :meth:`load_data`, :meth:`make_data` """ if not hasattr(self, "log"): self.log = getModuleLogger(self) if self.data_exists(): self.log.debug("Fetching data (LOAD): %s" % self.to_string()) data = self.load_data() else: self.log.debug("Fetching data (MAKE): %s" % self.to_string()) data = self.make_data() if data is None: raise ValueError("No data loaded") return data
def fetch_data(self): """Fetch the data described by this Specification. If none exists, the data will be made and then loaded. Components: :meth:`load_data`, :meth:`make_data` """ if not hasattr(self, "log"): self.log = getModuleLogger(self) if self.data_exists(): self.log.debug("Fetching data (LOAD): %s" % self.to_string()) data = self.load_data() else: self.log.debug("Fetching data (MAKE): %s" % self.to_string()) data = self.make_data() if data is None: raise ValueError("No data loaded") return data
def __init__(self, datamap2d, transformation="linear", is_in_region_map=None): """ Plots an image of the given :class:`data_map.DataMap2D`. :param datamap2d: :type datamap2d: :class:`data_map.DataMap2D` :param transformation: the transformation to be applied to the data \ before plotting ("linear", "log", or "atan") :type transformation: string :return: None """ self.log = getModuleLogger(self) self._transformation = self.get_transformation(transformation) self._transformation_inverse = self.get_transformation_inverse( transformation) self.log.debug("Using transformation %s" % str(self._transformation)) self._datamap2d = datamap2d self._data = self._transformation(datamap2d.mutable_matrix) self.make_region_background_white(is_in_region_map) self._fig, self._ax = plt.subplots() self._canvas = FigureCanvas(self._fig) self._image = self._ax.imshow(self._data, origin="lower") self._image.set_interpolation('nearest') self._remove_axes() self._configure_colors() self._fig.set_facecolor('white') self._boundary_plots = [] self.set_boundary_color() self.set_boundary_linewidth() self._colorbar = None
def __init__(self): self.log = getModuleLogger(self) self._population_nuggets_by_identifier = {} self._load_populations() self._load_geography() self._prune_invalid_population_nuggets()
import custom_logging print("*** You should see a warning:") custom_logging.base_logger.warn("This is a sample warning") new_logger = custom_logging.getModuleLogger("testModule") print("*** You should see some information from the module testModule:") new_logger.info("This is some information")
def __init__(self): self.log = getModuleLogger(self) self._geometries = []
def __init__(self): self.log = getModuleLogger(self) self._geometries = []
def __init__(self): self.log = getModuleLogger(self)
def __init__(self): self.log = getModuleLogger(self)
def __init__(self): self.log = getModuleLogger(self) self._population_nuggets_by_identifier = {} self._load_populations() self._load_geography() self._prune_invalid_population_nuggets()
def __init__(self): self.log = getModuleLogger(self) self.set_propagation_model()