Skip to content

Instantly share code, notes, and snippets.

View HajimeKawahara's full-sized avatar
😀

Hajime Kawahara HajimeKawahara

😀
View GitHub Profile
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import numpy as np
def normalized_angle(theta):
return theta - 2 * np.pi * np.round(theta / (2 * np.pi))
def normalized_angle2(theta):
return np.arctan2(np.sin(theta), np.cos(theta))
if __name__ == "__main__":
theta = np.array([-1.8, -1.2, 0.5, 1.2, 1.8])*np.pi
print(normalized_angle(theta))
@HajimeKawahara
HajimeKawahara / amclouds_comparison_with_VIRGA.ipynb
Created March 9, 2024 05:18
Comparison with VIRGA [ExoJAX]
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@HajimeKawahara
HajimeKawahara / sample.txt
Created November 15, 2023 11:53
sagemath example to solve a system of polynomial equations
sage: R = PolynomialRing(ZZ, 7, "x,y,z,a,b,c,d", order="lex")
sage: x,y,z,a,b,c,d = R.gens()
sage: eqs = [c*x + 2*x*x - c*y - a, d*y + x*y - x*z, -y*z + z*z - b]
sage: eqst = tuple(eqs)
sage: I = eqst * R
sage: B = I.groebner_basis()
sage: for eq in list(B):
....: print(str(eq)+",")
....:
....:
#data from https://archive.stsci.edu/missions/tess/catalogs/xctl/old_versions/
import pandas as pd
csv = "exo_CTL_08.01xTIC_v8.csv"
dat = pd.read_csv(csv,delimiter=",",usecols=(13,14,21,30),names=("ra","dec","plx","V"))
dpc = 100.0
plxcrit=1000.0/dpc
datlim = dat[dat["plx"]>plxcrit]
@HajimeKawahara
HajimeKawahara / roundoff.ipynb
Created October 11, 2023 08:19
variance of the round-off error
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
class ClassChild1():
def __init__(self, initc):
self.c = initc
def func_c(self):
self.c = self.c/5.0
class ClassChild2():
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.