This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
######################### | |
# NumPy Raster Calculator | |
# ----------------------- | |
# Purpose: The purpose of this Python script is to use ArcGIS's arcpy package along with the Python library numpy to convert Landsat thermal bands from digital numbers to Top of Atmosphere (ToA) brightness-temperature values that provide pixel temperature in degrees Celsius. | |
# Purpose #2: The second purpose is that it allows some work to be done on rasters without the need for the Spatial Analyst extension | |
# | |
# Requirements: ESRI ArcGIS arcpy; Python 2.7.x; numpy; Landsat data | |
# ArcPy takes care of the dirty work of conversions and geospatial stuff and I have ArcGIS installed, hence it's use. | |
######################### |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[package] | |
name = "snake_game" | |
version = "0.1.0" | |
authors = ["youcodethings <spyr1014@gmail.com>"] | |
[dependencies] | |
piston = "0.36.0" | |
piston2d-graphics = "0.26.0" | |
pistoncore-glutin_window = "0.45.0" | |
piston2d-opengl_graphics = "0.52.0" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# complex arith for programming with other languages | |
# - required functions: exp(f), log(f), sin(f), cos(f), atan2(f), pow(f1, f2) | |
import math | |
# [equality for complex] | |
def ceq(a, b): | |
return a.real == b.real and a.imag == b.imag | |
# [add, sub, mul for complex] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import asyncio | |
from tortoise import Tortoise, run_async, connections | |
from tortoise.models import Model | |
from tortoise import fields | |
import random | |
import time | |
class Employees(Model): | |
ID = fields.IntField(pk=True) | |
NAME = fields.TextField() | |
AGE = fields.IntField() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
################# | |
## PREPARATION ## | |
################# | |
# Import modules | |
import sys | |
# If your authentification script is not in the project directory | |
# append its folder to sys.path | |
sys.path.append("../spotify_api_web_app") | |
import authorization |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
while (True): | |
vp.rate(500) | |
#Calculte the force using gravitationalForce function | |
star.force = gravitationalForce(star,planet1)+gravitationalForce(star,planet2)+gravitationalForce(star,planet3) | |
planet1.force = gravitationalForce(planet1,star)+gravitationalForce(planet1,planet2)+gravitationalForce(planet1,planet3) | |
planet2.force = gravitationalForce(planet2,star)+gravitationalForce(planet2,planet1)+gravitationalForce(planet2,planet3) | |
planet3.force = gravitationalForce(planet3,star)+gravitationalForce(planet3,planet1)+gravitationalForce(planet3,planet2) | |
#Update momentum, position and time |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#Travel times between each crop for each direction | |
right = [0.42666667, 0.55466667, 0.56533333, 0.576, 0.576, 0.448, 0.59733333, 0.576, 0.56533333, 0.46933333, 0.58666667] | |
left = [0.71466667, 0.55466667, 0.69333333, 0.59733333, 0.69333333, 0.576, 0.71466667, 0.58666667, 0.576, 0.69333333, 0.576] | |
up = [0.58666667, 0.45866667, 0.59733333, 0.58666667, 0.576, 0.58666667, 0.46933333, 0.576, 0.55466667] | |
down = [0.59733333, 0.576, 0.58666667, 0.59733333, 0.45866667, 0.576, 0.56533333, 0.576, 0.448] | |
#Set arbitrary starting vertex and initialise w(s, s) as 0 and direction as empty in Q | |
s = 30 | |
Q = np.array([[s, None, 0]]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import numpy as np | |
def crossEntropy(Y, P): | |
Y = np.float_(Y) | |
P = np.float_(P) | |
CE = -np.sum(Y*np.log(P) + (1-Y)*np.log(1-P)) | |
return CE |