repo_name stringlengths 6 97 | path stringlengths 3 341 | text stringlengths 8 1.02M |
|---|---|---|
dongmengshi/easylearn | eslearn/utils/regression/lc_sCCA.py | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 19:41:55 2018
Please refer to and cite the follow paper:
{Pyrcca: regularized kernel canonical correlation analysis in
python and its applications to neuroimaging}
@author: lenovo
"""
# search path append
import sys
sys.path.append(r'D:\myCodes\LC_MVPA\Python\MVPA_P... |
dongmengshi/easylearn | eslearn/machine_learning/regression/lc_regression_elasticNet.py | # -*- coding: utf-8 -*-
"""
Created on Fri Dec 14 22:15:54 2018
1.以功能连接/动态功能连接矩阵为特征,来进行回归
2.本程序使用的算法为svc(交叉验证)
3.当特征是动态连接时,使用标准差或者均数等来作为特征。也可以自己定义
4.input:
所有人的.mat FC/dFC
5.output:
机器学习的相应结果,以字典形式保存再result中。
@author: <NAME>
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\LC_Machine_learning... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_svc_rfe_fmri_V1.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
import lc_svc_rfe_cv_V2 as lsvc
import pandas as pd
import numpy as np
from lc_read_nii import read_sigleNii_LC
from lc_read_nii import main
import matplotlib.pyplot as plt
from sklearn.metrics import classification_report
from sklearn.metrics import roc_curve, ro... |
dongmengshi/easylearn | eslearn/utils/SelectRawData_Window.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'SelectRawData_Window.ui'
#
# Created by: PyQt5 UI code generator 5.9.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_CopySelectedData(object):
def setupUi(self, CopySelect... |
dongmengshi/easylearn | eslearn/machine_learning/regression/lc_elasticNet_yange.py | # -*- coding: utf-8 -*-
"""
@author: <NAME>
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\LC_Machine_learning-(Python)\Machine_learning\utils')
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\LC_Machine_learning-(Python)\Machine_learning\classfication')
from lc_read_write_Mat import read_mat,write... |
dongmengshi/easylearn | eslearn/visualization/hot_map.py | <filename>eslearn/visualization/hot_map.py
# -*- coding: utf-8 -*-
"""
Created on Sat Nov 17 17:35:09 2018
画热图
@author: lenovo
"""
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
##=====================================================================
# input
corr=pd.read_... |
dongmengshi/easylearn | eslearn/utils/concatExcel.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on Wed Oct 17 19:32:42 2018
此代码用于合并多个excel表格
根据index或者某一列设置为index来合并
@author: lenovo
"""
#import xlrd
import pandas as pd
from pandas import DataFrame
import numpy as np
file = r'D:\myCodes\MVPA_LIChao\MVPA_Python\workstation\0.xlsx'
dataGen = pd.read_... |
dongmengshi/easylearn | eslearn/SSD_classification/Stat/lc_get_fc_cov_cohend.py | # -*- coding: utf-8 -*-
"""
This script is used to do 3 things:
1. Getting the functional connectivity networks for medicated SSD and first episode unmedicated SSD, as well as their matched HC.
2. Extracting sorted covariance for medicated SSD and first episode unmedicated SSD, as well as their matched HC.
3. Get... |
dongmengshi/easylearn | eslearn/utils/lc_scatter.py | <reponame>dongmengshi/easylearn<filename>eslearn/utils/lc_scatter.py
# -*- coding: utf-8 -*-
"""
Created on Tue Jul 3 11:25:00 2018
画散点图和拟合直线
@author: LiChao
"""
import numpy as np
import matplotlib.pyplot as plt
def plot_scatter_plus_fittingLine(x, y, title='polyfitting'):
# 绘制散点
# 直线拟合与绘制
x = np.resha... |
dongmengshi/easylearn | eslearn/SSD_classification/Data_Inspection/lc_subjects_selection.py | # -*- coding: utf-8 -*-
"""
This script is used to select the subjects with good quality (mean FD, percentages of greater FD, rigid motion).
Then matching SZ and HC based on the age, sex and headmotion.
Note that: these 1322 subjects are already selected by rigid motion criteria: one voxel.
All selected subjects's ID w... |
dongmengshi/easylearn | eslearn/utils/lc_cacl_MAD.py | # -*- coding: utf-8 -*-
"""
Created on Mon Aug 6 11:18:08 2018
MAD,median absolute deviation for dimension reduction
MAD=median(|Xi−median(X)|)
refer to {Linked dimensions of psychopathology
and connectivity in functional brain networks}
@author: <NAME>
"""
import numpy as np
def select_features_using_MAD(M, perc=0.... |
dongmengshi/easylearn | eslearn/SSD_classification/Data_Inspection/lc_table_statistics.py | """
This script is designed to perform table statistics
"""
import pandas as pd
import numpy as np
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python')
import os
from Utils.lc_read_write_mat import read_mat
#%% ----------------------------------Our center 550----------... |
dongmengshi/easylearn | eslearn/utils/clustering_for_alff.py | # -*- coding: utf-8 -*-
"""
Created on Tue Dec 11 14:15:10 2018
@author: lenovo
"""
import lc_copy_selected_file_V6 as copy
import sys
import pandas as pd
# files
label_path = r'D:\WorkStation_2018\WorkStation_2018_11_machineLearning_Psychosi_ALFF\Data\new\label.xlsx'
scale_path = r'D:\WorkStation_2018\WorkStation_... |
dongmengshi/easylearn | eslearn/machine_learning/neural_network/gca_classfication.py | import os
import urllib
import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
import torch.utils.data as data
import numpy as np
import scipy.sparse as sp
from zipfile import ZipFile
from sklearn.model_selection import train_test_split
import pickle
import pandas as pd
import t... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/decorator.py | # -*- coding: utf-8 -*-
"""
Created on Mon Apr 29 22:45:12 2019
@author: lenovo
"""
def my_reshape(func):
def wrapper(*args, **kwargs):
args=[ar[1] for ar in args]
return func(*args, **kwargs)
return wrapper
@my_reshape
def say_hello(a,b):
print(a+b)
if __name__ == "__main__":
say... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/classification_test.py | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 15 17:02:33 2020
@author: lenovo
"""
# AdaBoost
from sklearn.linear_model import LogisticRegression
from sklearn.model_selection import cross_val_score
from sklearn.datasets import load_iris
from sklearn.ensemble import AdaBoostClassifier
X, y = load_iris(return_X_y=Tru... |
dongmengshi/easylearn | eslearn/visualization/lc_clusterhotmap.py | <gh_stars>10-100
# utf-8
"""
聚类热图
"""
import matplotlib.pyplot as plt
import seaborn as sns
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')
data.index = data.iloc[:,0]
data = data.iloc[:,2:]
clname = list(data.colu... |
dongmengshi/easylearn | eslearn/utils/read_sav.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on Sun Mar 10 09:26:39 2019
@author: lenovo
"""
import pandas as pd
s = pd.read_excel('02_18大表(REST).xlsx')
s1 = s[['folder', '诊断']]
s_hc = s1[s1['诊断'] == 1]
s_hc['folder'].to_excel('HC.xlsx', header=False, index=False)
s_hc = s1[s1['诊断'] == 2]
s_hc... |
dongmengshi/easylearn | eslearn/utils/fetch_kfoldidx.py | # -*- coding: utf-8 -*-
"""
Created on Wed May 15 22:48:39 2019
@author: lenovo
"""
import numpy as np
from sklearn.model_selection import KFold
def fetch_kFold_Index_for_allLabel(x, y, outer_k, seed):
"""分别从每个label对应的数据中,进行kFole选择,
然后把某个fold的数据组合成一个大的fold数据
"""
uni_y = np.unique(y)
loc_uni_y = [n... |
dongmengshi/easylearn | eslearn/utils/copy_test.py | <filename>eslearn/utils/copy_test.py
# -*- coding: utf-8 -*-
"""
Created on Thu Aug 30 13:05:28 2018:
在版本3的基础上,根据pandas的join方法来求交集
根据从量表中筛选的样本,来获得符合要求的原始数据的路径
数据结构neuroimageDataPath//subject00001//files
也可以是任何的数据结构,只要给定subjName在哪里就行
总之,最后把file复制到其他地方(可以限定某个file)
input:
#1 referencePath:需要复制的被试名字所在text文件(大表中的fol... |
dongmengshi/easylearn | eslearn/stylesheets/PyQt5_stylesheets/PyQt5_stylesheets/pyqt5_style_Dark_rc.py | # -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.11.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x11\xcd\
\x00\
\x00\x6a\x18\x78\x9c\xcd\x1c\x6b\x73\xdb\x36\xf2\x7b\x66\xf2\x1f\
\x50\xe7\x4b\x... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/el_classify_sensitive_person_train_validation.py | # -*- coding: utf-8 -*-
"""
Created on 2020/03/16
------
@author: <NAME>
"""
import os
import numpy as np
import pandas as pd
import xlwt
from sklearn import svm
from sklearn.linear_model import LogisticRegression as lr
from sklearn.linear_model import LassoCV, Lasso
from sklearn.externals import joblib
from sklearn.l... |
dongmengshi/easylearn | eslearn/SSD_classification/Data_Inspection/lc_preprocess_for_UCLA.py | <gh_stars>1-10
"""
This script is used to transform the UCLA dataset into .npy format.
1.Transform the .mat files to one .npy file
2. Give labels to each subject, concatenate at the first column
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python')
import numpy as np ... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_svc_oneVsOne.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 25 14:45:04 2018
one vs one multi-class classfication
@author: lenovo
"""
from sklearn.svm import SVC
from sklearn import datasets
#
X,y=datasets.make_classification(n_samples=1000, n_features=200, n_informative=2, n_redundant=2,
n_repe... |
dongmengshi/easylearn | eslearn/utils/lc_resample_v1.py | # -*- coding: utf-8 -*-
"""
Created on Wed Jun 5 10:45:52 2019
@author: <NAME>
"""
import SimpleITK as sitk
import numpy as np
import os
from lc_resample_base import ResampleImg
class ResampleImgV1(ResampleImg):
"""
Resample a 3D old_image to given new spacing
The new voxel spacing will determine the n... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_rfe_svc_given_trainingdata_testingdata.py | # -*- coding: utf-8 -*-
"""
Created on Fri Apr 12 16:25:57 2019
@author: <NAME>
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python')
sys.path.append(r'F:\黎超\dynamicFC\Code\lc_rsfmri_tools_python-master\Machine_learning\classfication')
sys.path.append(r'D:\My_Codes\LC... |
dongmengshi/easylearn | eslearn/developer/class_template.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""This module is used to preprocess data.
Created on Wed Jul 4 13:57:15 2018
@author: <NAME>
Email:<EMAIL>
GitHub account name: lichao312214129
Institution (company): Brain Function Research Section, The First Affiliated Hospital of China Medical University, Sh... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_svc_rfe_cv_V3.py | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed sel.decision 5 21:12:49 2018
@author: <NAME>
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python')
import matplotlib.pyplot as plt
from sklearn.model_selection import KFold
import pandas as pd
import numpy as n... |
dongmengshi/easylearn | eslearn/utils/lc_indentify_repeat_subjects.py | <reponame>dongmengshi/easylearn<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Thu Sep 6 18:54:37 2018
找到与subjects重复的ID
@author: lenovo
"""
#
import pandas as pd
from selectSubjID_inScale import loadExcel
from selectSubjID_inScale import selMain
def indentify_repeat_subjects_pairs(file, uid_header):
"""
... |
dongmengshi/easylearn | eslearn/machine_learning/test/GCNNCourseCodes/enzymes_GCNN.py | from __future__ import division
from __future__ import print_function
import time
import tensorflow as tf
from utils import *
from models import GCNN
from tensorflow import set_random_seed
import matplotlib.pyplot as plt
import scipy.io as sio
import scipy
from scipy.sparse import csr_matrix, lil_matrix
import numpy ... |
dongmengshi/easylearn | eslearn/GUI/easylearn_data_loading_gui.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'D:\My_Codes\easylearn-fmri\eslearn\gui_test\easylearn_data_loading_gui.ui'
#
# Created by: PyQt5 UI code generator 5.11.3
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtG... |
dongmengshi/easylearn | eslearn/utils/lc_fetch_cov_according_folder.py | # -*- coding: utf-8 -*-
"""
Created on Thu Jan 3 23:04:33 2019
当给定了影像数据和量表时,如果量表数据包括而且大于影像数据时,我们需要从中提取与影像数据匹配的部分
@author: lenovo
"""
import sys
import os
cpwd = __file__
root = os.path.dirname(os.path.dirname(__file__))
sys.path.append(root)
print(f'##{root}')
import pandas as pd
import Utils.lc_copy_selected_file_V6 ... |
dongmengshi/easylearn | eslearn/utils/lc_addsubjID.py | <gh_stars>10-100
# -*- coding: utf-8 -*-
"""
Created on Sat May 18 15:50:17 2019
@author: lenovo
"""
import os
class Input():
"""
process input
"""
def __init__(sel):
# cwd = os.path.dirname(__file__)
cwd = os.getcwd()
input_path = os.path.join(cwd, "input.txt")
if not... |
dongmengshi/easylearn | eslearn/utils/lc_resample_base.py | <reponame>dongmengshi/easylearn
# -*- coding: utf-8 -*-
"""
Created on Wed Jun 5 10:45:52 2019
@author: lenovo
"""
from SimpleITK import ReadImage, ImageSeriesReader, GetArrayFromImage
import SimpleITK as sitk
import numpy as np
class ResampleImg():
"""
Resample a 3D old_image to given new spacing
The ne... |
dongmengshi/easylearn | eslearn/GUI/dec.py | <filename>eslearn/GUI/dec.py
from sklearn.datasets import make_friedman1
from sklearn.feature_selection import RFECV
from sklearn.svm import SVR
from sklearn.linear_model import LinearRegression
from sklearn import linear_model
X, y = make_friedman1(n_samples=50, n_features=10, random_state=0)
estimator = SVR(kernel="... |
dongmengshi/easylearn | eslearn/visualization/dALFF_cirBar.py | <reponame>dongmengshi/easylearn<filename>eslearn/visualization/dALFF_cirBar.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 13 20:55:51 2018
@author: lenovo
"""
import sys
sys.path.append(r'D:\myCodes\MVPA_LIChao\MVPA_Python\MVPA\utils')
from lc_read_write_Mat import read_mat
import numpy as np
import pandas as pd
... |
dongmengshi/easylearn | eslearn/utils/lc_cal_headmotion.py | <reponame>dongmengshi/easylearn<gh_stars>10-100
# -*- coding: utf-8 -*-
"""
extract mean Power mean FD
Combine all subjects' mean FD to one excel file
"""
import numpy as np
import pandas as pd
import os
import re
# class GetPath():
# """get all files path
# """
# def __init__(sel,
# root... |
dongmengshi/easylearn | eslearn/machine_learning/test/test_@.py | <reponame>dongmengshi/easylearn<filename>eslearn/machine_learning/test/test_@.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed Jul 11 15:44:22 2018
@author: lenovo
"""
def funcA(A):
print("function A")
def funcB(B):
# print(B(2))
print("function B")
@funcB
def func(c):
print("function C")
... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_svc_rfe_cv_V2.py | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Wed self.decision 5 21:12:49 2018
1、对特征进行归一化、主成分降维(可选)后,喂入SVC中进行训练,然后用此model对测试集进行预测
2、采取K-fold的策略
input:
k=3:k-fold
step=0.1:rfe step
num_jobs=1: parallel
scale_method='StandardScaler':standardization method
... |
dongmengshi/easylearn | eslearn/utils/lc_move_all_subj_roi_to_root_roi_folder_radiomics.py | <reponame>dongmengshi/easylearn
# utf-8
"""
Move or copy roi folder that saving in each subject's folder to the same root folder named ROI$i
"""
import os
import numpy as np
import shutil
def move_roi_to_root_allsubj(root_subjfolder, outpath):
"""
Move roi to root folder for one subject
"""
all_subj... |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_rfe_svc_given_trandtedata_excel.py | <gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 10 10:14:01 2019
@author: lenovo
"""
import sys
import os
cpwd = __file__
root = os.path.dirname(os.path.dirname(os.path.dirname(__file__)))
sys.path.append(root)
import numpy as np
import pandas as pd
from sklearn.preprocessing import LabelEncoder
from Uti... |
dongmengshi/easylearn | eslearn/visualization/lc_hotMap.py | # -*- coding: utf-8 -*-
"""
Created on Sat Nov 17 17:35:09 2018
plot hot map
@author: <NAME>
"""
import sys
sys.path.append(r'D:\My_Codes\LC_Machine_Learning\lc_rsfmri_tools\lc_rsfmri_tools_python')
import statsmodels.stats.multitest as mlt
import seaborn as sns
import matplotlib.pyplot as plt
import numpy as np
impo... |
dongmengshi/easylearn | eslearn/visualization/lc_radarplot_pychar.py | <filename>eslearn/visualization/lc_radarplot_pychar.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 09:59:28 2018
@author: lenovo
"""
from pyecharts import Polar,Radar
#radius =['周一', '周二', '周三', '周四', '周五', '周六', '周日']
#polar =Polar("极坐标系-堆叠柱状图示例", width=1200, height=600)
#polar.add("", [1, 2, 3, 4, 3, 5, 1],... |
dongmengshi/easylearn | eslearn/utils/lc_download_fcp1000.py |
urllib.request.urlretrieve('https://fcp-indi.s3.amazonaws.com/data/Projects/FCON1000/AnnArbor_a/sourcedata/sub-04111/anat/sub-04111_T1w.nii.gz',
r'F:\Data\ASD\Outputs\cpac\nofilt_noglobal\reho\test1.tar')
import numpy as np
d = np.load(r'F:\Data\Caltech_0051456_rois_cc200.1D') |
dongmengshi/easylearn | eslearn/utils/lc_statForPermutationTest.py | # -*- coding: utf-8 -*-
"""
Created on Wed Aug 1 09:29:20 2018
statistical analysis for permutation test
@author: lenovo
"""
from lc_selectFile_permSVC import selectFile
from lc_read_write_Mat import read_mat
import pandas as pd
#
def stat():
# statistic
pass
def resultFusion(rootPath=r'D:\myCodes\LC_MVPA\... |
dongmengshi/easylearn | eslearn/machine_learning/test/cv_test.py | <reponame>dongmengshi/easylearn<filename>eslearn/machine_learning/test/cv_test.py<gh_stars>0
# -*- coding: utf-8 -*-
"""
Created on Sun Apr 12 11:47:37 2020
@author: lenovo
"""
import numpy as np
from sklearn.model_selection import train_test_split
from sklearn import datasets
from sklearn import svm
from sklearn impo... |
dongmengshi/easylearn | eslearn/visualization/lc_violinplot.py | <filename>eslearn/visualization/lc_violinplot.py
# -*- coding: utf-8 -*-
"""
Created on Tue Nov 20 16:03:39 2018
小提琴图
当我们的数据是num_subj*num_var,且有几个诊断组时,我们一般希望把var name作为x,把var value作为y,把诊断组作为hue
来做小提琴图,以便于观察每个var的组间差异。
此时,用于sns的特殊性,我们要将数据变换未长列的形式。
行数目为:num_subj*num_var。列数目=3,分别是hue,x以及y
input:
data_path=r'D:\others... |
dongmengshi/easylearn | eslearn/utils/__init__.py | # print("imported utils\n") |
dongmengshi/easylearn | eslearn/machine_learning/classfication/lc_pca_svc_pooling_3groups.py | <reponame>dongmengshi/easylearn<filename>eslearn/machine_learning/classfication/lc_pca_svc_pooling_3groups.py
# -*- coding: utf-8 -*-
"""
Created on 2019/11/20
All datasets were concatenate into one single dataset, then using cross-validation strategy.
This script is used to training a linear svc model using a given t... |
dongmengshi/easylearn | eslearn/GUI/thread_test_1.py | import sys,time
from PyQt5.QtWidgets import QWidget,QPushButton,QApplication,QListWidget,QGridLayout
class WinForm(QWidget):
def __init__(self,parent=None):
super(WinForm, self).__init__(parent)
#设置标题与布局方式
self.setWindowTitle('实时刷新界面的例子')
layout=QGridLayout()
#实例化列表控件与按钮控件
... |
dongmengshi/easylearn | eslearn/utils/regression/lc_calc_explained_variance_sCCA.py | # -*- coding: utf-8 -*-
"""
Created on Sat Aug 11 20:31:13 2018
revised the rcca
this code is used to evaluate the sCCA model
@author: lenovo
"""
# search path append
import sys
sys.path.append(r'D:\Github_Related\Github_Code\sCCA_Python\pyrcca-master')
from rcca import predict
import numpy as np
def lc_compute_ev(v... |
dongmengshi/easylearn | eslearn/utils/test.py | <reponame>dongmengshi/easylearn<filename>eslearn/utils/test.py
# -*- coding: utf-8 -*-
"""
Created on Tue Aug 28 15:07:49 2018
@author: lenovo
"""
from lc_svc_oneVsRest import oneVsRest
import numpy as np
import pandas as pd
from lc_read_write_Mat import read_mat
import sys
sys.path.append(r'D:\myCodes\LC_MVPA\Python\... |
striderdu/xmind2csv | xmind2csv.py | from xmindparser import xmind_to_dict
import uuid
import csv
# dfs function
def s(a, parent):
for i in a:
for key in i:
if isinstance(i[key], str):
data = [i[key], uuid.uuid3(uuid.NAMESPACE_DNS, i[key]), uuid.uuid3(uuid.NAMESPACE_DNS, parent), CLASSIFYING_SYSTEM, \
... |
MertYagmur/fun-python-projects | wordle.py | <reponame>MertYagmur/fun-python-projects<filename>wordle.py
"""
NOT COMPLETE
There's a bug that's yet to be solved.
More functionality will be added.
The program doesn't check whether user guesses are actual English words or not unlike the original game.
"""
# Try debug with word "wipes" and try "sinus"
from random_... |
MertYagmur/fun-python-projects | band_name_generator.py | from random import random
import wikipedia as wiki
random_article = wiki.random(pages=1)
# If it starts with a year, draw another article
if random_article[0:3].isnumeric():
random_article = wiki.random(pages=1)
# If it's a list, remove "List of"
if (random_article.startswith("List of")):
random_article = r... |
linuxluser/ugtd | ugtd.py | #!/usr/bin/python2.7
# -*- coding: utf-8 -*-
"""ncurses Python application for "Getting Things Done".
[Methodology - Getting Things Done]
[Method - Todo.txt]
Todo.txt is a text data format designed to store personal task data. It follows
philosophies of simplicity, portability and functionality.
More details here... |
rishabhjainfinal/ASCII_video | video_to_ascii.py | from image_to_ascii import image_to_ascii
import cv2,os,numpy as np
import concurrent.futures
from threading import Thread
from time import perf_counter,sleep as nap
import argparse
# may add sound later .\
class ascii_video :
""" working of class
extract image and yield
convert into asc... |
rishabhjainfinal/ASCII_video | image_to_ascii.py | <reponame>rishabhjainfinal/ASCII_video<gh_stars>0
import cv2
import numpy as np
import os,argparse
from time import perf_counter
# when saving in the fiel replace . from space
class image_to_ascii(object):
def __init__(self,for_command_line = False,pbs=10):
# pbs = pixle_block_size
self.pbs = pbs # pixle_block_siz... |
rmwthorne/covid-repr-seqs | get_representative.py | <gh_stars>0
"""Usage: get_representative.py <pangolin_output> <embl_seqs> [-o OUTFILE]
-o OUTFILE Output file name [default: repr_seqs.tsv]
"""
import csv
from docopt import docopt
import pandas as pd
def main(args):
pangolin_output = args.get('<pangolin_output>', 'lineages.csv')
embl_seqs = args.get('<embl... |
ritaaylward/raec | plot_ctd_data_pm.py | <reponame>ritaaylward/raec
"""
Code to plot data from the Canadian CTD text file.
Goal is the make a plot of temperature vs. depth and save it as a png
in the output directory.
"""
# imports
import sys, os
sys.path.append(os.path.abspath('shared'))
import my_module as mymod
import numpy as np
import matplotlib.pyplo... |
ritaaylward/raec | test_my_module2.py | """
Code to test my_module.py.
Try dir(mymod) and help(mymod.make_dir) and see what you get. The results
are very much like regular module.
"""
#imports
import sys, os
# local imports
from shared import my_module as mymod
from importlib import reload
reload(mymod)
# use a method in the module
x = mymod.square_my_n... |
ritaaylward/raec | test_my_module.py | """
Code to test my_module.py.
Try dir(mymod) and help(mymod.make_dir) and see what you get. The results
are very much like regular module.
"""
#imports
import sys, os
# local imports
pth = os.path.abspath('shared') #this method returns the pathname to the path passed as a parameter to this function.
print('\nAddin... |
ritaaylward/raec | plot_ctd_data.py | <reponame>ritaaylward/raec
"""
Code to plot data from the Canadian CTD text file.
Goal is the make a plot of temperature vs. depth and save it as a png
in the output directory.
"""
# imports
import sys, os
sys.path.append(os.path.abspath('shared'))
import my_module as mymod
import numpy as np
import matplotlib.pyplo... |
ritaaylward/raec | python_basics.py | """
This is a typical way to format a program.
"""
# always do imports first
import numpy as np
import matplotlib.pyplot as plt
# now make some variable
x = np.linspace(0,10,100)
y = x**2
# plotting to the screen
# first get rid of old figures
#plot.close('all')
#initialize a figure object
fig = plt.figure(figsize... |
ritaaylward/raec | test1.py | # experimenting with a variable and a list
a = [1 , 3 ,4 , 7]
print(a)
b = "string"
print(b)
d = "this is a sentence"
|
ritaaylward/raec | numpy_argparse_hw.py | <reponame>ritaaylward/raec
import sys, os
import numpy as np
import pickle
import argparse
# local imports
from shared import my_module as mymod
from importlib import reload
reload(mymod)
'-----------------------------------------------------------------------------------'
# Make some arrays
arr_1 = np.array([45, 6... |
WulfH/Pattern | Test3.py | <reponame>WulfH/Pattern
from Pattern import Pattern
import numpy as np
import matplotlib.pyplot as plt
test=Pattern(5,5)
test.set(np.array([[0,0,0,5,0],[5,0,0,0,0],[5,5,0,5,5],[0,5,0,0,5],[0,5,0,5,0]]))
A=test.get()
B=test.autocor()
test.mirror(1)
C=test.get()
D=test.autocor()
test.evolve("mean")
E=test.get()
F=test... |
WulfH/Pattern | Test1.py | from Pattern import Pattern
import matplotlib.pyplot as plt
test=Pattern(51,51)
test.create("rand",10)
test.mirror(0)
test.mirror(1)
A=test.get()
test.evolve("cluster")
B=test.get()
test.evolve("cluster")
C=test.get()
test.evolve("cluster")
D=test.get()
test.evolve("cluster")
E=test.get()
test.evolve("cluster")
F=test... |
WulfH/Pattern | Test2.py | <reponame>WulfH/Pattern<gh_stars>0
from Pattern import Pattern
import matplotlib.pyplot as plt
test=Pattern(20,20)
test.create("chess",2)
A=test.get()
B=test.autocor()
test.create("rand",10)
C=test.get()
D=test.autocor()
test.evolve("cluster")
test.evolve("cluster")
test.evolve("cluster")
E=test.get()
F=test.autocor... |
WulfH/Pattern | Pattern.py | <filename>Pattern.py
import numpy as np
import matplotlib.pyplot as plt
from scipy import stats
import copy
class Pattern:
def __init__(self, x, y):
self.pat=np.zeros((x,y))
# self.x=x; self.y=y;
def get(self):
return copy.copy(self.pat)
def set(self, A):
self.pat=copy.copy(A)
def map(self):
plt.imshow(se... |
dimitrip13/CVS_Vaccine_Finder | cvs_check.py | <filename>cvs_check.py
"""
Published on Mar 30, 2021
@authors: <NAME> and <NAME>
"""
# ----------------------------------------------------------------------------------------------------------------------
"""
_ _ _____ ______ _____ __ __ _____ _____ ____ _ ______ ____... |
ZweiChen0328/weiqi | client.py | import socket
HOST = '127.0.0.1'
PORT = 8000
clientMessage = 'Hello!'
client = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
client.connect((HOST, PORT))
client.sendall(clientMessage.encode())
serverMessage = str(client.recv(1024), encoding='utf-8')
print('Server:', serverMessage)
client.close() |
ZweiChen0328/weiqi | db.py | <filename>db.py<gh_stars>1-10
import sqlite3 #匯入sqlite3
cx = sqlite3.connect('./train.db') #建立資料庫,如果資料庫已經存在,則連結資料庫;如果資料庫不存在,則先建立資料庫,再連結該資料庫。
cu = cx.cursor() #定義一個遊標,以便獲得查詢物件。
cu.execute('create table if not exists train4 (Chinese text,English text)') #建立表
fr = open('food.txt',encoding="utf-8") #開啟要... |
ZweiChen0328/weiqi | weiqi_online_2.py | <gh_stars>1-10
#!/usr/bin/python3
# 使用Python内建GUI模組tkinter
from tkinter import *
# ttk覆寫tkinter部分物件,ttk對tkinter進行了優化
from tkinter.ttk import *
# deepcopy需要用到copy模組
from MyOwnPeer2PeerNode import MyOwnPeer2PeerNode
import copy
import tkinter.messagebox
import sys
import time
import threading
sys.path.insert(0, '..') ... |
ZweiChen0328/weiqi | server.py | # -*- coding: utf-8 -*-
import socket
HOST = '127.0.0.1'
PORT = 8000
server = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
server.bind((HOST, PORT))
server.listen(10)
while True:
conn, addr = server.accept()
clientMessage = str(conn.recv(1024), encoding='utf-8')
print('Client message is:', clientMess... |
visor2020/ssd.pytorch | demo/video.py | <reponame>visor2020/ssd.pytorch
from __future__ import print_function
import torch
from torch.autograd import Variable
import numpy as np
import cv2
import time
from imutils.video import FPS, WebcamVideoStream
import os
import argparse
parser = argparse.ArgumentParser(description='Single Shot MultiBox Detection')
pars... |
KFlaga/Match4 | Match4Client/Main.py | <gh_stars>0
import sys, random
from PyQt5.QtWidgets import QMainWindow, QFrame, QApplication, QDialog
from PyQt5.QtCore import Qt, QBasicTimer, pyqtSignal, pyqtSlot
from PyQt5 import QtCore
import ui.MainWindow
from MenuScreen import MenuScreen
from GameSettings import GameSettings, Player, PlayerType
from GameSetting... |
KFlaga/Match4 | Match4Client/MenuScreen.py | <filename>Match4Client/MenuScreen.py
from PyQt5.QtWidgets import QFrame, QWidget
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
from GameSettings import GameSettings, PlayerColor, PlayerType, Player
import ui.MenuFrame
class MenuScreen(QWidget, ui.MenuFrame.Ui_mainFrame):
startGame = pyqtSignal(GameSetti... |
KFlaga/Match4 | Match4Client/GameSettingsDialog.py | from PyQt5.QtWidgets import QFrame, QWidget, QDialog
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
from GameSettings import GameSettings, PlayerColor, PlayerType, Player
import ui.GameSettingsDialog
class GameSettingsDialog(QDialog, ui.GameSettingsDialog.Ui_Dialog):
settingsAccepted = pyqtSignal(GameSet... |
KFlaga/Match4 | Match4Client/ui/GameSettingsDialog.py | <gh_stars>0
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GameSettingsDialog.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_Dialog(object):
def setupUi(self, Dialog, addDif... |
KFlaga/Match4 | Match4Client/ui/GameFrame.py | # -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GameFrame.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_GameFrame(object):
def setupUi(self, game_frame, board_frame):
... |
KFlaga/Match4 | Match4Client/BoardColumn.py | <gh_stars>0
from BoardField import BoardField
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject
from ui.BoardColumn import Ui_BoardColumn
class BoardColumn(QtWidgets.QPushButton, Ui_BoardColumn):
mouseEnter = pyqtSignal(int)
mouseLeave = pyqtSignal(int)
mous... |
KFlaga/Match4 | Match4Client/GameBoard.py | from BoardColumn import BoardColumn
from ui.GameBoard import Ui_GameBoard
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject
from PyQt5.QtWidgets import QFrame
class GameBoard(QFrame, Ui_GameBoard):
columnHover = pyqtSignal(int)
columnClicked = pyqtSignal(int)
... |
KFlaga/Match4 | Match4Client/ui/MenuFrame.py | <reponame>KFlaga/Match4
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'MenuFrame.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_mainFrame(object):
def setupUi(self, mainF... |
KFlaga/Match4 | Match4Client/ServerConnector.py | <filename>Match4Client/ServerConnector.py
import match4server
from Messages import Message, MessageType
import Messages
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot, QTimer
class ServerConnector(QObject):
messageReceived = pyqtSignal(Message)
def __init__(self):
super(ServerConnector, self)... |
KFlaga/Match4 | Match4Client/BoardField.py | from ui.BoardField import Ui_BoardField
from PyQt5 import QtCore, QtGui, QtWidgets
from PyQt5.QtCore import pyqtSignal, pyqtSlot, QObject
from GameSettings import PlayerColor
class BoardField(QtWidgets.QPushButton, Ui_BoardField):
mouseEnter = pyqtSignal(int)
mouseLeave = pyqtSignal(int)
mousePressed = py... |
KFlaga/Match4 | Match4Client/ui/GameBoard.py | <reponame>KFlaga/Match4
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'GameBoard.ui'
#
# Created by: PyQt5 UI code generator 5.8.2
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_GameBoard(object):
def setupUi(self, boar... |
KFlaga/Match4 | Match4Server/build_python.py | <gh_stars>0
from distutils.core import setup, Extension
import fnmatch
import os
source_files = [];
for file in os.listdir('.'):
if fnmatch.fnmatch(file, '*.cpp'):
source_files.append(file)
module1 = Extension('match4server',
sources = source_files)
setup (name = 'Match4ServerModule',... |
KFlaga/Match4 | Match4Client/GameSettings.py | <gh_stars>0
from enum import Enum
class PlayerColor(Enum):
Red = 1
Yellow = 2
NoPlayer = 0
class PlayerType(Enum):
Human = 0
Cpu = 1
class Player:
def __init__(self, number, type, color):
self.number = number
self.type = type
self.color = color
self.difficul... |
KFlaga/Match4 | Match4Client/Messages.py | <filename>Match4Client/Messages.py
from enum import Enum
from PyQt5.QtCore import QObject, pyqtSlot, pyqtSignal
class MessageType(Enum):
Unknown = 'Unknown'
NoMessage = 'NoMessage'
ReqHover = 'ReqHover'
ReqSelect = 'ReqSelect'
ReqSettings = 'ReqSetGameSettings'
ReqEndGame = 'ReqEndGame'
Re... |
KFlaga/Match4 | Match4Client/ui/BoardField.py | from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_BoardField(object):
def setupUi(self, field_button, field_number, column_number):
field_button.setEnabled(True)
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.MinimumExpanding, QtWidgets.QSizePolicy.Minimum)
sizePolicy.setHorizo... |
KFlaga/Match4 | Match4Client/ui/BoardColumn.py | from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_BoardColumn(object):
def setupUi(self, column_button, column_number):
column_button.setObjectName('column_{0}'.format(column_number))
sizePolicy = QtWidgets.QSizePolicy(QtWidgets.QSizePolicy.Fixed, QtWidgets.QSizePolicy.Fixed)
sizePolicy.... |
KFlaga/Match4 | Match4Client/ui/resources.py | <filename>Match4Client/ui/resources.py
# -*- coding: utf-8 -*-
# Resource object code
#
# Created by: The Resource Compiler for PyQt5 (Qt v5.6.0)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x05\xd4\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x... |
KFlaga/Match4 | Match4Client/GameScreen.py | <filename>Match4Client/GameScreen.py
from PyQt5.QtWidgets import QFrame, QWidget
from PyQt5.QtCore import QObject, pyqtSignal, pyqtSlot
from GameSettings import GameSettings, PlayerColor, PlayerType, Player
from PyQt5 import QtGui
import Messages
from Messages import Message, MessageType
import ui.GameFrame
import ui.r... |
Sarah-Marion/Password_Locker-ultimate- | user_data_test.py | import unittest
from user_data import User
class user_test(unittest.TestCase):
"""
Test class that defines test cases for the user_data class behaviours
Args:
unittest.Testcase: TestCase class that helps in creating test cases
"""
def setUp(self):
"""
set up method to run e... |
Sarah-Marion/Password_Locker-ultimate- | credential.py | import pyperclip
import string
import random
class Credential:
"""
class that generates new instances of user credentials
"""
def __init__(self, profile_name, display_profiles = None, profile_username = None, profile_email = None, profile_password = True):
self.profile_name = profile_name
... |
Sarah-Marion/Password_Locker-ultimate- | credential_test.py | <filename>credential_test.py
import unittest
import pyperclip
from credential import Credential
class credential_test(unittest.TestCase):
"""
Test class that defines test cases for the credential class behaviours
Args:
unittest.TestCase: TestCase class that helps in creating test cases
"""
... |
Sarah-Marion/Password_Locker-ultimate- | run.py | <reponame>Sarah-Marion/Password_Locker-ultimate-
#!/usr/bin/env python3.6
import sys
import os
import pyperclip
import string
import random
from credential import Credential
from user_data import User
from pyfiglet import figlet_format
from termcolor import colored, cprint
from colorama import init
init(strip=not sys.... |
Sarah-Marion/Password_Locker-ultimate- | user_data.py | <filename>user_data.py
class User:
"""
class that generates new instances of users
"""
def __init__(self, username, password):
self.username = username
self.password = password
user_list = []
def save_user(self):
"""
save_user method saves user obj... |
GenoM87/hubmap | src/models/scheduler.py | import torch
def make_scheduler(optimizer, cfg, train_loader):
if cfg.SOLVER.SCHEDULER == 'CosineAnnealingWarmRestarts':
number_of_iteration_per_epoch = len(train_loader)
learning_rate_step_size = cfg.SOLVER.SCHEDULER_COS_CPOCH * number_of_iteration_per_epoch
scheduler = getattr(t... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.