repo_name
stringlengths
6
97
path
stringlengths
3
341
text
stringlengths
8
1.02M
spallas/canalflow
canalflow/preprocessing.py
import tensorflow as tf import os def input_from_dataset(): src_dir = "../data/train" file_names = [src_dir + "/" + name.strip() for name in os.listdir(src_dir)] # print(file_names[:6]) dataset = tf.data.TFRecordDataset(file_names) num_epochs = 10 def parser(record): keys_to_featur...
spallas/canalflow
canalflow/tests.py
<reponame>spallas/canalflow<filename>canalflow/tests.py import tensorflow as tf from canalflow.model import cnn_model_fn from canalflow.preprocessing import input_from_dataset, load_test_set def installation_test(): hello = tf.constant('Hello, TensorFlow!') sess = tf.Session() print(str(sess.run(hello))...
spallas/canalflow
canalflow/model.py
<gh_stars>0 import tensorflow as tf def cnn_model_fn(features, labels, mode, params): input_layer = features # Convolutional Layer 1 + Max Pooling layer # Input Shape: [batch_size, 800, 240, 3] # Output Shape: [batch_size, 400, 120, 32] conv1 = tf.layers.conv2d( inputs=input_layer, ...
rage-proof/electrum
electrum/lnpeer.py
#!/usr/bin/env python3 # # Copyright (C) 2018 The Electrum developers # Distributed under the MIT software license, see the accompanying # file LICENCE or http://www.opensource.org/licenses/mit-license.php import zlib from collections import OrderedDict, defaultdict import asyncio import os import time from typing imp...
rage-proof/electrum
electrum/gui/kivy/uix/dialogs/lightning_channels.py
<gh_stars>1-10 import asyncio from typing import TYPE_CHECKING, Optional, Union from kivy.lang import Builder from kivy.factory import Factory from kivy.uix.popup import Popup from .fee_dialog import FeeDialog from electrum.util import bh2u from electrum.logging import Logger from electrum.lnutil import LOCAL, REMOTE...
rooneyshuman/Internet-Cloud-Systems
hw4/bgmodel/model_datastore.py
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
rooneyshuman/Internet-Cloud-Systems
final/index.py
<gh_stars>0 from flask import render_template from flask.views import MethodView from bgmodel.settings_datastore import Settings import sys class Index(MethodView): def get(self): """ GET method for the main landing page :return: renders the index.html page on return """ re...
rooneyshuman/Internet-Cloud-Systems
hw3/gbmodel/Model.py
<filename>hw3/gbmodel/Model.py """ Abstract data model class that serves as the base class for specific model instantiations """ class Model(): def select(self): """ Gets all entries from the database :return: Tuple containing all rows of database """ pass def insert(sel...
rooneyshuman/Internet-Cloud-Systems
hw3/app.py
""" A Flask application for viewing and submitting bubble tea store locations """ import flask from flask.views import MethodView from index import Index from form import Form from shops import Shops app = flask.Flask(__name__) # our Flask app app.add_url_rule('/', view_func=Index.as_view('inde...
rooneyshuman/Internet-Cloud-Systems
final/bgmodel/Settings.py
""" Abstract data model class that serves as the base class for specific model instantiations """ class Settings(): def select(self): """ Gets all entries from the database :return: Tuple containing all rows of database """ pass
rooneyshuman/Internet-Cloud-Systems
hw2/reviews.py
<gh_stars>0 from __future__ import print_function # In python 2.7 from flask import redirect, request, url_for, render_template from flask.views import MethodView import gbmodel import sys import requests class Reviews(MethodView): def get(self, shop_name): """ GET method for the shops page ...
rooneyshuman/Internet-Cloud-Systems
hw3/gbmodel/model_sqlite3.py
""" Flask app to store and retrieve a list of bubble tea shops Data is stored in a SQLite database that looks something like the following: +------+--------------+----------+-------+-------+-----------+------------+--------------+-------------+------+--------+ | Nam | Address | City | State | Zip | Open Ho...
rooneyshuman/Internet-Cloud-Systems
final/reviews.py
<reponame>rooneyshuman/Internet-Cloud-Systems<filename>final/reviews.py from __future__ import print_function # In python 2.7 from flask import redirect, request, url_for, render_template from flask.views import MethodView import bgmodel import sys import requests import datetime class Reviews(MethodView): def ...
rooneyshuman/Internet-Cloud-Systems
final/shops.py
<filename>final/shops.py from __future__ import print_function # In python 2.7 from flask import redirect, request, url_for, render_template from flask.views import MethodView import bgmodel import sys import requests class Shops(MethodView): def get(self): """ GET method for the shops page ...
rooneyshuman/Internet-Cloud-Systems
hw3/gbmodel/__init__.py
<filename>hw3/gbmodel/__init__.py from .model_sqlite3 import model appmodel = model() def get_model(): return appmodel
rooneyshuman/Internet-Cloud-Systems
final/bgmodel/settings_datastore.py
# Copyright 2016 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
rooneyshuman/Internet-Cloud-Systems
final/translation.py
<gh_stars>0 from __future__ import print_function # In python 2.7 from flask import redirect, request, url_for, render_template from flask.views import MethodView import bgmodel import sys import requests import datetime import six import json from google.cloud import translate_v2 as translate from google.oauth2 impo...
rooneyshuman/Internet-Cloud-Systems
final/form.py
from flask import redirect, request, url_for, render_template from flask.views import MethodView import bgmodel class Form(MethodView): def get(self): """ GET method for the form page :return: renders the form.html page on return """ return render_template("form.html") ...
rooneyshuman/Internet-Cloud-Systems
final/bgmodel/__init__.py
from .model_datastore import model from .settings_datastore import settings appmodel = model() appsettings = settings() def get_model(): return appmodel def get_settings(): return appsettings
rooneyshuman/Internet-Cloud-Systems
hw4/shops.py
<reponame>rooneyshuman/Internet-Cloud-Systems<gh_stars>0 from __future__ import print_function # In python 2.7 from flask import redirect, request, url_for, render_template from flask.views import MethodView import bgmodel import sys class Shops(MethodView): def get(self): """ GET method for the s...
MarioCarrilloA/fault
fm-rest-api/fm/fm/db/api.py
<filename>fm-rest-api/fm/fm/db/api.py # # Copyright (c) 2018 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # """ Base classes for storage engines """ import abc import six from oslo_config import cfg from oslo_db import api as db_api _BACKEND_MAPPING = {'sqlalchemy': 'fm.db.sqlalchemy.api'} IMPL...
MarioCarrilloA/fault
fm-rest-api/fm/fm/cmd/dbsync.py
# # Copyright (c) 2018 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import sys from oslo_config import cfg cfg.CONF(sys.argv[1:], project='fm') from fm.db import migration CONF = cfg.CONF def main(): migration.db_sync()
MarioCarrilloA/fault
fm-rest-api/fm/fm/api/controllers/v1/alarm.py
# # Copyright (c) 2018-2019 Wind River Systems, Inc. # # SPDX-License-Identifier: Apache-2.0 # import datetime import json import pecan from pecan import rest import wsme from wsme import types as wtypes import wsmeext.pecan as wsme_pecan from oslo_utils._i18n import _ from oslo_log import log from fm_api import fm...
zeitbyte/Font-Awesome-Swift
tools/updatetool.py
import json with open ('./icons.json', 'r') as f: icons = json.load(f) classes = [] codes = [] for name, atts in icons.items(): if "solid" in atts['styles']: iconClass = (name.title().replace(' ', '').replace('-','')) iconCode = r'"\u{%s}"' % atts['unicode'] classes.append("FA%s" %i...
J35P312/Processen
discover/find_spanning_pairs.py
import sys import os #python find_spanning_pairs.py input.sam exons.bed outprefix for line in open(sys.argv[1]): if line[0] == "@": print(line.rstrip()) continue content=line.rstrip().split() start=int(content[3]) end=int(content[7]) if start == end: continue #print(line.strip()) exons_start=set([]) ex...
J35P312/Processen
discover/filter_quant.py
<reponame>J35P312/Processen import sys read_length=150 min_cov=3 first=True for line in open(sys.argv[1]): if first: print line.strip() first=False continue content=line.strip().split() if read_length*float(content[-1])/float(content[2]) > min_cov and float(content[-1]) > 20: print(line.strip())
J35P312/Processen
Position.py
import re # TODO: Should be part of a VCF class def readVCFLine(line): if line[0].startswith("#"): return None variation = line.strip().split("\t") event_type = "" chrA = variation[0].replace("chr", "").replace("Chr", "").replace("CHR", "") posA = int(variation[1]) posB = 0 descr...
phoughton/keras_book
myproj/keras_eg1.py
<reponame>phoughton/keras_book<filename>myproj/keras_eg1.py import numpy as numpy X = np.random.random((32, 10)) y = np.random.random((10,)) print(x)
phoughton/keras_book
tests/my_test.py
<reponame>phoughton/keras_book import pytest from myproj import myclass @pytest.mark.parametrize("a, b, answer", [ ( 1, 1, 2 ), ( 2, 2, 4 ), ( 10, 10, 20 ) ]) def test_myclass(a, b, answer): my_obj = myclass.MyClass() assert my_obj.add(a,b) == answer
phoughton/keras_book
myproj/tensorflow1.py
<reponame>phoughton/keras_book import tensorflow as tf # There are different versions of tensorflow, # This was executed with the direct ml on wsl2 version. x = tf.Variable(0.) with tf.GradientTape() as tape: y = 2* (3 * x + 3) grad_of_y_wrt_x = tape.gradient(y, x) # Included in the tensor (amongst the debug) wi...
phoughton/keras_book
myproj/myclass.py
class MyClass(): def init(self): pass def add(self, a, b): return a + b
mutalyzer/hgvs-parser
mutalyzer_hgvs_parser/cli.py
<reponame>mutalyzer/hgvs-parser """ CLI entry point. """ import argparse import json from lark.tree import pydot__tree_to_png from . import usage, version from .convert import parse_tree_to_model from .hgvs_parser import parse def _parse(description, grammar_path, start_rule): """ CLI wrapper for parsing w...
mutalyzer/hgvs-parser
tests/test_hgvs_parser.py
""" Syntax tests for the lark based HGVS parser - taken from the previous Mutalyzer tests. """ import pytest from mutalyzer_hgvs_parser.hgvs_parser import HgvsParser @pytest.fixture def grammar(): return HgvsParser() @pytest.fixture def parser(grammar): def parse(description): __tracebackhide__ = ...
mutalyzer/hgvs-parser
mutalyzer_hgvs_parser/exceptions.py
class UnexpectedCharacter(Exception): def __init__(self, exception, description): self.line = exception.line self.column = exception.column self.allowed = exception.allowed self.considered_tokens = exception.considered_tokens self.pos_in_stream = exception.pos_in_stream ...
mutalyzer/hgvs-parser
mutalyzer_hgvs_parser/hgvs_parser.py
""" Module for parsing HGVS variant descriptions. """ import os from lark import Lark, Token, Transformer, Tree from lark.exceptions import UnexpectedCharacters, UnexpectedEOF from .exceptions import UnexpectedCharacter, UnexpectedEnd from .util import data_equals, get_child AMBIGUITIES = [ { "type": "i...
mutalyzer/hgvs-parser
tests/test_syntax.py
<gh_stars>0 """ Syntax tests for the lark based HGVS parser - taken from the HGVS website. """ import pytest from mutalyzer_hgvs_parser.hgvs_parser import HgvsParser @pytest.fixture def parser(): def parse(description): parse_tree = HgvsParser().parse(description) if parse_tree is None: ...
mutalyzer/hgvs-parser
tests/test_ambig.py
import pytest from lark.tree import Tree from mutalyzer_hgvs_parser.convert import to_model from mutalyzer_hgvs_parser.hgvs_parser import get_child from .test_convert import DESCRIPTIONS, INSERTED, LOCATIONS, REFERENCES, VARIANTS from .test_protein import HGVS_NOMENCLATURE @pytest.mark.parametrize( "description...
mutalyzer/hgvs-parser
tests/test_convert.py
""" Tests for the lark tree to dictionary converter. """ import pytest from mutalyzer_hgvs_parser.convert import to_model from mutalyzer_hgvs_parser.exceptions import NestedDescriptions def _get_tests(tests): return [(k, tests[k]) for k in tests.keys()] REFERENCES = { "R1": {"id": "R1"}, "R1(R2)": {"i...
mutalyzer/hgvs-parser
mutalyzer_hgvs_parser/convert.py
""" Module for converting HGVS descriptions and lark parse trees to their equivalent dictionary models. """ from lark import Token, Transformer from lark.exceptions import VisitError from .exceptions import NestedDescriptions from .hgvs_parser import parse from .util import get_only_value, to_dict def to_model(desc...
mutalyzer/hgvs-parser
tests/test_protein.py
import pytest from mutalyzer_hgvs_parser import parse, to_model HGVS_NOMENCLATURE = { # Substitution # - missense "LRG_199p1:p.Trp24Cys": { "type": "description_protein", "reference": {"id": "LRG_199p1"}, "coordinate_system": "p", "variants": [ { ...
mutalyzer/hgvs-parser
mutalyzer_hgvs_parser/util.py
from lark import Tree def to_dict(d_list): output = {} for d in d_list: if isinstance(d, dict): output.update(d) else: raise Exception("Element is not a dictionary.") return output def data_equals(children, path, data): parent = None for i, p in enumerate(...
gongzhifeix/sraddoni
src/simulationmanager.py
<filename>src/simulationmanager.py from intersectionController import IntersectionController from platoon import Platoon from vehicle import Vehicle from simlib import flatten import traci class SimulationManager(): def __init__(self, pCreation=True, iCoordination=True, iZipping=True, maxVehiclesPerPlatoon=0): ...
gongzhifeix/sraddoni
src/vehicle.py
<filename>src/vehicle.py import traci class Vehicle(): def __init__(self, vehicle): self._active = True self._acceleration = traci.vehicle.getAcceleration(vehicle) self._length = traci.vehicle.getLength(vehicle) self._maxSpeed = traci.vehicle.getMaxSpeed(vehicle) self._...
gongzhifeix/sraddoni
src/scenario_runner.py
from scenario_manager import runScenario, SCENARIO_NUMBER_CONFIGS, SCENARIO_LOCATION_CONFIG import sys import logging numOfSteps = None mapName = None scenarioNum = None # Check if we've passed any arguments on the command line if len(sys.argv) > 1: logging.info("Found arguments %s passed in", sys.argv) map...
EdleeDucay/BabyNames
process_files.py
<reponame>EdleeDucay/BabyNames ''' Commands 1,2,3 Functions for reading text files Processes the read data and creates dictionaries to implement more functions ''' import pickle def load_file(filename = 'baby-names-frequency-2017.txt'): ''' This function will load the file and create/return dictionaries for ...
EdleeDucay/BabyNames
draw_graph.py
''' Functions for graph creation ''' from graphics import * def draw_graph(names_dict): ''' (Command 9) This function will draw the graph of an inputted name's trend and close the graph on user command Parameters: dictionary the names dictionary Returns: none ...
EdleeDucay/BabyNames
main.py
<filename>main.py """ CMPT 103 - Programming Project Milestone # 1, 2 & 3 Date: Fall 2018 Author: <NAME> The purpose of this program is to explore the baby name data """ import fnmatch from draw_graph import * from process_files import * menu = f''' Alberta Baby names 1980 to 2017 {"-"*31} (0) Quit (1) Load and pr...
wlawler45/rpi_arm_composites_manufacturing_process
src/arm_composites_manufacturing_process/__init__.py
from __future__ import absolute_import from .arm_composites_manufacturing_process import ProcessController
wlawler45/rpi_arm_composites_manufacturing_process
src/arm_composites_manufacturing_process/generate_placement_action.py
<filename>src/arm_composites_manufacturing_process/generate_placement_action.py #!/usr/bin/env python #from .arm_composites_manufacturing_placement import PlacementController import rospy import time import actionlib import cv2 import cv2.aruco as aruco from geometry_msgs.msg import Pose, Point, Vector3 from ibvs_obje...
wlawler45/rpi_arm_composites_manufacturing_process
src/arm_composites_manufacturing_process/process_controller_server.py
# Copyright (c) 2018, Rensselaer Polytechnic Institute, Wason Technology LLC # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of source code must retain the above copyri...
WhySongtao/Car-Behavioural-Cloning
model.py
<reponame>WhySongtao/Car-Behavioural-Cloning import sys import csv import os import cv2 import matplotlib.pyplot as plt import numpy as np from tqdm import tqdm import sklearn from sklearn.model_selection import train_test_split from sklearn.utils import shuffle from keras.models import Sequential from keras.layers imp...
vEnhance/dwhandler
handler.py
import logging import os import pprint import socket from collections import OrderedDict from typing import Any, Dict, List, Optional, TypedDict import requests from dotenv import load_dotenv VERBOSE_LOG_LEVEL = 15 SUCCESS_LOG_LEVEL = 25 ACTION_LOG_LEVEL = 35 logging.addLevelName(VERBOSE_LOG_LEVEL, "VERBOSE") logging...
vEnhance/dwhandler
tests.py
<gh_stars>0 import logging import os import sys import unittest from .handler import DiscordWebhookHandler, truncate class TestLogger(unittest.TestCase): def test_short_log(self): handler = DiscordWebhookHandler() factory = logging.getLogRecordFactory() msg = "You. This is a warning. Isn't that bad?" args =...
vEnhance/dwhandler
__init__.py
from .handler import ACTION_LOG_LEVEL as _ACTION_LOG_LEVEL from .handler import SUCCESS_LOG_LEVEL as _SUCCESS_LOG_LEVEL from .handler import VERBOSE_LOG_LEVEL as _VERBOSE_LOG_LEVEL from .handler import DiscordWebhookHandler as _DiscordWebhookHandler ACTION_LOG_LEVEL = _ACTION_LOG_LEVEL SUCCESS_LOG_LEVEL = _SUCCESS_LOG...
kmu/emmet
emmet/common/tests/test_utils.py
from unittest import TestCase from copy import copy from emmet.common.utils import scrub_class_and_module class TestUtils(TestCase): def test_scrub_class_and_module(self): doc = {"@class": 1, "@module": 1, "this": 5} new = scrub_class_and_module(doc) self.assertEqual(new, {"this": 5}) ...
kmu/emmet
emmet/vasp/tests/test_mpworks.py
<reponame>kmu/emmet<filename>emmet/vasp/tests/test_mpworks.py import unittest import os from emmet.vasp.mpworks import MPWorksCompatibilityBuilder, \ convert_mpworks_to_atomate, update_mpworks_schema from maggma.stores import JSONStore, MemoryStore __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os....
kmu/emmet
emmet/materials/boltztrap.py
<gh_stars>1-10 import logging from datetime import datetime from monty.json import jsanitize from monty.tempfile import ScratchDir from pymatgen.core.structure import Structure from pymatgen.electronic_structure.boltztrap import BoltztrapRunner from maggma.builders import Builder __author__ = "<NAME> <<EMAIL>>" cl...
kmu/emmet
emmet/materials/magnetism.py
<reponame>kmu/emmet<filename>emmet/materials/magnetism.py import os.path from monty.serialization import loadfn from pymatgen import Structure from pymatgen.analysis.magnetism import CollinearMagneticStructureAnalyzer from pymatgen import __version__ as pymatgen_version from maggma.validator import JSONSchemaValidator...
kmu/emmet
emmet/vasp/tests/test_ml_structure.py
<reponame>kmu/emmet import unittest from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice from maggma.stores import MongoStore from emmet.vasp.ml_structures import MLStructuresBuilder __author__ = "<NAME>" __email__ = "<EMAIL>" class TestML(unittest.TestCase): def setUp(self): ...
kmu/emmet
emmet/borg/icsd_to_mongo.py
<filename>emmet/borg/icsd_to_mongo.py import json import logging import os import unicodedata import warnings from multiprocessing import Manager, Pool from pymongo import MongoClient from atomate.utils.utils import get_meta_from_structure from monty.io import zopen from monty.json import MontyDecoder, MontyEncoder f...
kmu/emmet
emmet/materials/tests/test_bond_valence.py
<reponame>kmu/emmet<gh_stars>1-10 import os import unittest from maggma.stores import JSONStore, MemoryStore from maggma.runner import Runner from emmet.materials.bond_valence import BondValenceBuilder __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) te...
kmu/emmet
tasks.py
from datetime import date import re from invoke import task from emmet import __version__ @task def setver(c): # Calendar versioning (https://calver.org/), with a patch segment # for release of multiple version in a day (should be rare). new_ver = date.today().isoformat().replace("-", ".") if __vers...
kmu/emmet
emmet/plotting/phonon.py
<reponame>kmu/emmet import io from bson.binary import Binary from maggma.builders import Builder from pydash import py_ import matplotlib from monty.json import MontyDecoder from pymatgen.phonon.plotter import PhononBSPlotter matplotlib.use('agg') class PhononDispersionPlotter(Builder): def __init__(self, pmg_...
kmu/emmet
emmet/materials/structure_similarity.py
<reponame>kmu/emmet import numpy as np from maggma.builders import Builder __author__ = "<NAME> <<EMAIL>>" class StructureSimilarityBuilder(Builder): def __init__(self, site_descriptors, structure_similarity, fp_type='csf', **kwargs): """ Calculates similarity metrics between s...
kmu/emmet
emmet/vasp/task_tagger.py
<gh_stars>1-10 import os import numpy as np from maggma.builders import MapBuilder from pymatgen import Structure from atomate.utils.utils import load_class __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) default_validation_settings = os.path.join( ...
kmu/emmet
emmet/materials/robocrys.py
<filename>emmet/materials/robocrys.py<gh_stars>1-10 import os from pymatgen.core.structure import Structure from maggma.builders import MapBuilder from robocrys import StructureCondenser, StructureDescriber from robocrys import __version__ as robocrys_version __author__ = "<NAME>" class RobocrysBuilder(MapBuilder)...
kmu/emmet
emmet/materials/tests/test_structure_similarity.py
<gh_stars>1-10 import unittest import os from emmet.materials.structure_similarity import * from maggma.stores import MemoryStore, JSONStore from monty.serialization import loadfn __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) test_site_fp_stats = o...
kmu/emmet
emmet/materials/tests/test_boltztrap4dos.py
import os import unittest from maggma.stores import JSONStore, MemoryStore from emmet.materials.boltztrap4dos import Boltztrap4DosBuilder, dos_from_boltztrap __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) boltztrap4dos_mat = os.path.join(module_dir, "...
kmu/emmet
emmet/vasp/tests/test_task_tagger.py
import unittest import os from datetime import datetime from emmet.vasp.task_tagger import TaskTagger from maggma.stores import JSONStore, MemoryStore from pymatgen import Structure from pymatgen.io.vasp.sets import MPRelaxSet, MPStaticSet, MPNonSCFSet __author__ = "<NAME>" __email__ = "<EMAIL>" module_dir = os.pat...
kmu/emmet
emmet/workflows/tests/test_property_workflows.py
<filename>emmet/workflows/tests/test_property_workflows.py<gh_stars>1-10 import os import unittest from maggma.stores import MemoryStore from maggma.runner import Runner from maggma.builders import Builder from emmet.workflows.property_workflows import PropertyWorkflowBuilder,\ get_elastic_wf_builder from pymatgen...
kmu/emmet
emmet/workflows/property_workflows.py
""" This module is intended to allow building derivative workflows for material properties based on missing properties in a materials collection """ import numpy as np import logging import six from maggma.builders import Builder from atomate.vasp.workflows.presets.core import wf_elastic_constant from atomate.vasp.po...
kmu/emmet
emmet/common/tests/test_copybuilder.py
from datetime import datetime, timedelta from unittest import TestCase from uuid import uuid4 from maggma.stores import MongoStore from maggma.runner import Runner from emmet.common.copybuilder import CopyBuilder class TestCopyBuilder(TestCase): @classmethod def setUpClass(cls): cls.dbname = "test_" ...
kmu/emmet
emmet/materials/mp_website.py
<reponame>kmu/emmet import os import os.path import string import traceback import copy import nltk import numpy as np from ast import literal_eval from datetime import datetime from itertools import groupby from monty.json import jsanitize from monty.serialization import loadfn from maggma.builders import Builder fr...
kmu/emmet
emmet/materials/substrates.py
import os import itertools from operator import itemgetter from pymatgen.core import Structure from pymatgen.analysis.elasticity.elastic import ElasticTensor from pymatgen.analysis.substrate_analyzer import SubstrateAnalyzer from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from maggma.builders import Builder...
kmu/emmet
emmet/materials/tests/test_robocrys.py
<gh_stars>1-10 import unittest import os from monty.serialization import loadfn from emmet.materials.robocrys import RobocrysBuilder from maggma.runner import Runner from maggma.stores import MemoryStore __author__ = "<NAME>" module_dir = os.path.join(os.path.dirname(os.path.abspath(__file__))) test_mats = os.path....
kmu/emmet
emmet/abinit/phonon.py
<gh_stars>1-10 import logging import tempfile import gridfs import os from abipy.dfpt.phonons import get_dyn_mat_eigenvec, match_eigenvectors from abipy.dfpt.anaddbnc import AnaddbNcFile from monty.json import jsanitize from pymatgen.phonon.bandstructure import PhononBandStructureSymmLine from pymatgen.core.structure ...
kmu/emmet
emmet/workflows/propjockey.py
<reponame>kmu/emmet """ This module is intended to allow building derivative workflows for material properties based on missing properties in a materials collection """ import logging import tqdm from maggma.builders import Builder from maggma.stores import MongoStore from fireworks import LaunchPad from datetime imp...
kmu/emmet
emmet/materials/dielectric.py
import numpy as np from itertools import combinations from pymatgen import Structure from pymatgen.core.tensors import Tensor from pymatgen.analysis.piezo import PiezoTensor from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from maggma.builders import MapBuilder __author__ = "<NAME> <<EMAIL>>" class Dielec...
kmu/emmet
emmet/materials/thermo.py
<reponame>kmu/emmet import logging from datetime import datetime from itertools import chain, combinations from functools import reduce from collections import defaultdict from pymatgen import Structure, Composition from pymatgen.entries.compatibility import MaterialsProjectCompatibility from pymatgen.entries.computed...
kmu/emmet
emmet/vasp/elastic.py
<reponame>kmu/emmet<gh_stars>1-10 """ This module contains 3 builders for elastic properties. 1. The ElasticAnalysisBuilder builds individual documents corresponding to aggregated tasks corresponding to a single input structure, e. g. all of the tasks in one workflow. This is where elastic tensors are fi...
kmu/emmet
emmet/materials/bond_valence.py
import os.path from monty.serialization import loadfn from pymatgen.core.structure import Structure from pymatgen.analysis.bond_valence import BVAnalyzer from pymatgen.core.periodic_table import Specie from pymatgen import __version__ as pymatgen_version from maggma.builders import MapBuilder from maggma.validator im...
kmu/emmet
emmet/plotting/tests/test_electronic_structure.py
<filename>emmet/plotting/tests/test_electronic_structure.py import unittest from unittest.mock import patch, MagicMock from maggma.stores import MemoryStore from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice from emmet.plotting.electronic_structure import ElectronicStructureImageBui...
kmu/emmet
setup.py
<filename>setup.py #!/usr/bin/env python import os from setuptools import setup, find_packages module_dir = os.path.dirname(os.path.abspath(__file__)) if __name__ == "__main__": setup( name='emmet', version="2018.06.07", description='Emmet is a builder framework for the Materials Project...
kmu/emmet
emmet/materials/electrodes.py
import os from pymatgen.core import Structure, Element from maggma.builders import Builder from pymatgen.entries.compatibility import MaterialsProjectCompatibility from pymatgen.analysis.structure_matcher import StructureMatcher, ElementComparator from pymatgen.analysis.phase_diagram import PhaseDiagram, PhaseDiagramEr...
kmu/emmet
emmet/materials/bonds.py
import os.path from monty.serialization import loadfn import numpy as np from itertools import chain from pymatgen import Structure from pymatgen.analysis.local_env import NearNeighbors from pymatgen.analysis.graphs import StructureGraph from pymatgen import __version__ as pymatgen_version from maggma.builders impo...
kmu/emmet
mp_acceptance_tests/report_ehull_breaks.py
import itertools import json import sys import time from operator import itemgetter from urllib.parse import quote from mongogrant import Client import numpy as np from tqdm import tqdm from emmet.common.utils import get_chemsys_space html_out = len(sys.argv) > 1 and sys.argv[1] == 'html' if html_out: sys_print...
kmu/emmet
emmet/materials/boltztrap4dos.py
from pymatgen.electronic_structure.bandstructure import BandStructure from pymatgen.electronic_structure.boltztrap2 import BandstructureLoader, BztInterpolator, units, merge_up_down_doses from maggma.builders import Builder from maggma.utils import source_keys_updated import numpy as np __author__ = "<NAME> <<EMAIL>...
kmu/emmet
emmet/vasp/tests/test_elastic.py
<reponame>kmu/emmet import unittest import os from datetime import datetime import numpy as np from itertools import product import cProfile from pstats import Stats from emmet.vasp.elastic import ElasticAnalysisBuilder, ElasticAggregateBuilder,\ group_deformations_by_optimization_task, group_by_parent_lattice,\ ...
kmu/emmet
emmet/materials/has_properties.py
from collections import namedtuple, defaultdict from datetime import datetime from maggma.builders import Builder from pymongo import UpdateOne IDGetter = namedtuple("IDGetter", ["filter", "idfield"]) getters = { "elasticity": IDGetter({"elasticity": {"$exists": True}}, "task_id"), "piezo": IDGetter({"piezo.e...
kmu/emmet
emmet/borg/tests/test_icsd_to_mongo.py
<reponame>kmu/emmet<gh_stars>0 import unittest from monty.serialization import loadfn from emmet.borg.icsd_to_mongo import icsdDrone class TestIcsdToMongo(unittest.TestCase): def test_icsd_drone(self): drone = icsdDrone() obtained = drone.assimilate( 'test_files/999999999', store_mongo...
kmu/emmet
emmet/materials/diffraction.py
<gh_stars>1-10 import logging import os from datetime import datetime from monty.json import jsanitize from monty.serialization import loadfn from pymatgen.core.structure import Structure from pymatgen.analysis.diffraction.xrd import XRDCalculator, WAVELENGTHS from emmet.common.utils import load_settings from maggma...
kmu/emmet
emmet/materials/visualization.py
from maggma.builders import MapBuilder from monty.json import MontyDecoder from crystal_toolkit.components.structure import StructureMoleculeComponent class VisualizationBuilder(MapBuilder): def __init__( self, materials, visualization, projection=("structure",), bonding_s...
kmu/emmet
emmet/__init__.py
__version__ = "2018.06.07"
kmu/emmet
emmet/mpcomplete/structures.py
from datetime import datetime from collections import deque from maggma.builders import Builder from pymatgen import Structure from pymatgen.analysis.structure_matcher import StructureMatcher, ElementComparator from pymongo import UpdateOne from emmet.magic_numbers import LTOL, STOL, ANGLE_TOL class StructureWorkflo...
kmu/emmet
emmet/common/aggregate.py
from datetime import datetime from maggma.builders import Builder from maggma.utils import recursive_update class AggregateBuilder(Builder): """ Concats multiple collections together Uses `lu_field` to get new/updated documents, and uses a `key` field to determine which documents to merge together ...
kmu/emmet
emmet/vasp/mpworks.py
<reponame>kmu/emmet import numpy as np from datetime import datetime import os from pymatgen import Composition from pymatgen.entries.compatibility import MaterialsProjectCompatibility from pymatgen.entries.computed_entries import ComputedEntry from maggma.builders import Builder from pydash.objects import get, set_...
kmu/emmet
emmet/vasp/tests/test_materials.py
<filename>emmet/vasp/tests/test_materials.py<gh_stars>1-10 import unittest from maggma.stores import MongoStore from pymatgen.core.structure import Structure from pymatgen.core.lattice import Lattice from emmet.vasp.materials import MaterialsBuilder __author__ = "<NAME>" __email__ = "<EMAIL>" class TestMaterials(uni...
kmu/emmet
emmet/vasp/materials.py
<gh_stars>1-10 import os from datetime import datetime from itertools import chain, groupby import numpy as np from pymatgen import Structure from pymatgen.analysis.structure_matcher import StructureMatcher, ElementComparator from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from maggma.builders import Builde...
kmu/emmet
emmet/materials/xas.py
<filename>emmet/materials/xas.py import os import numpy as np from monty.serialization import loadfn from pydash import py_ from pymatgen import Structure from pymatgen.symmetry.analyzer import SpacegroupAnalyzer from pymatgen.analysis.xas.spectrum import XANES from maggma.builders import MapBuilder, GroupBuilder from...
fantasticsquirrel/Utilities
Token_locker.py
metadata = Hash() data = Hash(default_value=0) @construct def seed(): metadata['operator'] = ctx.caller @export def change_metadata(key: str, new_value: str): assert ctx.caller == metadata['operator'], "only operator can set metadata" metadata[key] = new_value @export def new_locker(locker_id : str, cont...