How to use the maggma.builders.Builder function in maggma

To help you get started, we’ve selected a few maggma examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github materialsintelligence / propnet / propnet / dbtools / correlation_with_mp.py View on Github external
from maggma.builders import Builder
import numpy as np

from propnet.core.graph import Graph
from propnet import ureg
# noinspection PyUnresolvedReferences
import propnet.models
from propnet.core.registry import Registry

warnings.warn("The correlation_with_mp module is deprecated. Use the correlation module instead.",
              DeprecationWarning)
logger = logging.getLogger(__name__)


class CorrelationBuilder(Builder):
    """
    A class to calculate the correlation between properties derived by or used in propnet
    using a suite of regression tools. Uses the Builder architecture for optional parallel
    processing of data.

    Note: serialization of builder does not work with custom correlation functions, although
    interactive use does support them.

    """
    # TODO: Add these symbols to propnet so we don't have to bring them in explicitly?
    MP_QUERY_PROPS = ["piezo.eij_max", "elasticity.universal_anisotropy",
                      "diel.poly_electronic", "total_magnetization", "efermi",
                      "magnetism.total_magnetization_normalized_vol"]
    PROPNET_PROPS = [v.name for v in Registry("symbols").values()
                     if (v.category == 'property' and v.shape == 1)]
github materialsintelligence / propnet / propnet / core / mic_builder.py View on Github external
from maggma.builders import Builder
from itertools import combinations_with_replacement
import numpy as np
import json
from minepy import MINE
from collections import defaultdict
from propnet.symbols import DEFAULT_SYMBOLS
from propnet import ureg

import random

class MicBuilder(Builder):

    def __init__(self, propnet_store, mp_store, correlation_store, out_file, **kwargs):

        self.propnet_store = propnet_store
        self.mp_store = mp_store
        self.correlation_store = correlation_store
        self.out_file = out_file

        super(MicBuilder, self).__init__(sources=[propnet_store, mp_store],
                                         targets=[correlation_store],
                                         **kwargs)

    def get_items(self):
        data = defaultdict(dict)
        propnet_props = [v.name for v in DEFAULT_SYMBOLS.values()
                         if (v.category == 'property' and v.shape == 1)]
github materialsintelligence / propnet / propnet / dbtools / aflow_ingester.py View on Github external
from propnet.dbtools.aflow_ingester_defaults import default_query_configs, default_files_to_ingest
from aflow.keywords import load as kw_load, reset as kw_reset
from aflow import K as AFLOW_KWS
from maggma.builders import Builder
from maggma.utils import grouper
from monty.json import jsanitize
from pymongo import UpdateOne
import logging
import time
import datetime
from urllib.error import HTTPError

logger = logging.getLogger(__name__)


class AflowIngester(Builder):
    """
    Builds MongoDB collections from AFLOW data using the AFLOW and AFLUX web APIs.
    """
    _available_kws = dict()
    """Contains supported keywords in the AFLUX schema
    """
    kw_load(_available_kws)
    
    def __init__(self, data_target, auid_target=None,
                 keywords=None, query_configs=None,
                 files_to_ingest=None, filter_null_properties=False,
                 **kwargs):
        """
        Initialize the database builder.

        Args:
github materialsintelligence / propnet / propnet / builders / correlation.py View on Github external
from maggma.builders import Builder
from itertools import combinations_with_replacement
import numpy as np
import json
from collections import defaultdict
from propnet.symbols import DEFAULT_SYMBOLS
from propnet.core.graph import Graph
from propnet import ureg
import logging
import re

logger = logging.getLogger(__name__)


class CorrelationBuilder(Builder):
    """
    A class to calculate the correlation between properties derived by or used in propnet
    using a suite of regression tools. Uses the Builder architecture for optional parallel
    processing of data.

    Note: serialization of builder does not work with custom correlation functions, although
    interactive use does support them.

    """
    def __init__(self, propnet_store, mp_store,
                 correlation_store, out_file=None,
                 funcs='linlsq', **kwargs):
        """
        Constructor for the correlation builder.

        Args:
github materialsintelligence / propnet / propnet / dbtools / correlation.py View on Github external
import numpy as np
import json
from collections import defaultdict
from propnet.core.graph import Graph
from propnet import ureg
import logging
import re

# noinspection PyUnresolvedReferences
import propnet.models
from propnet.core.registry import Registry

logger = logging.getLogger(__name__)


class CorrelationBuilder(Builder):
    """
    A class to calculate the correlation between properties derived by or used in propnet
    using a suite of regression tools. Uses the Builder architecture for optional parallel
    processing of data.

    Note: serialization of builder does not work with custom correlation functions, although
    interactive use does support them.

    """
    PROPNET_PROPS = [v.name for v in Registry("symbols").values()
                     if (v.category == 'property' and v.shape == 1)]
    
    def __init__(self, propnet_store,
                 correlation_store, out_file=None,
                 funcs='linlsq', props=None,
                 sample_size=None, from_quantity_db=True,
github materialsintelligence / propnet / propnet / dbtools / separation.py View on Github external
from maggma.builders import Builder
from maggma.utils import grouper
from pymongo import InsertOne
import pydash
from itertools import chain
from propnet import ureg
from propnet.core.registry import Registry
# noinspection PyUnresolvedReferences
import propnet.symbols


class SeparationBuilder(Builder):
    """
    Converts old-style propnet database into separate quantity-centered
    and materials-centered databases.
    """

    def __init__(self, propnet_store, quantity_store, material_store=None,
                 criteria=None, props=None, chunk_size=100, insert_only=False):
        """

        Args:
            propnet_store (Mongolike Store): old-style propnet store
            quantity_store (Mongolike Store): store for quantities
            material_store (Mongolike Store): store for materials
            criteria (dict): JSON-style criteria for MongoDB find() query
            **kwargs: arguments to Builder parent class
        """

maggma

Framework to develop datapipelines from files on disk to full dissemenation API

BSD-3-Clause
Latest version published 4 days ago

Package Health Score

81 / 100
Full package analysis