blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
8f173b5f46b88b4031404260331da5453eeac29f
hschhh666/ScenePrediction-pytorch
/preWork/LearnCountOfEveryBehaviorModel.py
UTF-8
5,517
2.765625
3
[]
no_license
# -*- coding: utf-8 -*- ''' 程序说明:一个简单的小实验,为了验证在给定行为模式数量的前提下,网络是否具备识别每种行为模式数量的能力。结论是可以的 输入:状态地图中的行人占有栅格地图 输出:n维向量,n大小等于行为模式的个数,每一维度表示当前输入下这种行为模式上有多少人 误差为MSE,训练集误差可以做到0.001级别,测试集误差在0.8附近,可以认为网络具备学习行为模式上数量的能力。 ''' import numpy as np from cv2 import cv2 import torch from torch.utils.data import Dataset, DataLoader import...
true
4ab79826d67abd697e0bf22ebe74d7014dafaf1e
Mohammed-Shoaib/Coding-Problems
/HackerRank/Python/Medium/M0021.py
UTF-8
365
4.09375
4
[ "MIT" ]
permissive
# Problem Statement: https://www.hackerrank.com/challenges/words-score/problem def is_vowel(letter): return letter in ['a', 'e', 'i', 'o', 'u', 'y'] def score_words(words): score = 0 for word in words: num_vowels = 0 for letter in word: if is_vowel(letter): num_vowels += 1 if num_vowels % 2 == 0: s...
true
e46fcc02cdf15ed9dae428b202b8af669d908b82
LaughLax/Advent-of-Code
/py/2018/13.py
UTF-8
5,359
3.390625
3
[]
no_license
import time DIR_RIGHT = 0 DIR_UP = 1 DIR_LEFT = 2 DIR_DOWN = 3 class AdventOfCode: def __init__(self, filename): with open(filename) as f: self.input = f.read().splitlines() def make_grid(self): grid = Grid(len(self.input[0]), len(self.input)) for y, lin...
true
fff5b76d5272c292496130a7cbf623f34ab12951
jonfairbanks/image-sorter
/main.py
UTF-8
5,736
2.59375
3
[ "MIT" ]
permissive
#!/usr/bin/env python from PIL import Image import os import hashlib import sys import shutil import cv2 import numpy as np from tqdm import tqdm import re import argparse parser = argparse.ArgumentParser(description='Sort Duplicate Images in Bulk') parser.add_argument("-v", "--verbose", help="Increase output verbosi...
true
ad78c05f5077ce8de5e819c628ebfe0ee1cbdcf3
bheki-maenetja/small-projects-py
/vowel-remover/vowel.py
UTF-8
761
4.375
4
[]
no_license
# Version 1 def removeVowel(): string = input("Enter something: ") vowels = ["a", "e", "i", "o", "u"] newString = "" counter = 0 while counter < len(string): if string[counter].lower() not in vowels: newString = newString + string[counter] counter = counter + 1 print(...
true
16b1bfd00ffe31cc950a68a6aef3ea621c82fea8
drisss/2016
/code/HackaPyth/TSVreader.py
UTF-8
2,944
2.734375
3
[]
no_license
#!/usr/bin/python # coding: utf-8 import os.path, codecs, io from Tweet import Tweet from Team import Team from Event import Event from Preprocess import token_name, get_players_in_tweet, get_teams_in_tweet, remove_accents from Player import Player __author__ = 'driss' def containTeam(teams, team_name): is_in ...
true
3d82923daf81e04808b04075e13c34743c8ade0d
JWseop/Algorithm
/Programmers/Park_walking.py
UTF-8
1,156
3.578125
4
[]
no_license
# https://school.programmers.co.kr/learn/courses/30/lessons/172928 # Lv.1 # 문제: 공원 걷기 def find_start_point(park): for h, row in enumerate(park): for w, cell in enumerate(row): if cell == 'S': return h, w def is_valid_position(park, h, w): H, W = len(park), len(park[0]) ...
true
63f57b4e33354da4ecf4032553eb79a499f93f22
HalAndBender/MathProblems
/MST210_TMA05_q4a.py
UTF-8
2,118
3.59375
4
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 21 14:38:45 2018 Open University, MST210, TMA05 Question 4 (a), Sketching a perdiodic function @author: stephangoldberg """ import numpy as np import matplotlib.pyplot as plt # define the period of f(t) tau = 2*np.pi # define the range of each per...
true
ec6c83742bc13a01234a7cd9c4e0622f5b25d255
JorgeTranin/Python_Curso_Em_Video
/Exercicios Curso Em Video Mundo 3/Exe_090.py
UTF-8
554
4.1875
4
[ "MIT" ]
permissive
''' Exercício Python 090: Faça um programa que leia nome e média de um aluno, guardando também a situação em um dicionário. No final, mostre o conteúdo da estrutura na tela. ''' ficha = {} ficha['nome'] = str(input('Nome do anluno: ')) ficha['media'] = float(input(f'Media do aluno {ficha["nome"]}: ')) if ficha['me...
true
ba8d8c5cf945c1f438db89cfb5d20c12937a4052
mlburgos/concept-practice
/code_challanges/interview_cake/number_16.py
UTF-8
2,419
2.78125
3
[]
no_license
cake_tuples = [(7, 160), (3, 90), (2, 15)] cake_tuples2 = [(7, 160), (3, 90), (2, 15), (1, 50)] cake_tuples3 = [(7, 160), (3, 90), (2, 15), (0, 0)] cake_tuples4 = [(3, 40), (5, 70)] capacity = 20 ################################################################################ # Attmept 1 # good try, but fials with c...
true
c7ab434ed448f2b6d52450bbcc0edef1c292ea7b
isv1nd/async_proj
/functional_tests/tests/fixtures/resources.py
UTF-8
5,203
2.546875
3
[]
no_license
import typing import pytest from hamcrest import * from hamcrest.core.matcher import Matcher from .data_generators import * from .base import Client class BaseResource: base_url = "" # type: str data_generator = None # type: typing.Union[factory.Factory, None] def __init__(self, client): self....
true
91239398d14486da1b094feedebeb558db8636a2
mlcruz/SimpleGraphNoSQL
/Tabela.py
UTF-8
19,056
3.25
3
[]
no_license
#xlrd é uma biblioteca para facilitar o parsing de tabelas xls do excel import xlrd #Default dics são dicionarios que ao receber uma chave que não existe, cria a chave a atribui um valor padrão from collections import defaultdict #Suporte para expressões regulares import regex #Para normalizar para NFKD import unico...
true
52e137cf2c9f54f42e19bbc8f1fb3618f01bb224
Izio91/DigitalFilters
/SharpeningFilter.py
UTF-8
2,905
3.015625
3
[ "MIT" ]
permissive
import numpy as np from DigitalFilter import Filter import cv2 from Utilities import show_image class Sharpening(Filter): __kernel = None def __init__(self): size = 3 self.set_height(size) self.set_width(size) self.make_kernel() def make_kernel(self): self.__kernel...
true
3e5ce595f43c8803ac8b354af43063177d5bf377
alexabrahams/online-portfolio-selection
/olps/strategies/correlation_driven_log_optimal_strategy.py
UTF-8
1,828
2.671875
3
[]
no_license
from .strategy import Strategy from ..datasources.correlation_driven_datasource import CorrelationDrivenDataSource import math import numpy as np class CorrelationDrivenLogStrategy(Strategy): def update_weights(self, market_data: CorrelationDrivenDataSource) -> None: market_data.sample_selec...
true
d32b4b21f2320dc0a1429480713176a8274f368c
christineiym/python-api-sidequest
/sandbox_christine/random_code_snippets/init_with_cgi.py
UTF-8
2,439
3.140625
3
[]
no_license
"""Running website as package. To run the website after installing requirements: 1. export FLASK_APP=draft_product.unc_abbreviations - Alternatively, do the following: 1) cd draft_product (cd stands for change directory, so this navigates you to the appropriate folder) 2) export FLASK_APP=unc_abbreviations...
true
148845c53b0b35a37f1464075f3ee1a8d9ae4738
sorgerlab/indra
/indra/databases/efo_client.py
UTF-8
863
2.59375
3
[ "BSD-2-Clause", "BSD-2-Clause-Views" ]
permissive
"""A client to EFO.""" from indra.databases.obo_client import OboClient _client = OboClient(prefix='efo') def get_efo_name_from_efo_id(efo_id): """Return the EFO name corresponding to the given EFO ID. Parameters ---------- efo_id : str The EFO identifier to be converted. Example: "0005557"...
true
173488ca7fe9f8cfa75ff7b6b01d93a2cbbb4f41
MichaelKim0407/typed-environ
/typed_environ/_val.py
UTF-8
677
3
3
[ "MIT" ]
permissive
import json as _json from distutils.util import strtobool as _strtobool class Value(str): def __bool__(self): return bool(_strtobool(self)) def __nonzero__(self): # pragma: no cover # Python 2 return self.__bool__() def __json(self): val = _json.loads(self) if is...
true
dc6428eafe2dbbee063878d133e5f8dbebbb3a57
Relativity74205/data_engineering_udacity
/part_1_data_modeling/project_1_data_modeling_postgres/etl.py
UTF-8
5,122
2.984375
3
[]
no_license
import os import glob from typing import Callable import psycopg2 import pandas as pd # original import: from sql_queries import * # however "import *" imports shouldn't be used in any case! from sql_queries import ( song_table_insert, artist_table_insert, time_table_insert, user_table_insert, son...
true
de6603b923e34cfbf103e9a99e456654804af47b
bishii/QA_Scripts
/IoT/RaspberryPi/LED-Matrix/LinearSortingDots.py
UTF-8
2,205
2.546875
3
[]
no_license
from time import sleep from luma.led_matrix.device import max7219 from luma.core.interface.serial import spi, noop from luma.core.render import canvas from luma.core.virtual import viewport from luma.core.legacy import text, show_message from luma.core.legacy.font import proportional, CP437_FONT, TINY_FONT, SINCLAIR_FO...
true
80f1103283bc35d8463880c09e1a38fd807dc8fb
xyloguy/cs1410-2018-20-50-examples
/2018-02-07/check_word.py
UTF-8
1,052
4.21875
4
[]
no_license
class Player: def __init__(self, name): self.name = name self.letters = [] def check_word(self, word): c = self.letters[:] for char in word: found = False for i in range(len(c)): if char == c[i]: found = True ...
true
12f2e799b26b842354768b94cf2d09f0d37a0d38
R-second/number_theory
/ch19/Miller–Rabin.py
UTF-8
1,043
4.0625
4
[]
no_license
# 練習問題19.7 # ラビンミラー判定法 # 繰り返し二乗法で, a^k (mod m) を求める. (cf: ch16) def power_mod(a, k, m): b = 1 while k >= 1: if k % 2 == 1: b = (a * b) % m a = ( a * a ) % m k = int(k / 2) return b # 合成数ならTrue, そうでない可能性が高いならFalse def Miller_Rabin_judgement(n): if (n % 2 == 0): ...
true
07d6f8c83e64c812b1d7c00dc28a0af5c413488f
asifurrouf/Automation_iOS
/Demo3/testSet/common/AppiumServer.py
UTF-8
1,724
2.671875
3
[]
no_license
import os import urllib.request from urllib.error import URLError from multiprocessing import Process import readConfig as readConfig import threading readConfigLocal = readConfig.ReadConfig() class AppiumServer: def __init__(self): global openAppium, baseUrl openAppium = readConfigLocal.getcmdV...
true
fc7ac44002d23e2d7d2719123d8bf80ad59bac22
en0/oopp
/oopp/read_the_room.py
UTF-8
750
3.390625
3
[ "Beerware" ]
permissive
from typing import List from .topic_base import PresentationTopic class ReadTheRoom(PresentationTopic): """I assume we all dislike OOP. That might not be fair. In fact, I love OOP. So i know the assumption is not accurate. But it's at least a place to start. """ question: str answers: List[...
true
47d31535de996d3b03cfae7cce9ce33cecc8058b
erramuzpe/neurovault_benchmark
/ann-benchmarks/install/convert_word2vec_format.py
UTF-8
405
2.734375
3
[]
no_license
import struct import sys import gzip f = gzip.open(sys.argv[1]) g = gzip.open(sys.argv[2], 'w') words, size = (int(x) for x in f.readline().strip().split()) t = 'f' * size while True: while True: ch = f.read(1) if ch in ['', '\n', ' ']: break if ch in ['', '\n']: break vec = struct.unpack...
true
626d73e6c74620a38b03eb0fbe0ee23ac72a3690
guiarn/time-series
/mlp/mlp_run.py
UTF-8
1,798
2.90625
3
[]
no_license
import matplotlib.pyplot as plt import numpy from TimeSeriesNnet import * from sklearn.preprocessing import StandardScaler from sklearn.metrics import mean_squared_error # read csv and separate data csv = numpy.genfromtxt('../datasets/2007.txt', delimiter=";", names=True, dtype=None, missing_values='?') time_series = ...
true
9ebefde28d418b0c3591bcb6accb17457747ec04
Nicolas-31/IKT441_DataMining_2018
/SVM-Support Vector Machine/Iris.py
UTF-8
2,165
3.234375
3
[]
no_license
import numpy as np from sklearn import svm training_data = open("iris.data").readlines()[0::2] #odd numbers test_data = open("iris.data").readlines()[1::2] #even numbers def getData(lines, labeltype): t = [list(map(float, i)) for i in [[i for i in i.split(",")][:-1] for i in lines if i.strip()]] t_labels = ...
true
2b4708aaddcf8ab95a76a31889308773d9da1159
yangdxg/LearnMachine
/chapter1/class1_LearnPandas.py
UTF-8
2,518
3.734375
4
[]
no_license
# 1. 下载学习pandas使用的数据集 # Pandas术语:数据列成为系列,表格称为数据库 import os import pandas as pd import requests r = requests.get('https://archive.ics.uci.edu/ml/machine-learning-databases/iris/iris.data') with open('iris.data','w') as f: f.write(r.text) # 从csv文件导入数据,并添加标题行 df = pd.read_csv('iris.data',names=['花萼长度','花萼宽度','花瓣长度','...
true
d8d5bb49c4641d5fe3dd76dc2fde1d2d80b86b3e
gleydsonbrito/projeto-analise-algoritmo
/graphs/Atividade Final/Algoritmo 26.2: Dijkstra-Heap(D, w, s).py
UTF-8
1,599
3.65625
4
[]
no_license
from collections import defaultdict from heapq import * # Dijkstra usando heap def dijkstra(arcos, s, t, D=None): p = 0 D = defaultdict(list) for l, r, c in arcos: D[l].append((c, r)) heap, visitados, minimo = [(0, s, ())], set(), {s: 0} while heap: p += 1 (w, v, caminho...
true
05df4ba3e4cfb5919f75760102f718cbe840b486
arkellmer/python-4-5-class
/indexing2.py
UTF-8
214
3.234375
3
[]
no_license
name = "colette" print(name[1]) print(name[2]+name[3]+name[4]) print(name[2:5]) print(name[:4]) print(name[4:7]) print(name[4:]) print(name[-7:-3]) print(name[:]) print(name[::2]) print(name[::3]) print(name[::5])
true
38310bc1c7ade909b1dc02651a70ccff4d89010d
juangagz/tarea2
/primos.py
UTF-8
571
4.34375
4
[]
no_license
#!/usr/bin/env python # -*- coding: utf-8 -*- # primos.py: muestra los numeros primos hasta el numero que se pida def es_primo(n): '''Devuelve un booleano indicando si el numero pasado como parametro es primo''' numero_primo = True b = 2 while (numero_primo) & (b < n): if (n % b == 0): numero_primo = False ...
true
2aec3ed1649f11f1398a5053c410b44e2542b7ae
viniciusantigo/ExerciciosPython
/Estrutura de decisão/ex07.py
UTF-8
662
4.03125
4
[]
no_license
'''Escreva um programa que leia o peso (kg) e a altura (m) de uma pessoa, determine e mostre o seu grau de obesidade, de acordo com a tabela seguinte. O grau de obesidade é determinado pelo índice de massa corpórea, cujo cálculo é realizado dividindo-se o peso da pessoa pelo quadrado da sua altura.''' altura = ...
true
6ecf4279edc724c832359e32812c7a8e9cee9874
fengzhuiyue/PyLibs
/BeautifulSoup/beautifulsoupDemo_replaceTag.py
UTF-8
2,008
3.28125
3
[]
no_license
#!/usr/bin/python # -*- coding: utf-8 -*- """ Function: 【教程】Python中第三方的用于解析HTML的库:BeautifulSoup http://www.crifan.com/python_third_party_lib_html_parser_beautifulsoup Author: Crifan Li Version: 2013-02-01 Contact: admin at crifan dot com """ from BeautifulSoup import BeautifulSoup; def beautifulsoupD...
true
fcbf2fbd4268dcb7dc286682d6b57c6c6d30fd9d
wherculano/Curso-em-Video-Python
/Desafio110/ex_110.py
UTF-8
633
3.609375
4
[]
no_license
""" Adicione uao módulo moeda.py criado nos desafios anteriores, uma função chamada resumo(), que mostre na tela algumas ingormações geradas pelas funções que já temos no módulo criado até aqui. Ex: >>> moeda.resumo(500, 80, 35) ------------------------------ RESUMO DO VALOR --------------------...
true
cec393d383972bcb27d799298fa2cc96a717fa50
shackla/Deep-Learning
/multiclass_classification.py
UTF-8
3,405
3.09375
3
[]
no_license
from keras.datasets import reuters import numpy as np from keras import models from keras import layers import matplotlib.pyplot as plt (train_data, train_labels), (test_data, test_labels) = reuters.load_data( num_words=10000) def vectorize_sequences(sequences, dimension=10000): results = np.zeros((len(seque...
true
e56ce36ea77034284c2b6460b85e60636c15c696
ebragas/MITX-6.00.1x
/Practice/Week 5 - Object Oriented Programming/coordinate.py
UTF-8
1,073
4.46875
4
[]
no_license
class Coordinate(object): def __init__(self, x, y): self.x = x self.y = y def getX(self): # Getter method for a Coordinate object's x coordinate. # Getter methods are better practice than just accessing an attribute directly return self.x def getY(self): # ...
true
646703ccdfaf8982b5b118f7f12b54b44c19c96d
rohith46/Projects
/kaggle_scale_normalize_day2.py
UTF-8
2,585
3.0625
3
[]
no_license
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Mar 27 10:52:42 2018 @author: rohithbharatha """ # modules we'll use import pandas as pd import numpy as np # for Box-Cox Transformation from scipy import stats # for min_max scaling from mlxtend.preprocessing import minmax_scaling # plotting module...
true
39e3af629600fd172c57a4fb7c092f02eea3f9ac
shaotianyuan/My_world
/Algorithms_Data Structures/排序与搜索/l7_快速排序.py
UTF-8
1,522
4.375
4
[]
no_license
""" 快速排序: 1,依据一个'中值' ,分成小于中值对一半和大于中值对一半 2,然后每个部分分别进行快速排序(递归) """ def quickSort(alist): quickSortHelper(alist, 0, len(alist)-1) def quickSortHelper(alist, first, last): if first < last: splitpoint = partition(alist,first,last) quickSortHelper(alist, first, splitpoint - 1) quickSortHelpe...
true
f439315bfb2d6d08e67e2b93407c912842fd114c
jxxiao/leetcode
/python/125.valid-palindrome.py
UTF-8
1,434
3.296875
3
[]
no_license
''' @Description: @Author: jxxiao @Github: https://github.com/jxxiao @Date: 2020-02-25 22:54:25 @LastEditors: jxxiao @LastEditTime: 2020-02-28 20:18:33 ''' # # @lc app=leetcode id=125 lang=python3 # # [125] Valid Palindrome # # https://leetcode.com/problems/valid-palindrome/description/ # # algorithms # Easy (34.04%) #...
true
4ea05bf54594c5f302539c22be198a840576cfe3
SamarpreetSingh/Bloggers-Hub
/flaskblog/routes.py
UTF-8
1,730
2.640625
3
[]
no_license
from flask import render_template, url_for, redirect, flash from flaskblog.forms import RegistrationForm, LoginForm from flaskblog.models import User, Post from flaskblog import app, db, bcrypt posts = [ { 'author': 'Samar', 'title': "Blog Post 1", 'content': "This is my first blog post", ...
true
86656e347ae1daef625cf4f55d80cae8173f855a
mingddo/Algo
/8월/swea_1959.py
UTF-8
762
3.046875
3
[]
no_license
import sys sys.stdin = open("input.txt", "r") T = int(input()) # 여러개의 테스트 케이스가 주어지므로, 각각을 처리합니다. for test_case in range(1, T + 1): N, M = map(int, input().split()) n_numbers = list(map(int, input().split())) m_numbers = list(map(int, input().split())) result = [] if N < M: for i in range(M...
true
1c77a23f5235c858f0073d1ceb33d036b13ce8ab
borghol/eulerproject-python
/26-50/p044.py
UTF-8
423
3.65625
4
[]
no_license
def is_pentagonal(n): if (1+(24*n+1)**0.5) % 6 == 0: return True return False def getPentagonal(n): return n * (3*n - 1) / 2 i = 1 found = False while not found: for j in range (i-1, 0, -1): n = getPentagonal(i) m = getPentagonal(j) if (is_pentagonal(n+m) and is_pentag...
true
2f8868745075ffdc5b398fd3c42045df354585b2
lanyusea/py_imageFileConverter
/decode.py
UTF-8
1,448
2.8125
3
[]
no_license
import sys import os import math from PIL import Image #example: #python decode.py image.png filename #+-------->x #| #| image #v #y #return the length and second identity point def findlength(width,height): length = 0 flag = 0 for y in range(0,height-1): for x in range(0,width): ...
true
e72d6ef05fc9477aa7762f05a292eb019ea76eff
weardo98/Github
/1.3.2.py
UTF-8
235
3.09375
3
[]
no_license
def add_tip(total,percent): tip = percent*total return total + tip def find_hyp(leg1,leg2): hyp = leg1**2 + leg2**2 return hyp**0.5 def mean(a,b,c): total = a + b + c mean = total /3.0 return mean
true
82bee42c1e861e4b18c632469d0e25f6bf817234
jamondouglas/blue-team
/Cisco/AMP/neipatel_event-stream/amp_api.py
UTF-8
3,777
2.5625
3
[ "MIT" ]
permissive
import requests import json class amp (object): """Class to define the AMP for endpoints console. Attributes Endpoint: amp api endpoint id: client ID for amp key: api key for amp """ def __init__(self, endpoint, client_id, key): """Return AMP Object whose attributes are endpoint...
true
a27c4c050a7a8b8a9dd655c69701eea21ebf4082
MisterRobot35/pymarkdownlint
/pymarkdownlint/tests/test_rules.py
UTF-8
1,917
3.0625
3
[ "MIT" ]
permissive
from pymarkdownlint.tests.base import BaseTestCase from pymarkdownlint.rules import MaxLineLengthRule, TrailingWhiteSpace, RuleViolation, HardTab class RuleTests(BaseTestCase): def test_max_line_length(self): rule = MaxLineLengthRule() # assert no error violation = rule.validate("a" * 80)...
true
e655791df06c61381ab3ab5d899297f53125c0e6
yu5shi8/AtCoder
/ABC_C/ABC076C.py
UTF-8
597
3.171875
3
[]
no_license
# -*- coding: utf-8 -*- # C - Dubious Document 2 # https://atcoder.jp/contests/abc076/tasks/abc076_c S = input()[::-1] T = input()[::-1] for i in range(len(S)-len(T)+1): for j in range(len(T)): if T[j] != S[i+j] != '?': break else: break else: print('UNRESTORABLE') exit() ...
true
1eba189a240b6b79028c822100701b5fb9961081
102757017/Batch-search-and-modify-Excel
/统计页眉.py
UTF-8
1,893
2.703125
3
[]
no_license
# -*- coding: UTF-8 -*- import os import sys import shutil import re import xlwings as xls import pprint import pandas as pd #将该文件与基准书放置到同一个目录下执行,可以统计本目录及子目录下的所有基准书的页数 if getattr(sys, 'frozen', False): bundle_dir = sys._MEIPASS else: bundle_dir = os.path.dirname(os.path.abspath(__file__)) os.chdir(bundle_di...
true
b165c97350a604035645572ccddfbd108bbd362e
rachel990910/keras
/playground/mlp/mnist_mlp_v5.py
UTF-8
1,232
2.671875
3
[ "MIT" ]
permissive
'''Trains a simple deep NN on the MNIST dataset. Gets to 98.40% test accuracy after 20 epochs (there is *a lot* of margin for parameter tuning). 2 seconds per epoch on a K520 GPU. ''' from __future__ import print_function import keras import numpy as np from PIL import Image,ImageOps from keras.datasets import mnist...
true
fb5400608745e4bd4917a849f4fef9bb8243ec29
Parya1112009/mytest
/nestedlist.py
UTF-8
183
3.125
3
[]
no_license
list = [[1,2,3],[3,4,5],[6,7,8]] list1 = [[0,0,0],[0,0,0],[0,0,0]] for i in range(0,len(list)): for j in range(len(list[i])): list1[i][j]=list[j][i] for r in list1: print r
true
f4313958ecd50b08c3175d16331ff9f8e5ad6872
shikixyx/AtCoder
/CDF/2020_Round8/C.py
UTF-8
383
3.171875
3
[]
no_license
import sys import itertools sys.setrecursionlimit(10 ** 7) read = sys.stdin.buffer.read readline = sys.stdin.buffer.readline readlines = sys.stdin.buffer.readlines N = int(input()) ANS = [(0, 0), (1, 0), (0, 1), (1, 1), (2, 1), (1, 2), (2, 2)] for i in range(N - 1): ANS += [(i + 3, i + 3), (i + 2, i + 3), (i +...
true
49f1896f7d8b12f5dd0eb2d43be53cd02edb7dbb
Aniruddha-972001/appointy-instagram-task
/test.py
UTF-8
1,051
2.96875
3
[]
no_license
import requests import datetime def runTests(): resp = requests.get("http://localhost:5000/users/1") assert resp.status_code == 200 resp = requests.get("http://localhost:5000/posts/1") assert resp.status_code == 200 resp = requests.get("http://localhost:5000/posts/2") assert resp.status_code ...
true
6e6076858d5fb0ff5501c8181fdb0573838e4594
gsukhanov/d16
/AZabolotskikh/old/mixed.py
UTF-8
281
2.59375
3
[]
no_license
host = list(input()); guest = list(input()); mix = list(input()); try: for letter in host: mix.remove(letter); for letter in guest: mix.remove(letter); except: print ("NO"); else: if len(mix)==0: print("YES"); else: print ("NO");
true
c05203b082cc02e5e8a72d546432ec8fa7b35e29
dltpdn/insightbook.opencv_project_python
/03.numpy_matplotlib/plt_imgshow_rgb.py
UTF-8
329
2.8125
3
[]
no_license
import cv2 from matplotlib import pyplot as plt img = cv2.imread('../img/girl.jpg') plt.imshow(img[:,:,::-1]) # 이미지 컬러 채널 변경해서 표시 --- ① plt.xticks([]) # x좌표 눈금 제거 ---② plt.yticks([]) # y좌표 눈금 제거 ---③ plt.show()
true
0809965e0871032217ac4bfa21abfe1c25244e16
saurav188/python_practice_projects
/power_function.py
UTF-8
467
4.25
4
[]
no_license
#The power function calculates x raised to the nth power. #If implemented in O(n) it would simply be a for loop #over n and multiply x n times. Instead implement this #power function in O(log n) time. You can assume that n #will be a non-negative integer. def pow(x, n): if n==0: return 1 elif n==1:...
true
e5c1ea807b9f8b96b04fd7780fe7c111b5bf524e
StephanieGreenberg/python-practice
/binarySearch.py
UTF-8
1,353
4.5625
5
[]
no_license
"""Iterative Binary Search""" def binary_search(input_array, value): min, max = 0, len(input_array) - 1 while max >= min: mid = min + (max - min) // 2 if input_array[mid] == value: return mid elif input_array[mid] > value: max = mid - 1 else: ...
true
e4a14f0e14d38a64595fbfa4f812a93cde8f0f33
Halcyon905/idle-clicker-game
/game.py
UTF-8
346
2.8125
3
[]
no_license
import pygame import sys import random BLUE = (0,0,255) RED = (255,0,0) GREEN = (0,255,0) SCREEN_WITH = 800 SCREEN_HEIGHT = 800 pygame.init() screen = pygame.display.set_mode((SCREEN_WITH,SCREEN_HEIGHT)) gameOver = False while not gameOver: for event in pygame.event.get(): if event.type == pygame.QUIT...
true
4758c209f5ea681951313500ebfc4406d14c65b8
MerlinQueen/IAB_AI
/Three_CNN/3.cnn_1/手写数据集模型搭建.py
UTF-8
3,863
2.609375
3
[]
no_license
# %% import pandas as pd import numpy as np import tensorflow as tf import matplotlib.pyplot as plt import seaborn as sns import keras %matplotlib inline from sklearn.model_selection import train_test_split from sklearn.metrics import confusion_matrix import itertools from keras.utils.np_utils import to_categori...
true
99fa2265f3ddc7a3dff4aee4de0e4125a67d97aa
imalikova/PythonLearn
/MODULE 2/M2 Lesson 05 Colors Loops Lambda.py
UTF-8
695
3.1875
3
[]
no_license
from tkinter import * color_codes = ["#ff0000", "#ff7d00", "#ffff00", "#00ff00", "#007dff", "#0000ff", "#7d00ff"] color_names = ["Red", "Orange", "Yellow", "Green", "Light blue", "Blue", "Purple"] def show_color(color,index): message.set(color_codes[index]) label_1.config(text=color, fg=color) root = Tk()...
true
7185b06886433d4ddd3bf985ba203180f343e6c1
tbro28/intermediatepython
/2020-09-17-ora-begpytest/Integer/integr.py
UTF-8
228
4.09375
4
[]
no_license
def parse(txt): """ Return a list of integers from the string >>> parse('1,3,5,9') [1, 3, 5, 9] """ results = [] for item in txt.split(','): results.append(int(item)) return results
true
06163ff33e10b2bd624c38af5f752c55e031bf6e
stephendwillson/ProjectEuler
/python_solutions/problem_32.py
UTF-8
1,874
4.09375
4
[]
no_license
import math def main(): # digits can be 1-9 and no repeated digits = 9! possible pandigital #s # max value of prod of two 5-digit #s = 9,999,800,001 # 10 digits and not pandigital - only consider products up to sqrt(ceiling) ceiling = math.factorial(9) pandigitals = set() for multiplicand in...
true
01f1c1e0902fcdccade7c9efea408c46dd66d323
pcmaestro/my_repository
/APUNTES/PYTHON/EJEMPLOS_FORMACION/ejemploExcel/main_leer.py
UTF-8
666
3.46875
3
[]
no_license
import pandas as pd #Leyendo la primera hoja peliculas = pd.read_excel("movies.xls") ''' #Leyendo el resto de hojas pagina_del_excel = 2 # Cuenta las hojas desde cero peliculas = pd.read_excel("movies.xls", sheet_name = pagina_del_excel) print(peliculas) ''' #Para listar todas las columnas columnas = peliculas.columns...
true
039156b301b45844d0eb77877ce842a586e70e3e
s-cork/BIO
/2002/Q2.py
UTF-8
2,248
3.9375
4
[ "MIT" ]
permissive
def In(cards): ''' expects a list of 8 numbers returns a list after an in shuffle ''' new_hand = [] for i in range(4): new_hand.append(cards[i+4]) new_hand.append(cards[i]) return new_hand def Out(cards): ''' expects a list of 8 numbers returns a list after an in shuffl...
true
eb357f2dbdb740afee66c57c1218b706601186a5
grupotaric/httptestserver
/httptestserver/_compat.py
UTF-8
472
2.59375
3
[]
no_license
import sys import collections PY2 = sys.version_info[0] == 2 if PY2: from SocketServer import ThreadingMixIn from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler else: from socketserver import ThreadingMixIn from http.server import HTTPServer, BaseHTTPRequestHandler def iteritems(iterable...
true
a8b533bca258fa920682851ac71117928289a422
s-col/atcoder-autochecker
/atcoder-autocheck.py
UTF-8
9,347
2.65625
3
[ "Apache-2.0" ]
permissive
import sys import os import re import time import json import subprocess from typing import List, Tuple from urllib import request from argparse import ArgumentParser from selenium import webdriver from selenium.webdriver.chrome.options import Options from selenium.webdriver.common.by import By from selenium.webdriver...
true
469f3216b8118f758714dc381728d90ab4d384c3
ml0042993/My_Routine
/Core/Read_Proxy.py
UTF-8
592
2.53125
3
[]
no_license
import linecache import random import os from Setting.Init_Floder import Floder_Create def random_proxy(): ''' 随机获取一个可用代理i :return: ''' filePath = Floder_Create().Proxy_path+'\proxy_file' # 建立proxy文件的路径 if os.path.exists(filePath): proxy_dic={} count = len(open(filePath,'r').readlines()) ran = random.ra...
true
ba56d80f76fdedff3a45e3a25281f527a700ed68
tylerjarvis/RootFinding
/tests/high_dim/4d_examples.py
UTF-8
17,707
2.609375
3
[ "MIT" ]
permissive
import numpy as np import yroots as yr import scipy as sp import matplotlib from yroots.Combined_Solver import solve from matplotlib import pyplot as plt from mpl_toolkits.mplot3d import Axes3D from time import time from mpmath import mp, mpmathify mp.dps = 50 def residuals(f,g,h,f4,roots,t): Resid = list() Ro...
true
49f8c5a29cee94bfab0836e8f98c3fa8fda6a573
MasterNobikan/First_Python_Scripts
/imaging.py
UTF-8
2,797
4.15625
4
[]
no_license
""" Purpose: process an image in different ways Author: JT Vannoy Date: May 1st, 2018 COSC 235, Dr. Beau Christ """ from image import * pic = Image(file='earth.gif', title='Imaging') def greyscale(pic): """Changes all the colors in an image to shades of gray Parameters: pic: a gif image Return...
true
011f45b2d23ac66eb61bf77a58ca14af7e1a2d40
TheElmo/AI_opdrachten
/Week3/AI3-2.py
UTF-8
5,405
3.671875
4
[]
no_license
import itertools #Vult het board dictionary door een string te zetten als value van een key (key stelt een kaart voor: A1 is de eerste aas, A2 is de tweede aas enz...) def fill_board(A1,H1,V1,B1,A2,H2,V2,B2): board[A1] = "Aas" board[A2] = "Aas" board[H1] = "Heer" board[H2] = "Heer" board[V1] = "Vrouw" board[V2] ...
true
c2d33cbd12dd053ce10ab84d3ef67f9a3f1134fe
cperepelitsa/cvp-bin
/src/shf
UTF-8
4,324
2.828125
3
[ "LicenseRef-scancode-warranty-disclaimer", "MIT" ]
permissive
#!/usr/bin/python2 import argparse from os.path import basename from pipes import quote as shellQuote import subprocess from subprocess import PIPE, STDOUT import sys import textwrap _prog = basename(sys.argv[0]) _usage = textwrap.dedent(''' Filters input lines based on what passes (exit 0) given shell command. ...
true
fee1c16de76836083baee9ef294801bdb3902b0e
pyasi/dnd-wrapper
/pydnd/classes.py
UTF-8
1,637
2.546875
3
[]
no_license
from .base import DnDBase from .resource_dicts import * from enum import Enum import logging class ClassEnum(Enum): classes = 'classes/' subclasses = 'subclasses/' #TODO These may be on their own #features = 'features/' #spellcasting = 'spellcasting/' #starting_equipment = 'startingequipment/...
true
8a06e01cc6fc86ffdd759f098616f9a5f75da146
yeqinfang-git/dataProcessing
/iterableTest.py
UTF-8
159
2.78125
3
[]
no_license
l1 = ["1"] # l1 = l1[:] if l2 = ["key",{}] l3 = l1 + l2 print(l3) # list2 = ["1", "2", "3", "{1}" ] # print(list2[0:-1]) print('.'.join(l3[0:-1]), ':', l3[-1])
true
8c4b7f1802b17b76cb933ec68165fc3a56777be4
popcornell/MicRank
/micrank/utils/scaler.py
UTF-8
4,701
3.171875
3
[]
no_license
import tqdm import torch """ """ class TorchScaler(torch.nn.Module): """ This torch module implements scaling for input tensors, both instance based and dataset-wide statistic based. Args: statistic: str, (default='dataset'), represent how to compute the statistic for normalisation. ...
true
ec53f05392da5add48f79c806de2090ac7056268
SachinMishra369/MLDataprocessing
/main.py
UTF-8
1,162
3.109375
3
[]
no_license
# https://github.com/yaroslav-v/android-maps-zone #importing libraries import pandas as pd import numpy as np data=pd.read_csv("data.csv") #dePendent variable x=data.iloc[:,:-1].values #indePendent variable y=data.iloc[:,-1].values #taking care of missing data from sklearn.impute import SimpleImputer imputer=SimpleI...
true
2465a646393ad0f90e155aca2c08b5543a803fd2
lesleychou/ADR-original
/tests/00-test-vecenv.py
UTF-8
1,413
2.609375
3
[]
no_license
from common.envs import LunarLanderRandomized from common.envs.randomized_vecenv import make_vec_envs def _create_envs(seed, reference_env_id='LunarLanderDefault-v0', randomized_env_id='LunarLanderRandomized-v0'): reference_env = make_vec_envs(reference_env_id, seed, num_processes=3) randomized_env =...
true
7adb984f420ea52e9a68a7432c4164c7e6d2badd
PotOfPetunias/CrookFunProjects
/MNSO_Park/MNSOParkEntry.py
UTF-8
29,264
2.9375
3
[]
no_license
import time import calendar import os from collections import deque from datetime import datetime from shutil import copyfile import numpy as np import matplotlib.pyplot as plt os.chdir('C:\\Users\\lhcro\\Google Drive\\Summer2017\\MNSOdata') fileName = 'MNSOData.csv' visitorNumber = 0 tempCommandNote = '' def helpMen...
true
2ae79b4b7cb826c0f0d837e10cdb585bdd25ba17
udit-001/ado-bot
/components/callbackqueries.py
UTF-8
3,960
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ForceReply, ChatAction from telegram.ext import CallbackQueryHandler def adorables_menu_buttons(bot, update): query = update.callback_query if query.data == 'username': bot.send_message(text='Okay, then! Now send...
true
314557e9d051e5f7a70e9c39394866ee18c22da0
KolorowyAleksander/rainbow-translator
/app/devices/matching.py
UTF-8
740
3.375
3
[]
no_license
from math import sqrt, pow def closest_color(color, colorList): min_value = cartesian_distance(color, colorList[0][1]) closest_color = colorList[0] for element in colorList: current_value = cartesian_distance(color, element[1]) if(current_value < min_value): min_value = current...
true
4c9730d29b453c47bccf76db426d737439a8291d
Marlenqyzy/PP2
/week1/цикл for/3.py
UTF-8
87
3.5
4
[]
no_license
x = int(input()) for i in range(10**x - 1, 10**(x-1) - 1, -2): print(i, end = " ")
true
f06a8dc360939862b4ccf0cccde85d555ec36891
maryakshaya/akshaya
/number.py
UTF-8
62
3.046875
3
[]
no_license
var1, var2, var3 = input().split() print(max(var1,var2,var3))
true
4db0874371207bda322bba19a6333d82eaa29495
PogramLearningWithPouyan/advanced-python
/video32.py
UTF-8
839
3.1875
3
[]
no_license
class user: activeUser=[] def __init__(self,name,age): self.name=name self.age=age userdict={'name':name,'age':age} user.activeUser.append(userdict) self.index=0 def logout(self): print(f'{self.name} is logout') currentuser=list(filter(lambda...
true
fb5829d093931bfdfbc238c387eda3fb8ccd08e1
jb-diplom/UvA-Papers
/bigdata/project/samples/seabornScatterPlots.py
UTF-8
9,430
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Wed May 6 21:31:08 2020 @author: Janice """ import seaborn as sns; sns.set() import pandas as pd import numpy as np from collections import Counter, defaultdict import matplotlib.pyplot as plt # importlib.import_module("rssreader.reader") import reader from reader import loadA...
true
1d48ee67b7c21d608a709c649c1d847e064159d4
rokala/Physics-experiments-and-projects
/Lattice Dynamics, theory & experiment/src/ssp_diatomicv2.py
UTF-8
5,319
2.875
3
[ "MIT" ]
permissive
import numpy as np from math import * from pylab import * from matplotlib import pyplot as plt from matplotlib import animation #-- Experimental results --# mass = 0.203 #m_u # The reciprocal of the weights mass [k] period...
true
b4ee8612b55fbddb651be1099414bf6b2f961050
EGelphman97/Finite-Element-WiFi-Simulator
/ssWFS.py
UTF-8
31,504
3.328125
3
[]
no_license
""" Eric Gelphman University of California Irvine Department of Mathematics Program using Numpy and SciPy to calculate the steady-state power density of WiFi in my house. This is accomplished by solving the two dimensional vector linear Helmholtz equation in the phasor domain with circular wave source term with ...
true
801c4fe93c94a8b6636ce50e6e3fa2606d957d03
moon0331/baekjoon_solution
/others/2577.py
UTF-8
209
2.953125
3
[]
no_license
from collections import Counter A = int(input()) B = int(input()) C = int(input()) val = A*B*C cnt = Counter(map(int,str(val))) for i in range(10): try: print(cnt[i]) except: print(0)
true
c7bfcd1c227b302dbd68a18ed24e6cc3165b89ac
daquilnp/svm_lenna
/code_appendix/sobel_filter.py
UTF-8
598
2.546875
3
[]
no_license
import cv2 import numpy as np from matplotlib import pyplot as plt img = cv2.imread('Lenna_img.png',0) # blur = cv2.GaussianBlur(img,(5,5),0) gaussian blur sobelx = cv2.Sobel(img,cv2.CV_64F,1,0,ksize=5) sobely = cv2.Sobel(img,cv2.CV_64F,0,1,ksize=5) plt.subplot(131),plt.imshow(img, 'gray') plt.title('Original I...
true
d7573c786c4e4fde3cad5f7dd1e47204abf23421
adaao/python
/cursoemvideo/exercicios/ex031.py
UTF-8
406
4.0625
4
[]
no_license
""" ex031 - Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcula o preço da passagem, cobrando R$o,50 por Km para viagens de até 200Km e R$0,45 para viagens mais longes. """ km = float((input('Qual a distância em Km? '.strip()))) if km > 200: preco_da_passagem = km * 0.45 else: preco_...
true
30bf2e1d6d8b7c293219582b640109af9d950545
nivzor/searchEngines
/searchMe.py
UTF-8
1,489
2.75
3
[ "MIT" ]
permissive
#!/usr/bin/env python3 import os.path import sqlite3 import re import json import click def data_handler(data): return_data = json.dumps(data, sort_keys=True, indent=4, separators=(',', ': ')) print(return_data) @click.command() @click.option( '--path', default='~/Libr...
true
b567bfa4f5f3becebca17dee47b7e1eb7395ad9f
ztokarski/python-ccms-project
/model/user_model.py
UTF-8
1,285
2.890625
3
[]
no_license
import sqlite3 from model.user import * class User_model: conn = sqlite3.connect('ccms.db') cursor = conn.cursor() @classmethod def get_all_users(cls): user_list = [] db_list = cls.conn.execute("SELECT * FROM users") for user in db_list: name = user[1] s...
true
5f58b1f3ac6e9f214827eba099e7795f0d1ba041
icemac/icemac.addressbook
/src/icemac/addressbook/browser/search/tests/test_multi_keyword.py
UTF-8
2,919
2.5625
3
[ "LicenseRef-scancode-unknown-license-reference", "MIT", "BSD-2-Clause" ]
permissive
from . import NO_RESULTS_TEXT def test_multi_keyword__Search__1(search_data, browser): """`Search` for persons who have specified keywords assigned to.""" browser.login('visitor') browser.open(browser.SEARCH_URL) browser.getLink('Keyword search').click() assert browser.SEARCH_BY_KEYWORD_URL == bro...
true
39a84837cdaa4c687234b4e677b65f5baf5a2890
ashraf-kabir/CSE110-py
/hw04/task05.py
UTF-8
96
3.40625
3
[]
no_license
n = int(input('Enter the range:\n')) y = 0 for c in range(1, n+1): y = y + (c*c*c) print(y)
true
be90a74a55f7d7e4f7b964dea697c544e0fa2448
wttttt-wang/leetcode_withTopics
/Math/gray-code.py
UTF-8
375
3.421875
3
[]
no_license
""" Gray Code @ Math: G(i) = i ^ (i/2) @ Also see: 'backtracking/gray-code' (recommended) """ class Solution(object): def grayCode(self, n): """ :type n: int :rtype: List[int] """ if n <= 0: return [0] results = [] for i in range(1 << n): ...
true
9fea35d19113f57debb3038816a3c51ded701fd6
ewu001/exploring_transformer
/Transformer_model/model_embedding.py
UTF-8
1,185
3.34375
3
[ "MIT" ]
permissive
import torch import torch.nn as nn import math class ModelEmbedding(nn.Module): ''' This class projects the input into the embedding dimension ''' def __init__(self, embed_size, vocab_size): ''' Init the Embedding layers. @param embed_size (int): Embedding size (dimensionality)...
true
5be89921defcc1a84d8704b441ca6df3bf048e88
yagolabate/Projeto-de-Design-de-Software
/Projeto DeSoft.py
UTF-8
53,131
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- from decimal import Decimal, ROUND_HALF_UP import tkinter as tk from PIL import Image, ImageTk from tkinter import ttk import comidas import pickle import ToolTip as ttp #from firebase import firebase #firebase = firebase.FirebaseApplication('https://projeto-de-desoft.firebaseio.com/') class P...
true
32934475d41e1f3d52efd7a0e16557adcf8b1f91
esterfiorillo/Monitorador_de_gastos
/back/sqlite.py
UTF-8
1,508
3.1875
3
[]
no_license
import sqlite3 import json def creat_db(): banco = sqlite3.connect('my_test.db') cursor = banco.cursor() cursor.execute('CREATE TABLE IF NOT EXISTS TRANSACOES (idx integer, time_stamp integer, descricao text, valor integer, categoria text)') banco.commit() return banco def insert_db(banco, idx, time_stamp, des...
true
a153cad21fb5c580aa0dfb8fc7e99a40364ffdd3
dimamik/AGH_Algorithms_and_data_structures
/PRACTISE/CWICZENIA/04_29_Shortest_Path/Online/Zad_9.py
UTF-8
602
3.265625
3
[]
no_license
""" 1. Rozw dla grafow rzadkich: W sposob banalny usuwamy krawedz (x,y) i puszczamy algorytm Dijkstry z y do x, do otrzymanej odleglosci dodajemy wage krawedzi w(x,y), robimy to dla kazdej krawedzi i wybieramy najmniejszą wagę (Ewentualnie mozna jakos przyspieszyc i chodzic tylko po cykli, skoro i tak bd miel...
true
17a532833e38e4205c8f0248f242cc32332bac70
xlasdf/technicalsupport
/MHC/ML_Study/ANN_basic.py
UTF-8
1,970
2.90625
3
[]
no_license
## Artificial Neural Networks # https://lge.smartlearn.io/asset-v1:POSTECH+DSC502+LGE901+type@asset+block/12_ANN.html # https://www.youtube.com/embed/3liCbRZPrZA?rel=0 import numpy as np import matplotlib.pyplot as plt import tensorflow as tf import time import os os.environ['TF_CPP_MIN_LOG_LEVEL'] = '2' ...
true
9a6f4182f3a9a5895a9f8f0926d9abdc9d8fc801
qbittech/teachYourKidsToCode
/code/2.4.3.CircleSpiral.py
UTF-8
271
4.03125
4
[]
no_license
# CircleSpiral2.py - Draws a square spiral # 画圆 import turtle t = turtle.Pen() turtle.bgcolor("black") colors = ["red","yellow","blue","green"] for x in range(100): t.pencolor(colors[x%4]) #使用x作为半径 t.circle(x) #向左转91° t.left(91)
true
cedc20f610c79498c960c3f61ff67af6d45411f3
j-sripad/VAE
/generate_synthetic_data.py
UTF-8
1,614
2.5625
3
[]
no_license
import argparse import model import torch from torchvision.utils import save_image if __name__ == '__main__': parser = argparse.ArgumentParser(description='Generate Synthetic Images') parser.add_argument('--input_shape', nargs='+', type=int) parser.add_argument('--latent_dimension', default=20, type=...
true
4b4edceeba3720faa5cf3be854ab63a7db52d2e9
akshatha-k/open_cv-codes
/stereocam/stereo_calib_match/try.py
UTF-8
756
3.046875
3
[]
no_license
from numpy import * def sph_to_cart(epsilon, alpha, r): """ Transform sensor readings to Cartesian coordinates in the sensor frames. """ p = zeros(3) # Position vector epsilon=deg2rad(epsilon) alpha=deg2rad(alpha) p[0]=r*cos(alpha)*cos(epsilon) p[1]=r*sin(alpha)*cos(epsilon) p[2]=r*sin(epsilon) # ...
true
6ead2632c19ed1d5a15ae1c56869667c49ba546c
cyang2020/BlackHoleRayTracer
/raytracer/__main__.py
UTF-8
2,199
2.765625
3
[]
no_license
# import your favorite argument parser here import random from renderer.renderer import render from renderer import Camera, World from objects import BlackHole, Disk, Background from numba import jit import numpy as np from objects.disk import Disk def normalize_vector(v: np.array) -> np.array: norm = np.lina...
true