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.
@HajimeKawahara
HajimeKawahara / legendre_polynomial.py
Created December 23, 2021 23:02
example of Legendre polynomial
from numpy.polynomial.legendre import legval
import numpy as np
import matplotlib.pyplot as plt
coeff=np.array([[1.0,2.0,0.2,0.3],[1.0,1.0,0.2,0.7]]).T
print("coeff shape",np.shape(coeff))
x=np.linspace(-1.0,1.0,100)
f=legval(x, coeff, tensor=True)
print("Lugendre shape",np.shape(f))
for i in range(0,2):
plt.plot(x,f[i,:])
@HajimeKawahara
HajimeKawahara / load_data.py
Created December 21, 2021 00:30
loading data in package
import pkg_resources
filename="data/mockalbedo"+str(nside)+".fits"
fitsfile=(pkg_resources.resource_filename('jaxsot', filename))
mmap=(hp.read_map(fitsfile))
@HajimeKawahara
HajimeKawahara / contrast.py
Created December 17, 2021 06:48
M-type emission contrast
import sys
import argparse
import numpy as np
from astropy import constants as const
from astropy import units as u
def Blambda(T,lamb):
lamb5=(lamb.to(u.m))**5
fac=const.h*const.c/(lamb.to(u.m)*const.k_B*T)
bl=2.0*(const.c**2)*const.h/lamb5/(np.exp(fac)-1)
@HajimeKawahara
HajimeKawahara / variability.py
Created December 17, 2021 06:24
Stellar variability as a function of wavelength
import sys
import argparse
import numpy as np
from astropy import constants as const
from astropy import units as u
def Blambda(T,lamb):
lamb5=(lamb.to(u.m))**5
fac=const.h*const.c/(lamb.to(u.m)*const.k_B*T)
bl=2.0*(const.c**2)*const.h/lamb5/(np.exp(fac)-1)
%General Mission Analysis Tool(GMAT) Script
%Created: 2021-01-22 15:04:08
%----------------------------------------
%---------- Spacecraft
%----------------------------------------
Create Spacecraft Spacecraft;
GMAT Spacecraft.DateFormat = UTCModJulian;
import numpy as np
#compute angular separation [deg] by Vinsenty method
#input [deg deg deg deg]
def sepfast_Vinsenty(ra1,dec1,ra2,dec2):
fac=np.pi/180.0
rax1=ra1*fac
decx1=dec1*fac
rax2=ra2*fac
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.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.