예제 #1
0
 def __init__(self):
     """ """
     super().__init__()
     self.bpoints = None
     self.md = nested_dict()
     self.log = get_logger("Benchmark")
     self.set_cluster_column()
예제 #2
0
    def __init__(self):
        """Initializes the :class:`clusterking.scan.Scanner` class."""
        super().__init__()
        # todo: move
        self.log = get_logger("Scanner")

        #: Points in wilson space
        #:  Use self.spoints to access this
        self._spoints = None  # type: Optional[np.ndarray]

        #: Instance of SpointCalculator to perform the claculations of
        #:  the wilson space points.
        self._spoint_calculator = SpointCalculator()

        # todo: move
        self.md = nested_dict()
        self.md["git"] = version_info(self.log)
        self.md["time"] = time.strftime("%a %d %b %Y %H:%M", time.gmtime())

        # todo: shouldn't that be in metadata?
        #: Names of the parameters
        self._coeffs = []  # type: List[str]

        self._no_workers = None  # type: Optional[int]

        self._progress_bar = True
        self._tqdm_kwargs = {}

        self.set_imaginary_prefix("im_")
예제 #3
0
    def __init__(self):
        """
        Args:
            data: :py:class:`~clusterking.data.Data` object
        """
        super().__init__()
        self.log = get_logger("Scanner")

        self.clusters = None
        # self.bpoints = None

        #: Metadata
        self.md = nested_dict()

        self.md["git"] = version_info(self.log)
        self.md["time"] = time.strftime("%a %d %b %Y %H:%M", time.gmtime())
예제 #4
0
    def __init__(
        self,
        path: Optional[Union[str, PurePath]] = None,
        log: Optional[Union[str, logging.Logger]] = None,
    ):
        """
        Initialize a DFMD object.

        Args:
            path: Optional: load from this file (specified as string or
                :class:`pathlib.PurePath`)
            log: Optional: instance of :py:class:`logging.Logger` or name of
                logger to be created
        """
        # These are the three attributes of this class
        #: This will hold all the configuration that we will write out
        self.md = None
        #: :py:class:`pandas.DataFrame` to hold all of the results
        self.df = None  # type: Optional[pd.DataFrame]
        #: Instance of :py:class:`logging.Logger`
        self.log = None

        # todo: remember path?
        if not path:
            # Initialize blank
            self.md = nested_dict()
            self.df = pd.DataFrame()
            self.log = None
        else:
            self._load(path)

        # Overwrite log if user wants that.
        if isinstance(log, logging.Logger):
            self.log = log
        elif isinstance(log, str):
            self.log = get_logger(log)
        elif log is None:
            if not self.log:
                self.log = get_logger("DFMD")
        else:
            raise ValueError(
                "Unsupported type '{}' for 'log' argument.".format(type(log)))
예제 #5
0
 def test_nested_dict(self):
     nd = metadata.nested_dict()
     nd[1][2][3] = None
     self.assertEqual(nd, {1: {2: {3: None}}})
예제 #6
0
 def __init__(self):
     super().__init__()
     self._kmeans_kwargs = {}
     self.md = nested_dict()