repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_utils/__init__.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 781 | 45 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_utils/test_classes.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 11,929 | 29.356234 | 88 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/__init__.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,539 | 45.666667 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_abc/test_faultabc.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,849 | 40.111111 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_abc/test_injectionabc.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 2,261 | 37.338983 | 80 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_abc/test_pytorchinjectionabc.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 3,525 | 34.26 | 88 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_abc/test_monitorabc.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,857 | 40.288889 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_abc/__init__.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,539 | 45.666667 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_plugins/__init__.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,539 | 45.666667 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_plugins/test_indexing/test_indexingpluginabc.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,539 | 45.666667 | 77 | py |
enpheeph | enpheeph-main/tests/test_enpheeph/unit_test/test_injections/test_plugins/test_indexing/__init__.py | # -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version... | 1,539 | 45.666667 | 77 | py |
enpheeph | enpheeph-main/notebooks/pruning_distribution_analysis/pruning_distribution_analysis_v2.2023_04_18__11_46_UTC.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Fou... | 28,259 | 34.280899 | 147 | py |
enpheeph | enpheeph-main/notebooks/pruning_distribution_analysis/pruning_distribution_analysis_v2.2023_04_15__15_28_UTC.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# enpheeph - Neural Fault Injection Framework
# Copyright (C) 2020-2023 Alessio "Alexei95" Colucci
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Fou... | 21,405 | 31.482549 | 143 | py |
autoSDC | autoSDC-master/setup.py | from setuptools import setup, find_packages
setup(
name="asdc",
version="0.1",
packages=find_packages(),
include_package_data=True,
install_requires=["Click",],
entry_points="""
[console_scripts]
asdc=asdc.scripts.cli:cli
""",
)
| 274 | 18.642857 | 43 | py |
autoSDC | autoSDC-master/examples/position_step.py | #!/usr/bin/env python
import asdc.position
def position_step(speed=1e-5):
with asdc.position.controller(ip="192.168.10.11", speed=speed) as pos:
pos.print_status()
pos.update_x(delta=1e-4, verbose=True)
pos.print_status()
if __name__ == "__main__":
position_step()
| 304 | 16.941176 | 74 | py |
autoSDC | autoSDC-master/examples/line_scan.py | #!/usr/bin/env python
import json
import time
from datetime import datetime
import os
import sys
import asdc.position
import asdc.control
def line_scan(speed=1e-5, poll_interval=5):
""" perform a line scan with CV experiments, recording position, current, potential, and parameters in json log files
Positio... | 2,365 | 28.209877 | 121 | py |
autoSDC | autoSDC-master/sphinx-docs/source/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# versastat documentation build configuration file, created by
# sphinx-quickstart on Mon Jan 8 11:29:00 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# ... | 5,159 | 29.898204 | 87 | py |
autoSDC | autoSDC-master/test/flow_mixing.py | import os
import sys
import json
import time
import serial
import argparse
import numpy as np
from pathlib import Path
from datetime import datetime
project_dir = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
sys.path.append(project_dir)
from asdc import sdc
PUMP_PORT = "COM12"
ORION_PORT = "COM17"
# s... | 4,491 | 28.748344 | 150 | py |
autoSDC | autoSDC-master/scripts/k20_single_posterior.py | #!/usr/bin/env python
import os
import sys
import json
import click
import gpflow
import numpy as np
import pandas as pd
from scipy import stats
from ruamel import yaml
from sklearn import metrics
import ternary
import matplotlib.pyplot as plt
from asdc import analyze
from asdc import emulation
from asdc import visu... | 6,600 | 28.337778 | 90 | py |
autoSDC | autoSDC-master/scripts/test_pumps.py | import sys
import numpy as np
sys.path.append(".")
from asdc import sdc
def test_pump_array():
print("connecting to pumps...")
p = sdc.pump.PumpArray(port="COM6")
p.print_config()
if __name__ == "__main__":
test_pump_array()
| 246 | 14.4375 | 39 | py |
autoSDC | autoSDC-master/scripts/stop_reglo.py | import sys
sys.path.append(".")
from asdc.sdc import reglo
r = reglo.Reglo(address="COM16")
r.stop()
| 103 | 12 | 32 | py |
autoSDC | autoSDC-master/scripts/analyze_NiTiAl_k20.py | import os
import glob
import json
import gpflow
import dataset
import numpy as np
import pandas as pd
from datetime import datetime
from asdc import analyze
flags = [36, 38]
elements = ["Ni", "Al", "Ti"]
def model_composition(df, invert_x=True, convert_to_decimal=True):
X = df.loc[:, ("0", "1")].values.astype(... | 3,828 | 25.047619 | 88 | py |
autoSDC | autoSDC-master/scripts/test_pump_command.py | import sys
import numpy as np
sys.path.append(".")
from asdc import sdc
solutions = {0: {"H2SO4": 1.0}, 1: {"Na2SO4": 1.0}, 2: {"KOH": 1.0}}
def test_pump_array():
print("connecting to pumps...")
p = sdc.pump.PumpArray(solutions, port="COM6")
p.print_config()
# p.set_pH(setpoint=2.0)
p.set_rate... | 401 | 18.142857 | 68 | py |
autoSDC | autoSDC-master/scripts/counterpump.py | import sys
sys.path.append(".")
from asdc.sdc import microcontroller
adafruit_port = "COM9"
p = microcontroller.PeristalticPump(port=adafruit_port, timeout=1)
# parse commandline arguments
args = sys.argv
if len(args) == 2:
setpoint = args[1]
try:
setpoint = float(setpoint)
if setpoint < 0 o... | 740 | 22.15625 | 66 | py |
autoSDC | autoSDC-master/scripts/debug_reglo.py | import sys
import json
import time
import asyncio
import numpy as np
import regloicclib
sys.path.append(".")
from asdc import sdc
# needle defaults counterclockwise (-)
# dump (-)
# loop (+)
# source (+)
from enum import IntEnum
class Channel(IntEnum):
ALL = 0
NEEDLE = 1
DUMP = 2
LOOP = 3
SOUR... | 6,330 | 35.595376 | 106 | py |
autoSDC | autoSDC-master/scripts/calibrate_ismatec.py | import sys
sys.path.append(".")
import json
import time
import numpy as np
import pandas as pd
from scipy import stats
from asdc.sdc import utils
from asdc.sdc import microcontroller
pump = microcontroller.PeristalticPump()
proportion = np.linspace(0, 0.6, 0.05)
volts_in, volts_out, sem_volts_out = [], [], []
pum... | 799 | 17.181818 | 47 | py |
autoSDC | autoSDC-master/scripts/test_pH_target.py | import sys
import numpy as np
sys.path.append(".")
from asdc import sdc
def test_pump_array():
print("connecting to pumps...")
p = sdc.pump.PumpArray(port="COM6")
p.print_config()
p.run_all()
for setpoint in [2.0, 3.0, 4.0, 5.0]:
print("setpoint pH:", setpoint)
p.set_pH(setpoint... | 469 | 17.076923 | 67 | py |
autoSDC | autoSDC-master/scripts/copper_pourbaix.py | import sys
import click
import numpy as np
from ruamel import yaml
sys.path.append(".")
from asdc import sdc
@click.command()
@click.argument("config-file", type=click.Path())
def copper_pourbaix(config_file):
with open(config_file, "r") as f:
config = yaml.safe_load(f)
solutions = config.get("solu... | 711 | 18.777778 | 67 | py |
autoSDC | autoSDC-master/scripts/k20_single_objective.py | #!/usr/bin/env python
import os
import sys
import click
import gpflow
import numpy as np
import pandas as pd
from scipy import stats
from ruamel import yaml
from sklearn import metrics
import ternary
import matplotlib.pyplot as plt
from asdc import analyze
from asdc import emulation
from asdc import visualization
o... | 6,297 | 28.568075 | 90 | py |
autoSDC | autoSDC-master/asdc/webcam.py | import time
import typing
import argparse
import cv2, platform
# import numpy as np
# https://stackoverflow.com/questions/26691189/how-to-capture-video-stream-with-opencv-python
def imagecap(camera_device_index: int = 2):
cap = cv2.VideoCapture(camera_device_index)
time.sleep(1)
if not cap:
prin... | 1,148 | 25.113636 | 93 | py |
autoSDC | autoSDC-master/asdc/epics.py | import os
import re
import sys
import time
import shutil
import typing
import pathlib
import subprocess
# the epics channel used to trigger x-ray measurements
PV = "XF:06BM-ES:1{Sclr:1}.NM29"
XRF_DIR = "/home/xf06bm/Data/Visitors/Howard\ Joress/2020-01-22"
PILATUS_DIR = "/nist/xf06bm/experiments/XAS/Pilatus/Howard_Jo... | 2,202 | 25.865854 | 82 | py |
autoSDC | autoSDC-master/asdc/dashboard.py | import hvplot.pandas
import asyncio
import zmq.asyncio
import pandas as pd
from datetime import datetime
from functools import partial
import streamz
import hvplot.streamz
from streamz.dataframe import DataFrame
import panel as pn
import holoviews as hv
from bokeh.plotting import curdoc
from holoviews.streams import ... | 2,273 | 31.956522 | 110 | py |
autoSDC | autoSDC-master/asdc/gp_deposition.py | """ GP deposition -- deposit duplicate samples, performing a corrosion test on the second """
import os
import sys
import json
import time
import click
import asyncio
import dataset
import functools
import numpy as np
import pandas as pd
from ruamel import yaml
from aioconsole import ainput
from typing import Any, Lis... | 25,649 | 32.529412 | 112 | py |
autoSDC | autoSDC-master/asdc/visualization.py | import os
import numpy as np
import ternary
from ternary.helpers import simplex_iterator
import matplotlib
import matplotlib.pyplot as plt
from matplotlib.colors import Normalize
from mpl_toolkits.axes_grid1 import make_axes_locatable
import sys
import warnings
warnings.simplefilter("ignore", UserWarning)
sys.coini... | 10,146 | 26.350404 | 109 | py |
autoSDC | autoSDC-master/asdc/slackbot.py | import os
import re
import slack
import time
import asyncio
import concurrent
from datetime import datetime
# check if there is a proxy between localhost and the internet
PROXY = os.environ.get("https_proxy")
BOT_TOKEN = open("slacktoken.txt", "r").read().strip()
bot_patterns = {"sdc": "<@UHT11TM6F>", "ctl": "<@UHNH... | 3,260 | 28.378378 | 94 | py |
autoSDC | autoSDC-master/asdc/video.py | import cv2
import typing
import skvideo.io
import numpy as np
import multiprocessing as mp
from contextlib import contextmanager
FFMPEG_OUTPUT_FLAGS = {
"-vcodec": "libx264",
"-b": "300000000",
"-crf": "18",
"-vf": "format=yuv420p",
}
def videocap(e, filename="testproc.mp4", camera_idx=0):
cap =... | 1,034 | 18.166667 | 83 | py |
autoSDC | autoSDC-master/asdc/localclient.py | import os
import sys
import json
import time
import logging
import argparse
import asyncio
import dataset
import functools
import subprocess
# import websockets
import numpy as np
import pandas as pd
from ruamel import yaml
from datetime import datetime
from aioconsole import ainput, aprint
from contextlib import cont... | 67,334 | 35.634929 | 126 | py |
autoSDC | autoSDC-master/asdc/calibration.py | import os
import re
import datetime
import numpy as np
import pandas as pd
from scipy import signal
from scipy import interpolate
def composition(solution):
m = re.match("\d+.\d+", solution)
try:
return float(m.group())
except AttributeError:
return np.nan
def experiment_start_time(heade... | 4,474 | 27.870968 | 85 | py |
autoSDC | autoSDC-master/asdc/_slack.py | import os
import json
import time
import slack
import logging
import requests
try:
with open("slacktoken.txt", "r") as f:
SLACK_TOKEN = f.read()
except:
SLACK_TOKEN = os.environ.get("ASDC_SLACK_TOKEN")
sc = slack.WebClient(SLACK_TOKEN)
class SlackHandler(logging.Handler):
# channel = "UC4U7SBV2"... | 1,610 | 23.784615 | 86 | py |
autoSDC | autoSDC-master/asdc/ocp.py | import os
import glob
import json
import numpy as np
import pandas as pd
import gpflow
from asdc import analyze
from asdc import visualization
def load_dataset(data_dir):
files = glob.glob(os.path.join(data_dir, "*.json"))
df = None
for idx, datafile in enumerate(files):
with open(datafile, "r"... | 2,367 | 26.218391 | 87 | py |
autoSDC | autoSDC-master/asdc/client.py | import os
import sys
import json
import time
import click
import asyncio
import dataset
import functools
import websockets
import numpy as np
import pandas as pd
from ruamel import yaml
from datetime import datetime
from aioconsole import ainput, aprint
from contextlib import contextmanager, asynccontextmanager
from t... | 49,099 | 35.20944 | 129 | py |
autoSDC | autoSDC-master/asdc/controller.py | import os
import sys
import json
import time
import click
import asyncio
import dataset
import functools
import numpy as np
import pandas as pd
from ruamel import yaml
from aioconsole import ainput
sys.path.append("../scirc")
sys.path.append(".")
import scirc
from asdc import slack
BOT_TOKEN = open("slack_bot_token.... | 7,551 | 30.206612 | 112 | py |
autoSDC | autoSDC-master/asdc/characterization.py | import json
import dataset
import imageio
import pathlib
import numpy as np
import pandas as pd
from scipy import integrate
from sklearn import linear_model
def load_rates(expt):
instructions = json.loads(expt["instructions"])
return instructions[0].get("rates")
def deposition_potential(expt):
instructi... | 5,908 | 25.859091 | 86 | py |
autoSDC | autoSDC-master/asdc/__init__.py | 0 | 0 | 0 | py | |
autoSDC | autoSDC-master/asdc/analyze.py | import numpy as np
import pandas as pd
from scipy import stats
from scipy import signal
from sklearn import metrics
from sklearn import linear_model
from skimage import filters
import lmfit
from lmfit import models
def laplace(x, loc, scale, amplitude):
""" laplace peak shape for fitting open circuit potential o... | 8,145 | 27.784452 | 120 | py |
autoSDC | autoSDC-master/asdc/emulation.py | import gpflow
import dataset
import numpy as np
import pandas as pd
import tensorflow as tf
def simplex_grid(n=3, buffer=0.1):
""" construct a regular grid on the ternary simplex """
xx, yy = np.meshgrid(np.linspace(0.0, 1.0, n), np.linspace(0.0, 1.0, n))
s = np.c_[xx.flat, yy.flat]
sel = np.abs(s).... | 8,029 | 29.301887 | 147 | py |
autoSDC | autoSDC-master/asdc/gp_controller.py | import os
import sys
import json
import time
import click
import asyncio
import dataset
import functools
import numpy as np
import pandas as pd
from ruamel import yaml
from aioconsole import ainput
import gpflow
from gpflowopt import acquisition
from scipy import stats
from scipy import spatial
from datetime import da... | 12,555 | 31.444444 | 112 | py |
autoSDC | autoSDC-master/asdc/scripts/electroplate.py | #!/usr/bin/env python
import os
import sys
import glob
import json
import time
from ruamel import yaml
import click
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
from asdc import sdc
from asdc import slack
from asdc import visualization
@click.command()
@click.a... | 6,590 | 33.150259 | 93 | py |
autoSDC | autoSDC-master/asdc/scripts/cli.py | #!/usr/bin/env python
import os
import sys
import glob
import json
import time
import click
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
from asdc import sdc
from asdc import visualization
@click.group()
def cli():
pass
@cli.command()
@click.option("--verbose/--no-verbose", ... | 3,641 | 25.977778 | 86 | py |
autoSDC | autoSDC-master/asdc/scripts/auto.py | #!/usr/bin/env python
import os
import sys
import glob
import json
import time
import yaml
import click
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
from asdc import sdc
from asdc import ocp
from asdc import slack
from asdc import analyze
from asdc import visuali... | 5,411 | 34.372549 | 124 | py |
autoSDC | autoSDC-master/asdc/scripts/__init__.py | 0 | 0 | 0 | py | |
autoSDC | autoSDC-master/asdc/scripts/find_circle.py | #!/usr/bin/env python
""" Perform sparse measurements to estimate the location of the interface between the gold dot sample and the epoxy """
import GPy
import json
import time
import numpy as np
from datetime import datetime
import matplotlib.pyplot as plt
import os
import sys
vs_path = os.path.expanduser(os.path.j... | 8,091 | 26.245791 | 119 | py |
autoSDC | autoSDC-master/asdc/scripts/combi_cv.py | #!/usr/bin/env python
import os
import sys
import glob
import json
import time
import yaml
import click
import numpy as np
import pandas as pd
from datetime import datetime
import matplotlib.pyplot as plt
from asdc import sdc
from asdc import visualization
# 5mm up, 50 microns down
@click.command()
@click.argument("c... | 3,312 | 31.165049 | 87 | py |
autoSDC | autoSDC-master/asdc/sdc/potentiostat.py | """ asdc.control: pythonnet .NET interface to VersaSTAT/VersaSCAN libraries """
import os
import clr
import sys
import json
import time
import asyncio
import inspect
import logging
import streamz
import numpy as np
import pandas as pd
from datetime import datetime
from contextlib import contextmanager
from streamz.da... | 17,240 | 33.760081 | 134 | py |
autoSDC | autoSDC-master/asdc/sdc/reglo.py | """ interface for the Reglo peristaltic pump """
import time
import typing
from typing import Dict
from enum import IntEnum
from collections import Iterable
import regloicclib
class Channel(IntEnum):
"""index organization for the pump channels
needle defaults counterclockwise (-)
drain (-)
loop (+)... | 3,096 | 25.02521 | 88 | py |
autoSDC | autoSDC-master/asdc/sdc/position.py | """ asdc.position: pythonnet .NET interface to VersaSTAT motion controller """
CONTROLLER_ADDRESS = "192.168.10.11"
import os
import clr
import sys
import time
import asyncio
import functools
import numpy as np
from contextlib import contextmanager, asynccontextmanager
import traceback
# pythonnet checks PYTHONPATH... | 9,539 | 28.263804 | 91 | py |
autoSDC | autoSDC-master/asdc/sdc/experiment.py | import sys
import json
import time
import numpy as np
import pandas as pd
from datetime import datetime
from typing import Optional, Dict, List, Sequence
import streamz
import streamz.dataframe
from asdc import _slack
from asdc import analysis
from .experiment_defaults import *
# if sys.platform == 'win32':
# f... | 12,820 | 27.302428 | 123 | py |
autoSDC | autoSDC-master/asdc/sdc/pump.py | from __future__ import annotations
import time
import chempy
import serial
import logging
import numpy as np
from scipy import optimize
from chempy import equilibria
from collections import defaultdict
from collections.abc import Iterable
logger = logging.getLogger(__name__)
logging.basicConfig(level=logging.DEBUG)
... | 10,996 | 31.344118 | 116 | py |
autoSDC | autoSDC-master/asdc/sdc/orion.py | import os
import re
import time
import serial
import typing
import asyncio
import streamz
import argparse
import threading
import collections
import pandas as pd
from datetime import datetime
from contextlib import contextmanager
from typing import Dict, List
import zmq
import zmq.asyncio
MODEL_NUMBER = "A221"
# th... | 8,767 | 27.842105 | 218 | py |
autoSDC | autoSDC-master/asdc/sdc/utils.py | def encode(message):
message = message + "\r\n"
return message.encode()
def decode(message):
""" bytes to str; strip carriage return """
if type(message) is list:
return [decode(msg) for msg in message]
return message.decode().strip()
def ismatec_to_flow(pct_rate):
""" calibration ... | 1,001 | 26.081081 | 84 | py |
autoSDC | autoSDC-master/asdc/sdc/microcontroller.py | import json
import time
import serial
from typing import Optional, Dict
from asdc.sdc.utils import encode, decode
from asdc.sdc.utils import flow_to_proportion, proportion_to_flow
class MicrocontrollerInterface:
"""base interface for the equipment hooked up through a microcontroller board
This interface cu... | 4,816 | 30.48366 | 125 | py |
autoSDC | autoSDC-master/asdc/sdc/experiment_defaults.py | import json
import inspect
import logging
from typing import Optional
from dataclasses import dataclass
from collections.abc import Iterable
logger = logging.getLogger(__name__)
class SDCArgs:
"""base class for default experiment arguments
relies on a bit of introspection magic to generate param strings for... | 11,072 | 30.191549 | 111 | py |
autoSDC | autoSDC-master/asdc/sdc/__init__.py | """ SDC interface """
from __future__ import absolute_import
import sys
# try:
# raise ModuleNotFoundError
# except NameError:
# ModuleNotFoundError = ImportError
# if clr module (pythonnet) is not available, load the SDC shims
from . import pump
from . import orion
from . import reglo
from . import experi... | 538 | 18.25 | 64 | py |
autoSDC | autoSDC-master/asdc/sdc/shims/potentiostat.py | """ asdc.control: pythonnet .NET interface to VersaSTAT/VersaSCAN libraries """
import os
import sys
import json
import time
import asyncio
import inspect
import logging
import streamz
import numpy as np
import pandas as pd
from datetime import datetime
from contextlib import contextmanager
from streamz.dataframe imp... | 14,457 | 32.009132 | 134 | py |
autoSDC | autoSDC-master/asdc/sdc/shims/position.py | """ asdc.position: pythonnet .NET interface to VersaSTAT motion controller """
import os
import sys
import time
import numpy as np
from contextlib import contextmanager
ax = [0, 0, 0]
@contextmanager
def controller(ip="192.168.10.11", speed=1e-4):
""" context manager that wraps position controller class Positio... | 3,713 | 26.308824 | 91 | py |
autoSDC | autoSDC-master/asdc/sdc/shims/pump.py | 0 | 0 | 0 | py | |
autoSDC | autoSDC-master/asdc/sdc/shims/__init__.py | 0 | 0 | 0 | py | |
autoSDC | autoSDC-master/asdc/analysis/cv.py | import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
logger = logging.getLogger(__name__)
class CVData(EchemData):
@property
def _constructor(self):
return CVData
@property
def name(self)... | 718 | 20.787879 | 52 | py |
autoSDC | autoSDC-master/asdc/analysis/butler_volmer.py | import lmfit
import numpy as np
from asdc.analysis.echem_data import EchemData
def butler_volmer(x, E_oc, j0, alpha_c, alpha_a):
overpotential = x - E_oc
current = j0 * (np.exp(alpha_a * overpotential) - np.exp(-alpha_c * overpotential))
return current
def log_butler_volmer(x, E_oc, i_corr, alpha_c, al... | 7,962 | 30.227451 | 97 | py |
autoSDC | autoSDC-master/asdc/analysis/lsv.py | import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
logger = logging.getLogger(__name__)
class LSVData(EchemData):
@property
def _constructor(self):
return LSVData
@property
def name(sel... | 723 | 20.939394 | 52 | py |
autoSDC | autoSDC-master/asdc/analysis/potentiodynamic.py | import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
logger = logging.getLogger(__name__)
class PotentiodynamicData(EchemData):
@property
def _constructor(self):
return PotentiodynamicData
@p... | 783 | 22.757576 | 60 | py |
autoSDC | autoSDC-master/asdc/analysis/tafel.py | import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
from asdc.analysis import butler_volmer
logger = logging.getLogger(__name__)
def current_crosses_zero(df):
""" verify that a valid Tafel scan should has a ... | 3,195 | 27.792793 | 87 | py |
autoSDC | autoSDC-master/asdc/analysis/ocp.py | import logging
import numpy as np
import pandas as pd
from csaps import csaps
from pandas import DataFrame
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
logger = logging.getLogger(__name__)
def ocp_stop(x, y, time=90, tstart=300, thresh=0.00003):
t = tstart
deriv = np.inf
... | 2,360 | 26.453488 | 91 | py |
autoSDC | autoSDC-master/asdc/analysis/report.py | import os
import json
import dataset
import pandas as pd
import numpy as np
from asdc import analysis
def process_pH(pH_file, dir="data"):
data = {}
try:
df = pd.read_csv(os.path.join(dir, pH_file))
data["pH_initial"] = df.pH.iloc[0]
data["pH_final"] = df.pH.iloc[-1]
data["pH_a... | 4,047 | 27.914286 | 97 | py |
autoSDC | autoSDC-master/asdc/analysis/lpr.py | from __future__ import annotations
import lmfit
import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData, Status
logger = logging.getLogger(__name__)
def current_crosses_zero(df: pd.DataFrame) -> bool:
""" verif... | 6,577 | 31.245098 | 118 | py |
autoSDC | autoSDC-master/asdc/analysis/__init__.py | from asdc.analysis.echem_data import EchemData
from asdc.analysis.cv import CVData
from asdc.analysis.lpr import LPRData
from asdc.analysis.lsv import LSVData
from asdc.analysis.ocp import OCPData
from asdc.analysis.tafel import TafelData
from asdc.analysis.potentiodynamic import PotentiodynamicData
from asdc.analysis.... | 392 | 34.727273 | 61 | py |
autoSDC | autoSDC-master/asdc/analysis/potentiostatic.py | import logging
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib.pyplot as plt
from asdc.analysis.echem_data import EchemData
logger = logging.getLogger(__name__)
class PotentiostaticData(EchemData):
@property
def _constructor(self):
return PotentiostaticData
@pro... | 784 | 22.787879 | 59 | py |
autoSDC | autoSDC-master/asdc/analysis/echem_data.py | import numpy as np
import pandas as pd
from enum import IntEnum
class Status(IntEnum):
OK = 0
WARN = 1
RETRY = 2
FAIL = 3
class EchemData(pd.DataFrame):
def check_quality(self):
"""run diagnostics, return status that explains what to do and why.
maybe status could be like
... | 771 | 26.571429 | 79 | py |
pmb-nll | pmb-nll-main/src/single_image_inference.py | """
Probabilistic Detectron Single Image Inference Script
"""
import json
import os
import sys
import cv2
import torch
import tqdm
import core
# This is very ugly. Essential for now but should be fixed.
sys.path.append(os.path.join(core.top_dir(), "src", "detr"))
from detectron2.data import MetadataCatalog
from det... | 4,694 | 32.297872 | 94 | py |
pmb-nll | pmb-nll-main/src/apply_net.py | """
Probabilistic Detectron Inference Script
"""
import json
import os
import sys
from shutil import copyfile
import torch
import tqdm
import core
# This is very ugly. Essential for now but should be fixed.
sys.path.append(os.path.join(core.top_dir(), "src", "detr"))
from detectron2.data import MetadataCatalog, bui... | 4,645 | 30.391892 | 106 | py |
pmb-nll | pmb-nll-main/src/single_image_inference_eval.py | """
Probabilistic Detectron Single Image Inference Script
Runs inference and evaluation on specified images, rather than on entire dataset.
"""
import json
import os
import sys
from shutil import copyfile, rmtree
import torch
import tqdm
import core
# This is very ugly. Essential for now but should be fixed.
sys.pat... | 7,829 | 36.644231 | 105 | py |
pmb-nll | pmb-nll-main/src/__init__.py | 0 | 0 | 0 | py | |
pmb-nll | pmb-nll-main/src/train_net.py | """
Probabilistic Detectron Training Script following Detectron2 training script found at detectron2/tools.
"""
import logging
import os
import random
import sys
import core
# This is very ugly. Essential for now but should be fixed.
sys.path.append(os.path.join(core.top_dir(), "src", "detr"))
# Detectron imports
im... | 4,421 | 28.284768 | 103 | py |
pmb-nll | pmb-nll-main/src/core/setup.py | import os
import random
import time
from shutil import copyfile
# Detectron imports
import detectron2.utils.comm as comm
import numpy as np
import torch
# Detr imports
from d2.detr.config import add_detr_config
from detectron2.config import CfgNode as CN
from detectron2.config import get_cfg
from detectron2.engine im... | 10,529 | 32.858521 | 155 | py |
pmb-nll | pmb-nll-main/src/core/__init__.py | import os
def top_dir():
"""
returns project top most directory
:return: (str) Project directory
"""
return os.sep.join(
os.path.dirname(
os.path.realpath(__file__)).split(
os.sep)[
:-2])
def data_dir():
"""
Returns data directory. Data dir... | 609 | 19.333333 | 94 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/mhtdaClink.py | # -*- coding: utf-8 -*-
"""
Michael Motro github.com/motrom/fastmurty 4/2/19
"""
import numpy as np
from ctypes import c_int, Structure, POINTER,\
RTLD_GLOBAL, CDLL, c_double, byref, c_char_p, c_bool
import os
file_path = os.path.realpath(__file__)
mhtda_path = os.path.join(os.path.split(file_path)... | 9,416 | 36.369048 | 81 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/example_simplest.py | # -*- coding: utf-8 -*-
"""
Michael Motro github.com/motrom/fastmurty last modified 5/17/19
Runs single-input K-best associations algorithm on a simple matrix.
Intended to demonstrate usage.
"""
import numpy as np
from otherimplementations.slowmurty import mhtda as mhtdaSlow
from mhtdaClink import sparse, mhtda, allo... | 3,470 | 41.329268 | 89 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/example_multiview.py | # -*- coding: utf-8 -*-
"""
Michael Motro github.com/motrom/fastmurty last modified 4/2/19
This is a simulation of 3-d point targets detected with 3 sensors, each of which
only sees two axes.
Two data association steps are used, between sensors 1 and 2 and between the
resulting estimates and sensor 3.
The test parame... | 14,286 | 41.020588 | 95 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/example_3frame.py | # -*- coding: utf-8 -*-
"""
Michael Motro github.com/motrom/fastmurty last modified 5/16/19
Runs single-input K-best associations algorithm on a square random matrix,
then treats the result as an input hypothesis for a multiple-input K-best
associations algorithm on a rectangular random matrix.
"""
import numpy as np... | 2,894 | 39.208333 | 106 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/example_2frame.py | # -*- coding: utf-8 -*-
"""
Michael Motro github.com/motrom/fastmurty last modified 4/2/19
Runs single-input K-best associations algorithm on square random matrices.
This test is meant to be directly comparable to the test code included with
Miller+Stone+Cox's implementation of data association.
"""
import numpy as n... | 1,695 | 33.612245 | 78 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/otherimplementations/daGibbs.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
github.com/motrom/fastmurty last mod 5/25/19
This is based on the pseudocode given in "Efficient Implementation..." by
B.N. Vo and B.T. Vo
This code is not necessarily a great implementation, it is primarily intended for
the comparison of Gibbs and deterministic algori... | 4,944 | 33.340278 | 81 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/otherimplementations/slowmurty.py | # -*- coding: utf-8 -*-
"""
github.com/motrom/fastmurty last modified 5/17/19
a simple but inefficient implementation of HOMHT data association
used for testing the validity of the main code
very slow - don't use on anything bigger than 50x50!
Also, this code doesn't correctly handle the corner cases of empty input mat... | 4,082 | 41.53125 | 81 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/otherimplementations/__init__.py | # -*- coding: utf-8 -*-
"""
github.com/motrom/fastmurty last modified 5/17/19
"""
| 83 | 13 | 49 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/sspSparse.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
The Jonker-Volgenant algorithm for finding the maximum assignment.
Michael Motro, University of Texas at Austin
last modified 3/5/2019
the __main__ code at the bottom tests this implementation, comparing it to
Scipy's linear_sum_assignment function. You'll need to ha... | 13,230 | 31.5086 | 88 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/murtysplitLookaheadDense.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
last mod 3/14/19
These functions reorder rows and columns before creating subproblems.
The goal is to set it up so the first subproblem fixes everything
but the first non-missing row.
One row and column is unfixed (w/ match or miss eliminated) every new problem.
"""
i... | 5,791 | 37.105263 | 83 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/sparsity.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import numba as nb
inf = 1e9
sparsedtype = np.dtype([('x', np.float64), ('idx', np.int64)])
nbsparsedtype = nb.from_dtype(sparsedtype)
def sparsify(c, s): # keep s lowest elements for each row
c2 = np.zeros((c.shape[0],s), dtype=sparsedty... | 643 | 22.851852 | 62 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/daSparse.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import numba as nb
from sparsity import nbsparsedtype
from sspSparse import SSP, spStep
from sspSparse import heapdtype as sparseheapdtype
from heap import iheappopmin, iheapreplacemax, iheapgetmax, heapdtype
from murtysplitLookaheadSparse impor... | 11,809 | 37.594771 | 90 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/outputSimple.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
last mod 3/7/19
"""
import numba as nb
@nb.jit(nb.i8(nb.i8[:,:], nb.b1[:], nb.i8[:], nb.i8[:], nb.i8[:,:], nb.i8))
def processOutput(matches, hypothesis, x, y, backward_index, n_matches):
"""
This one removes matches that are found after the limit has been hi... | 1,199 | 30.578947 | 75 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/heap.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
last mod 3/2/19
inspired by
"A Comparative Analysis of Three Different Priority Deques", Skov and Olsen
and the python 2.7 heapq
"""
import numpy as np
import numba as nb
heapdtype = np.dtype([('key', np.float64), ('val', np.int64)], align=False)
nbheapdtype = nb.fro... | 11,629 | 34.895062 | 84 | py |
pmb-nll | pmb-nll-main/src/core/fastmurty/previous python implementation/daDense.py | #!/usr/bin/env python2
# -*- coding: utf-8 -*-
"""
"""
import numpy as np
import numba as nb
from sspDense import SSP, spStep
from heap import iheappopmin, iheapreplacemax, iheapgetmax, heapdtype
from murtysplitLookaheadDense import murtySplit
from outputSimple import processOutput
def allocateWorkVarsforDA(m, n, nsol... | 9,810 | 37.324219 | 90 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.