repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
ScottSoren/EC_MS | src/EC_MS/Chem/__init__.py | <reponame>ScottSoren/EC_MS
from EC_MS.Chem.MolarMasses import *
from EC_MS.Chem.PhysCon import *
from EC_MS.Chem.Thermochem import *
__version__ = "0.5.0"
__title__ = "EC_MS.Chem"
__description__ = "Chemistry sub-package to EC_MS. Can calculate molar masses, standard potentials, etc."
__url__ = "https://github.com/Sco... |
ScottSoren/EC_MS | src/EC_MS/Electrolytes.py | <reponame>ScottSoren/EC_MS
# -*- coding: utf-8 -*-
"""
Created on Sat Jan 14 21:36:53 2017
This module will capture all the modelling from Chapter 3.1 in Scott's MSc
thesis for a range of electrolytes, as well as functions interfacing with
EC_MS data to enable predictions of pH change etc.
@author: soren
"""
import... |
ScottSoren/EC_MS | src/EC_MS/spectra.py | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Mon Mar 2 15:55:31 2020
@author: scott
"""
import os, re, pickle
import numpy as np
from matplotlib import pyplot as plt
from .PVMassSpec import read_PVMS
from .MS import Peak
from .dataset import Dataset
float_match = "[-]?\d+[\.]?\d*(e[-+]?\d+)?" # matches fl... |
ScottSoren/EC_MS | src/EC_MS/Chem/Thermochem.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Jul 31 00:21:47 2017
@author: scott
17G30:
There may be something time-saving here:
/home/scott/Dropbox/other_DTU/MSc/Scripts/PYTHON3/Masters Project/15L29 Report Intro
... but I can probably do better from scratch
or, better, build off someone elses... |
ScottSoren/EC_MS | src/EC_MS/Integrate_Signals.py | # -*- coding: utf-8 -*-
"""
Created on Tue Aug 2 22:50:34 2016
Most recently edited: 16I23
@author: Scott
This module has functions for integrating and averaging signals over specified
time frames or cycles, mostly for pulsed electrolysis experiments.
"""
# make python2-compatible:
from __future__ import print_funct... |
ScottSoren/EC_MS | src/EC_MS/add_data.py | # -*- coding: utf-8 -*-
"""
Created on Wed Mar 11 18:56:37 2020
@author: scott
"""
import os, sys
data_directory = (
os.path.dirname(os.path.realpath(__file__)) + os.sep + "data" + os.sep + "molecules"
)
def __main__():
pass
|
ScottSoren/EC_MS | src/EC_MS/Datapoints.py | <filename>src/EC_MS/Datapoints.py
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Tue Feb 28 16:13:26 2017
To have all the tools used for the Errorbars script in versitile,
easily accessible form.
@author: scott
"""
from matplotlib import pyplot as plt
import numpy as np
# one could argue that the fol... |
ScottSoren/EC_MS | _tests_/test_0.py | <gh_stars>1-10
# %%
from matplotlib import pyplot as plt
from EC_MS import Molecule
from EC_MS.utils.extraction_class import Extraction
# %%
Molecule("ethanol").plot_spectrum()
# %%
plt.show()
print(Extraction.__str__)
|
ScottSoren/EC_MS | src/EC_MS/__init__.py | <filename>src/EC_MS/__init__.py
"""
Most recently edited 16I23. Imports the EC_MS package
For a description of this package, see the included NOTES__EC_MS.text
@author: Scott
"""
# fmt: off
# ^ I can't have black formatting this because it breaks setup.py
__version__ = "0.7.5dev"
__title__ = "EC_MS"
__description__... |
ScottSoren/EC_MS | src/EC_MS/Zilien.py | <gh_stars>1-10
# -*- coding: utf-8 -*-
"""
Created on Thu Feb 20 19:08:46 2020
@author: scott
"""
import os, pickle
import numpy as np
from functools import wraps
from matplotlib import pyplot as plt
from .dataset import Dataset
from .spectra import Spectrum, Spectra, spectra_from_data
"""
The main Zilien importing i... |
ScottSoren/EC_MS | src/EC_MS/Chem/MolarMasses.py | """
This module does some useful stuff with parsing chemical formulas.
"""
import re
# fmt: off
# ^ so that Black doesn't format these lists, which are kind of organized according to the periodic table
Zdict = {'H':1,'He':2,
'Li':3,'Be':4,'B':5,'C':6,'N':7,'O':8,'F':9,'Ne':10,
'Na':11,'Mg':12,'Al':13,'Si':14,'P':15... |
ScottSoren/EC_MS | src/EC_MS/utils/__init__.py | """
EC_MS.utils is a stash for project-specific tools
"""
from .extraction_class import Extraction
from .kinetic_models import solve_carbonic_burst
from .icpms import *
|
ScottSoren/EC_MS | src/EC_MS/Molecules.py | # -*- coding: utf-8 -*-
"""
Created on Mon Oct 17 22:36:15 2016
@author: scott
This module will define the Molecule class used to organize, access, and
manipulate information about molecules. Objects of this class will generate and
utilize text files in EC_MS/data/
"""
from __future__ import print_function, divisio... |
ScottSoren/EC_MS | src/EC_MS/utils/extraction_class.py | # -*- coding: utf-8 -*-
"""
Created on Sun May 3 15:22:35 2020
@author: scott
"""
import os, json
import numpy as np
# from matplotlib import pyplot as plt
STANDARD_DATA_DIR = "../pickles/"
STANDARD_EXTRACTION_DIR = "../extractions/"
from EC_MS import Dataset
class Extraction(Dataset):
"""
Written 20E03 ... |
ScottSoren/EC_MS | src/EC_MS/Chem/PhysCon.py | <filename>src/EC_MS/Chem/PhysCon.py
# PhysCon, physical constants
import numpy as np
c = 2.997925e8 # speed of light / (m/s)
qe = 1.60219e-19 # fundamental charge / (C)
h = 6.62620e-34 # planck's constant / (J*s)
hbar = h / (2 * np.pi) # reduced planck's constant / (J*s)
NA = 6.02217e23 # Avogadro's number /(mol... |
ScottSoren/EC_MS | setup.py | import codecs
import os
import re
from setuptools import setup, find_packages
NAME = "EC_MS"
KEYWORDS = [
"electrochemistry",
"mass spectrometry",
]
CLASSIFIERS = [
"License :: Free for non-commercial use",
"Development Status :: 3 - Alpha",
"Intended Audience :: Science/Research",
"Natural La... |
ScottSoren/EC_MS | src/EC_MS/Time_Response.py | <reponame>ScottSoren/EC_MS
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 14 16:50:10 2016
Most recently edited: 16J27
@author: scott
This module will include functions for modelling mass transport
and fitting time response in the EC-MS setup.
See Scott's MSc thesis, chapter 2 and section 3.3, for discussion inc. pr... |
ScottSoren/EC_MS | src/EC_MS/patches.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 23:10:02 2020
@author: scott
"""
def fix_timecols(data):
"""Update and fix old errors in the timecols item of old data dictionaries"""
if "timecols" not in data:
return
new_timecols = {}
# some old pickles have timeco... |
ScottSoren/EC_MS | src/EC_MS/parsing_tools.py | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 9 15:45:37 2020
@author: scott
"""
import re
import time, datetime
import numpy as np
import os
"""
"""
float_match = "[-]?\d+[\.]?\d*(e[-]?\d+)?" # matches floats like '-3.5e4' or '7' or '245.13' or '1e-15'
# note, no white space included on the ends! Seems to work... |
ScottSoren/EC_MS | src/EC_MS/dataset.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Mon Feb 10 18:12:03 2020
@author: scott
"""
import os, re, pickle
import numpy as np
from types import FunctionType
from functools import wraps
from matplotlib import pyplot as plt
from matplotlib import cm as colormap
from .EC import sync_metadata, make_s... |
ScottSoren/EC_MS | src/EC_MS/PVMassSpec.py | # -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 11:06:17 2020
@author: <NAME>lets Lab_1
"""
import re
import numpy as np
from .parsing_tools import timestring_to_epoch_time
PVMassSpec_time_match = r"[0-9]{2}-[0-9]{2}-[0-9]{4} [0-9]{2}'[0-9]{2}'[0-9]{2}" # it has a ridiculous format
def PVMS_title_to_timestring... |
gallegonovato/no-google | scripts/parsed.py | <reponame>gallegonovato/no-google<filename>scripts/parsed.py
from datetime import date
today = date.today()
newfile = open('../google-domains', 'w')
newfile.write('# This blocklist helps Pi-hole\'s admin restrict access to Google and its domains.'+'\n')
newfile.write('# Last updated: ' + today.strftime('%d-%m-%Y') +'\... |
kkiyama117/enterlist | enterlist/__version__.py | __title__ = 'enterlist'
__description__ = 'nothing.'
__url__ = 'https://github.com/kkiyama117/KUEventParser'
__version__ = '1.0.1'
__build__ = 0x010001
__author__ = 'kkiyama117'
__author_email__ = '<EMAIL>'
__maintainer__ = ' kkiyama117'
__maintainer_email__ = '<EMAIL>'
__license__ = 'Apache2'
__copyright__ = 'Copyrigh... |
kkiyama117/enterlist | enterlist/core.py | from models import Enter
from spread import GetDataManager
from utils import post_message_to_channel
_spread_api = GetDataManager()
_first_message = '以下のエンター情報を読んで内容を確認して下さい'
def confirm_enters_data(user_id: str):
post_message_to_channel(user_id, 'CONFIRM START')
# mentor 毎に
for _name, _id in _spread_api... |
kkiyama117/enterlist | enterlist/api.py | import core
_commands_dict = {'check': 'confirm_enters_data'}
def request(event: dict):
# get data from event
message = event.get("event").get("text")
commander_id = event.get("event").get("user")
_command = parse_command(message)
if _command == "all":
_commands = _commands_dict.values()
... |
kkiyama117/enterlist | enterlist/spread.py | import os
from pathlib import Path
import gspread
# from dotenv.main import find_dotenv, load_dotenv
from oauth2client.service_account import ServiceAccountCredentials
# load_dotenv(find_dotenv())
scope = ['https://spreadsheets.google.com/feeds',
'https://www.googleapis.com/auth/drive']
class GetDataManag... |
kkiyama117/enterlist | enterlist/utils.py | import os
import requests
def post_message_to_channel(channel: str, message: str):
"""
Send message to slack
Args:
channel: ID of Channnel or member to send message
message: text of message
Returns:
"""
# load_dotenv(find_dotenv())
url = "https://slack.com/api/chat.postM... |
kkiyama117/enterlist | enterlist/aws.py | <gh_stars>0
# -*- coding: utf-8 -*-
import json
import logging
import boto3
# ログ設定
from api import request
from utils import post_message_to_channel
logger = logging.getLogger()
logger.setLevel(logging.INFO)
# client for call lambda
lambda_client = boto3.client('lambda')
def sender_handler(event, context):
"""... |
kkiyama117/enterlist | enterlist/deploy.py | <reponame>kkiyama117/enterlist<filename>enterlist/deploy.py
# -*- coding: utf-8 -*-
import os
import shutil
import subprocess
from pathlib import Path
def deploy():
""" Deploy package to AWS
"""
cd = Path(__file__).parent
os.chdir(cd)
print(cd)
args = ['pip', 'install', '-U', '-r', cd.as_posix... |
kkiyama117/enterlist | enterlist/models.py | <filename>enterlist/models.py
class Enter:
def __init__(self, enter_id: str, name: str, univ: str, department: str,
gender: str, interview: str, industry: str, demand: str, line: str, checked: bool = False):
self.enter_id = enter_id
self.name = name
self.univ = univ
... |
felipebastosweb/python-kivy-kivymd-hello-world | main.py | <filename>main.py
from kivy.uix.screenmanager import Screen
from kivymd.app import MDApp
from kivymd.uix.button import MDRectangleFlatButton
class MainApp(MDApp):
def build(self):
screen = Screen()
screen.add_widget(
MDRectangleFlatButton(
text="Hello, World",
... |
felipebastosweb/python-kivy-kivymd-hello-world | screens/mylist/mylist.py | from kivy.lang import Builder
from kivymd.uix.screen import MDScreen
from kivymd.uix.list import TwoLineListItem
class MyListScreen(MDScreen):
# constructor
def __init__(self, **kwargs):
super().__init__(**kwargs)
self.screen = Builder.load_file('screens/mylist/mylist.kv')
# screen render
... |
Usman-Ghani123/Car-Recognition | model_layers_params.py | <gh_stars>1-10
import keras
from resnet_50 import resnet50_model
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import CSVLogger, ModelCheckpoint, EarlyStopping
from keras.callbacks import ReduceLROnPlateau
from keras.models import Model
img_width, img_height = 224, 224
num_chann... |
Usman-Ghani123/Car-Recognition | analyze.py | # -*- coding: utf-8 -*-
import os
import matplotlib.pyplot as plt
import numpy as np
from keras.preprocessing import image
from sklearn.metrics import confusion_matrix
from tqdm import tqdm
from utils import load_model
def decode_predictions(preds, top=5):
results = []
# preds is basically t... |
Usman-Ghani123/Car-Recognition | train_model.py | import keras
from resnet_50 import resnet50_model
from keras.preprocessing.image import ImageDataGenerator
from keras.callbacks import CSVLogger, ModelCheckpoint, EarlyStopping
from keras.callbacks import ReduceLROnPlateau
img_width, img_height = 224, 224
num_channels = 3
train_data = 'data/train'
valid_data ... |
Usman-Ghani123/Car-Recognition | take_image_output.py | <gh_stars>1-10
import keras
from resnet_50 import resnet50_model
from keras.preprocessing.image import load_img
from keras.preprocessing.image import img_to_array
from keras.models import Model
from matplotlib import pyplot
from numpy import expand_dims
img_width, img_height = 224, 224
num_channels = 3
num_c... |
Usman-Ghani123/Car-Recognition | gui.py | import tkinter as tk
import tkinter.font
import cv2
from PIL import ImageTk, Image
import os
import random
import cv2 as cv
import keras.backend as K
import numpy as np
import scipy.io
from utils import load_model
from tkinter import filedialog
from utils import draw_str
def open_folder():
globa... |
Usman-Ghani123/Car-Recognition | utils.py | <filename>utils.py
import cv2 as cv
from resnet_50 import resnet50_model
def load_model():
model_weights_path = 'G:/fyp/resnet_50/model/epoch_100_aug/model.48-0.89.hdf5'
img_width, img_height = 224, 224
num_channels = 3
num_classes = 196
model = resnet50_model(img_height, img_width, num_channels,... |
jshom/poker-face-read | Rating_Hands/CardPair.py | <filename>Rating_Hands/CardPair.py
import pickle
class CardPair():
with open('Hands.pickle', 'rb') as pickle_in:
hands = pickle.load(pickle_in)
all_cards = [i for i in range(1,11)]
all_cards.extend(['J', 'Q', 'K', 'A'])
def __init__(self, cards = []):
#Cards in terms of['card pair', bool: same suit]
self... |
jshom/poker-face-read | Rating_Hands/ScrapingPokerHands.py | <reponame>jshom/poker-face-read
import requests
from bs4 import BeautifulSoup
import pickle
from os import listdir, remove
def scape_and_pickle_hands():
resp = requests.get('https://www.tightpoker.com/poker_hands.html')
soup = BeautifulSoup(resp.content, 'html.parser')
hands = []
for tr in soup.findAl... |
mo-pyy/micropython-st7735-esp8266 | main.py | # MicroPython ST7735 TFT display driver example usage
from machine import Pin, SPI
from tft import TFT_GREEN
gc.collect()
import font
import network, socket
# DC - RS/DC data/command flag
# CS - Chip Select, enable communication
# RST/RES - Reset
dc = Pin(4, Pin.OUT)
cs = Pin(2, Pin.OUT)
r... |
mo-pyy/micropython-st7735-esp8266 | tft.py | <reponame>mo-pyy/micropython-st7735-esp8266
# MicroPython ST7735 TFT display HAL
import time
from st7735 import ST7735
class TFT(ST7735):
def __init__(self, width, height, spi, dc, cs, rst, bl=None):
"""
SPI - SPI Bus (CLK/MOSI/MISO)
DC - RS/DC data/command flag
... |
amandewatnitrr/Aztecs-LogiTraffic | Team Aztecs_LogiTraffic_E-Ujjwala Hackathon 2020/Dev Files/permissions.py | <reponame>amandewatnitrr/Aztecs-LogiTraffic
from rest_framework.permissions import BasePermission, SAFE_METHODS
class IsOwner(BasePermission):
"""
Custom permission to only allow owners of an object to edit it.
"""
message = "You must be the owner"
my_safe_method = ['GET', 'POST']
# d... |
amandewatnitrr/Aztecs-LogiTraffic | Team Aztecs_LogiTraffic_E-Ujjwala Hackathon 2020/Dev Files/apps.py | <filename>Team Aztecs_LogiTraffic_E-Ujjwala Hackathon 2020/Dev Files/apps.py
from django.apps import AppConfig
class DeviceConfig(AppConfig):
name = 'Device'
|
amandewatnitrr/Aztecs-LogiTraffic | Team Aztecs_LogiTraffic_E-Ujjwala Hackathon 2020/Dev Files/admin.py | from django.contrib import admin
from Device.models import Device
# Register your models here.
admin.site.register(Device) |
jcassee/Garbage-Collection | custom_components/garbage_collection/__init__.py | <filename>custom_components/garbage_collection/__init__.py
"""
Component to integrate with garbage_colection.
"""
import os
from datetime import timedelta
import logging
from homeassistant import config_entries
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers impo... |
jcassee/Garbage-Collection | custom_components/garbage_collection/const.py | <gh_stars>0
import voluptuous as vol
from datetime import datetime, date
import homeassistant.helpers.config_validation as cv
from homeassistant.const import CONF_NAME, WEEKDAYS, CONF_ENTITIES
"""Constants for garbage_collection."""
# Base component constants
DOMAIN = "garbage_collection"
DOMAIN_DATA = f"{DOMAIN}_data... |
carlosnasc88/pythonbirds-1 | oo/Pessoa.py | class Pessoa:
olhos = 2
def __init__(self, *filhos , nome=None, idade=32):
self.idade = idade
self.nome = nome
self.filhos = list(filhos)
def cumprimentar(self):
return f'Ola{id(self)}'
if __name__ == '__main__':
ailton = Pessoa(nome='Ailton')
luciano = Pessoa(ai... |
Weida-W/CMPUT404-assignment-ajax | server.py | #!/usr/bin/env python
# coding: utf-8
# Copyright 2013 <NAME>
#
# 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 appl... |
sesam-community/template-generator | service.py | <reponame>sesam-community/template-generator
from flask import Flask, request, jsonify
import os
import json
from statics.pipe_templates import collect_pipe, enrich_pipe, global_pipe, transform_pipe, share_pipe
from statics.system_templates import system_configs
from sesamutils import sesam_logger
app = Flask(__name__... |
sesam-community/template-generator | statics/pipe_templates.py | <filename>statics/pipe_templates.py
def collect_pipe(system, pipeNameAndDatatype, config_group):
if config_group != "Default":
config = {
"_id": f"{config_group}-{pipeNameAndDatatype}-collect",
"type": "pipe",
"source": {
"type": f"{system['type']}",
"system": f"{system['_id']}"
... |
sesam-community/template-generator | statics/system_templates.py | <filename>statics/system_templates.py
def system_configs(system, config_group):
if config_group != "Default":
systems = [{"microservice": {
"_id": None,
"type": "system:microservice",
"metadata": {
"$config-group": f"{config_group}"
},
"docker": None,
"verify_ssl": True... |
DKrepsky/Kicad-LCSC-BOM-Plugin | lcsc-bom-plugin.py | <filename>lcsc-bom-plugin.py
#!/usr/bin/env python3
import sys
import csv
import xml.etree.ElementTree as ET
class Part:
def __init__(self):
self.name = None
self.mpn = None
self.lcsc = None
self.qty = 1
def parse_xml(file):
tree = ET.parse(file)
root = tree.getroot()
... |
CheungZeeCn/fairseq | fairseq/tasks/sentence_prediction_chinese_bert.py | <gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
from fairseq.data import (
data_utils,
TokenizerDictionary,
RawLabelDataset,
BertToke... |
CheungZeeCn/fairseq | fairseq/tasks/rebert.py | <reponame>CheungZeeCn/fairseq<filename>fairseq/tasks/rebert.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import os
import logging
import torch
from fairseq import metrics, options, ut... |
CheungZeeCn/fairseq | fairseq/data/middle_enhanced_tokenizer_plus_language_pair_dataset.py | <filename>fairseq/data/middle_enhanced_tokenizer_plus_language_pair_dataset.py
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import numpy as np
import torch
import pypinyin... |
CheungZeeCn/fairseq | fairseq/models/huggingface/hf_bert.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
import os
import sys
from torch import nn
from fairseq import utils
from fairseq.models import (
FairseqEncoderModel,
... |
CheungZeeCn/fairseq | fairseq/models/nat/levenshtein_refinement_rebert.py | # Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
import logging
from abc import ABC
from typing import Any, Dict, List, Optional, Tuple
import torch
from torch import Tensor
import torch.nn ... |
CheungZeeCn/fairseq | fairseq/models/nat/__init__.py | <gh_stars>1-10
# Copyright (c) Facebook, Inc. and its affiliates.
#
# This source code is licensed under the MIT license found in the
# LICENSE file in the root directory of this source tree.
"""isort:skip_file"""
from .fairseq_nat_model import *
from .nonautoregressive_transformer import *
from .nat_crf_transformer i... |
aksr-aashish/xlue-spr | spr/modules/vote.py | from pyrogram import filters
from pyrogram.types import CallbackQuery
from spr import NSFW_LOG_CHANNEL, SPAM_LOG_CHANNEL, SUDOERS, spr
from spr.core import ikb
from spr.utils.db import downvote, ignore_nsfw, upvote, user_voted
from spr.utils.misc import clean, get_file_unique_id
@spr.on_callback_query(filters.regex(... |
w3Abhishek/TwitterFeedBot | twitterfeed.py | <gh_stars>0
import requests
import telebot
import feedparser
import schedule
import time
import json
bot_token = 'TOKEN'
bot = telebot.TeleBot(bot_token)
def getJSON():
with open('feeds.json') as json_file:
feedd = json.load(json_file)
return feedd
feeds = getJSON()
@bot.message_handler(commands=['s... |
markusweimer/azure-data-lake-store-python | tests/test_transfer.py | <filename>tests/test_transfer.py
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ------------... |
markusweimer/azure-data-lake-store-python | samples/cli.py | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ----------------------... |
markusweimer/azure-data-lake-store-python | tests/settings.py | # -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------... |
markusweimer/azure-data-lake-store-python | azure/datalake/store/exceptions.py | # -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------... |
markusweimer/azure-data-lake-store-python | azure/datalake/store/utils.py | # -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------... |
markusweimer/azure-data-lake-store-python | tests/fake_settings.py | <gh_stars>10-100
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ----------------------------... |
markusweimer/azure-data-lake-store-python | tests/test_utils.py | <gh_stars>10-100
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ----------------------------... |
markusweimer/azure-data-lake-store-python | tests/test_mock.py | <reponame>markusweimer/azure-data-lake-store-python<filename>tests/test_mock.py
# -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project... |
markusweimer/azure-data-lake-store-python | azure/datalake/store/core.py | # -*- coding: utf-8 -*-
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
# ---------------------------------------------... |
morrisgreenberg/hdp-py | hdp_py/HDP.py | import numpy as np
import pandas as pd
from scipy import sparse
from scipy.special import gammaln as logg
from functools import partial
from numba import jit, float64, int64, int32
def pois_fk_cust(i, x, k, Kmax, ha, hb, new=False):
"""
Computes the mixture components for a given customer across all k values.... |
morrisgreenberg/hdp-py | hdp_py/get_data.py | <filename>hdp_py/get_data.py<gh_stars>1-10
import urllib
import string
from itertools import compress
from nltk.corpus import stopwords
import pandas as pd
from functools import reduce
import numpy as np
import re
import os
import pkgutil
from bs4 import BeautifulSoup
import gensim
import gensim.corpora as corpora
d... |
adriapr/socialight | wifi_tweets_feeder_2.py | from tweepy.streaming import StreamListener
from tweepy import OAuthHandler
from tweepy import Stream
from pprint import pprint
import json
from random import choice
import requests
import time
# SERVER_IP = 'localhost'
url_root = 'http://192.168.43.59/backdoor'
def blink(text = ''):
base_mode = str(5)
if... |
captbrando/OptionsQuote | optquote.py | <reponame>captbrando/OptionsQuote
#!/usr/bin/env python3
from bs4 import BeautifulSoup
import requests
import cgi, cgitb
import string
# Get the specific contract we want passed in the GET request.
args = cgi.FieldStorage()
symbol = args.getvalue('c').strip()
# Build our URL and get the HTML back and parse with Beau... |
moorugi98/pyhanabi | hanabi.py | import random
import sys
import copy
import time
GREEN = 0
YELLOW = 1
WHITE = 2
BLUE = 3
RED = 4
ALL_COLORS = [GREEN, YELLOW, WHITE, BLUE, RED]
COLORNAMES = ["green", "yellow", "white", "blue", "red"]
COUNTS = [3,2,2,2,1] # num. of cards in game of each rank
def f(something):
'''
semi-int... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/el_classify_sensitive_person_test.py | # -*- coding: utf-8 -*-
"""
Created on 2020/03/16
Feature selection: Relief-based feature selection algorithm.
------
@author: <NAME>
"""
import numpy as np
from sklearn import preprocessing
import os
from sklearn.externals import joblib
from el_classify_sensitive_person_train_validation import ClassifyFourKindOfPers... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_elasticNetCV.py | <reponame>dongmengshi/easylearn<filename>eslearn/machine_learning/classfication/lc_elasticNetCV.py
# -*- coding: utf-8 -*-
"""
Created on Tue Dec 18 19:23:42 2018
ElasticNetCV
Minimizes the objective function:
1 / (2 * n_samples) * ||y_train - Xw||^2_2
+ alpha * l1_ratio * ||w||_1
+ 0.5 * alpha * (1 - l1_ra... |
dongmengshi/easylearn | eslearn/utils/lc_copy_selected_file_V6.py | # -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 13:05:28 2018:
在版本3的基础上,根据pandas的join方法来求交集
根据从量表中筛选的样本,来获得符合要求的原始数据的路径
数据结构neuroimageDataPath//subject00001//files
也可以是任何的数据结构,只要给定subjName在哪里就行
总之,最后把file复制到其他地方(可以给每个subject限定某个符合条件file,比如以'.nii'结尾的file)
input:
# reference_file:需要复制的被试名字所在text文件(大表中的uid)
... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_permutation_svc_multiprocessing_block.py | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Aug 3 21:40:21 2018
@author: lenovo
"""
import multiprocessing
import time
#from scipy import io
import sys
sys.path.append(r'D:\myCodes\LC_MVPA\Python\MVPA_Python\utils')
# import module
from lc_read_write_Mat import write_mat
import time,os
import numpy as ... |
dongmengshi/easylearn | eslearn/utils/SelectRawData_Run.py | # -*- coding: utf-8 -*-
"""
Created on Fri Aug 31 15:06:51 2018
@author: lenovo
"""
# import modules
from PyQt5.QtWidgets import QApplication, QWidget, QFileDialog
from PyQt5 import QtWidgets
#from PyQt5 import QtWidgets
from SelectRawData_Window import Ui_CopySelectedData
import pandas as pd
import time
#from sel im... |
dongmengshi/easylearn | eslearn/utils/lc_extract_head_motion_paremeters.py | # -*- coding: utf-8 -*-
"""
Created on Mon Mar 25 20:53:20 2019
用来提取头动参数
@author: lenovo
"""
|
dongmengshi/easylearn | eslearn/utils/lc_read_write_Mat.py | <filename>eslearn/utils/lc_read_write_Mat.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 10 10:42:13 2018
read and write .mat(MATLAB) data
@author: <NAME>
"""
# import module
from scipy import io
import numpy as np
# def
def read_mat(fileName, dataset_name=None):
dataset_struct = io.loadmat(fileName)
if d... |
dongmengshi/easylearn | eslearn/utils/lc_write_read_h5py.py | <reponame>dongmengshi/easylearn<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Sat Jul 7 11:29:22 2018
write and read h5py file
@author: lenovo
"""
# import
import h5py
import numpy as np
# def
# r 只读,文件必须已存在
# r+ 读写,文件必须已存在
# w 新建文件,若存在覆盖
# w- 或x,新建文件,若存在报错
# a 如存在则读写,不存在则创建(默认)
def write_h5py(fileName,... |
dongmengshi/easylearn | eslearn/SSD_classification/Visulization/lc_plot_average_cohen_circle.py | cr# -*- coding: utf-8 -*-
"""
This script is used to plot cohen'd using circle format.
"""
import numpy as np
import pytest
import scipy.io as sio
import matplotlib.pyplot as plt
from mne.viz import plot_connectivity_circle, circular_layout
def test_plot_connectivity_circle():
"""
Test plotting connectivity ... |
dongmengshi/easylearn | eslearn/visualization/lc_pyecharts_pir.py | # -*- coding: utf-8 -*-
"""
Created on Wed Sep 26 10:55:08 2018
@author: lenovo
"""
from pyecharts import Pie
import numpy as np
attr = ['male','female']
v1 = sex4Num
pie = Pie('饼图示例')
pie.add('',attr,v1,is_label_show = True)
pie.render(r'D:\WorkStation_2018\WorkStation_2018_08_Doctor_DynamicFC_Psychosis\pie01.html')... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_cnn_compare_with_svm.py | # -*- coding: utf-8 -*-
"""
Created on Wed Dec 26 16:56:08 2018
@author: lenovo
"""
from sklearn.svm import SVC
clf = SVC()
clf.fit(sel.x_train, sel.y_train)
pred=clf.predict(test_data)
pred[pred==1]=0
pred[pred==3]=1
a=pred-test_label.T
a=a.T
sum(a==0)/206 |
dongmengshi/easylearn | eslearn/visualization/lc_clusterhotmap_v2.py | <filename>eslearn/visualization/lc_clusterhotmap_v2.py
import seaborn as sns; sns.set(color_codes=True)
import matplotlib.pyplot as plt
import matplotlib.gridspec
import pandas as pd
import numpy as np
data = pd.read_excel(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python\Plot\data.xlsx')
kind... |
dongmengshi/easylearn | eslearn/utils/lc_copyFiles.py | # -*- coding: utf-8 -*-
"""
Created on Sat Jul 21 22:37:32 2018
move selected files to selected folder
Note. Code will create folder for each file with the same name
as those of the source file
#复制单个文件
shutil.copy("C:\\a\\1.txt","C:\\b")
#复制并重命名新文件
shutil.copy("C:\\a\\2.txt","C:\\b\\121.txt")
#复制整个目录(备份)
shutil.copytre... |
dongmengshi/easylearn | eslearn/GUI/easylearn_main_run.py | <filename>eslearn/GUI/easylearn_main_run.py
#!/usr/bin/python3
# -*- coding: utf-8 -*-
"""
Main GUI of the easylearn
# Author: <NAME> <<EMAIL>>
# License: MIT
"""
import sys
import os
import json
from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox, QFileDialog
from PyQt5.QtGui import QIcon, QPixmap
f... |
dongmengshi/easylearn | eslearn/utils/lc_basicInfoStat.py | <reponame>dongmengshi/easylearn<filename>eslearn/utils/lc_basicInfoStat.py
# -*- coding: utf-8 -*-
"""
Created on Sun Oct 28 11:08:30 2018
1. 筛选age,sex匹配组,并根据age,sex,再次筛选basic
2. 将筛选好的各组被试的folder保存起来(升序排列,如不排列很可能最后相关是对应不上)
3. 根据各组的folder,将fmri数据分别复制或者移动到以组命名的文件夹
被试标签的意义:
1:HC;2:MDD;3:SZ;4:BD;5:HR
@author:<NAME>
"""
# ... |
dongmengshi/easylearn | eslearn/SSD_classification/Data_Inspection/lc_preprocess_for_our_dataset.py | """
This script is used to pre-process the dataeset in our center.
1.Transform the .mat files to one .npy file
2. Give labels to each subject, concatenate at the first column
3. Randomly splitting the whole data into training and validation
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tool... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_super_test.py | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Fri Apr 12 16:43:09 2019
@author: lenovo
"""
class Base(object):
def __init__(self):
print ("Base init")
class Medium1(Base):
def __init__(self):
Base.__init__(self)
print ("Medium1 init")
class Medium2(Base... |
dongmengshi/easylearn | eslearn/GUI/easylearn_feature_engineering_run.py | # -*- coding: utf-8 -*-
"""The GUI of the feature_engineering module of easylearn
Created on 2020/04/12
@author: <NAME>
Email:<EMAIL>
GitHub account name: lichao312214129
Institution (company): Brain Function Research Section, The First Affiliated Hospital of China Medical University, Shenyang, Liaoning, PR China.
... |
dongmengshi/easylearn | test/python_method.py | <reponame>dongmengshi/easylearn
class cal:
cal_name = 'computer'
def __init__(self,x,y):
self.x = x
self.y = y
#在cal_add函数前加上@property,使得该函数可直接调用,封装起来
@property
def cal_add(self):
return self.x + self.y
#在cal_info函数前加上@classmethon,则该函数变为类方法,该函数只能访问到类的数据属性,不... |
dongmengshi/easylearn | eslearn/utils/lc_selectFile_.py | <filename>eslearn/utils/lc_selectFile_.py
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 18 15:01:44 2018
used for select target files
refer to and thank [https://www.jianshu.com/p/91453c76dbc3]
@author: <NAME>
"""
from nipype import SelectFiles, Node
def selectFile(
rootPath=r'I:\Data_Code\insomnia\workstati... |
dongmengshi/easylearn | eslearn/GUI/el_grid_pipe_test.py | <filename>eslearn/GUI/el_grid_pipe_test.py<gh_stars>0
from sklearn import svm, datasets
from sklearn.model_selection import GridSearchCV
from sklearn.pipeline import Pipeline
from sklearn.feature_selection import SelectKBest
from sklearn.feature_selection import f_regression
from sklearn.datasets import make_classifica... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_svc_rfe_fmri_V2.py | # -*- coding: utf-8 -*-
"""
Created on Tue Mar 12 10:07:21 2019
@author: lenovo
"""
import sys
import os
cpwd = __file__
root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
# root = r'D:/My_Codes/LC_Machine_Learning/lc_rsfmri_tools/lc_rsfmri_tools_python'
sys.path.append(root)
# sys.path.append(r'D:\My_C... |
dongmengshi/easylearn | eslearn/visualization/lc_radarplot.py | # -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 09:37:41 2018
@author: lenovo
"""
import pygal
radar_chart = pygal.Radar()
pygal.Radar(fill=True,line='-')
radar_chart.title = 'radar_plot'
radar_chart.x_labels = ['Richards', 'DeltaBlue', 'Crypto', 'RayTrace', 'EarleyBoyer', 'RegExp', 'Splay', 'NavierStokes']
radar... |
dongmengshi/easylearn | eslearn/statistical analysis/lc_calc_cohen_d_effective_size.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on Wed Feb 26 16:48:21 2020
@author: <NAME>
Email: <EMAIL>
"""
import numpy as np
def CohenEffectSize(group1, group2):
""" Calculate Cohen' d
Parameters:
-----------
group1: NumPy array
dimension is n_samples * n_fea... |
dongmengshi/easylearn | eslearn/SSD_classification/ML/lc_pca_svc_firstepisodeunmedicated.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on 2019/11/20
This script is used to training a linear svc model using training data,
and test this model using test data with k-fold cross validation-validation stratage.
@author: <NAME>
"""
import sys
import numpy as np
from sklearn import svm
f... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.