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
from astropy.coordinates import SkyCoord, ICRS, LSR | |
import astropy.units as u | |
import numpy as np | |
from numpy.linalg import norm | |
# convert from degrees to radian | |
deg = np.pi / 180.0 | |
# coordinates of AK Sco | |
# 16 54 44.8497760618 -36 53 18.560813962 |
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 | |
from matplotlib import pyplot as plt | |
from sklearn.gaussian_process import GaussianProcessRegressor | |
from sklearn.gaussian_process.kernels import RBF, WhiteKernel | |
plt.style.use("seaborn-v0_8-white") | |
# Training data is y values representing the brightness profile | |
y_train = np.array( |
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 | |
from astropy.io import fits | |
def get_extent(header): | |
"""Get extent (in RA and Dec, units of [arcsec]) of image""" | |
# get the coordinate labels | |
nx = header["NAXIS1"] | |
ny = header["NAXIS2"] |
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
# custom dataset loader | |
class UVDataset(torch_ud.Dataset): | |
r""" | |
Container for loose interferometric visibilities. | |
Args: | |
uu (2d numpy array): (nchan, nvis) length array of u spatial frequency coordinates. Units of [:math:`\mathrm{k}\lambda`] | |
vv (2d numpy array): (nchan, nvis) length array of v spatial frequency coordinates. Units of [:math:`\mathrm{k}\lambda`] |
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 torch | |
from torch import nn | |
import numpy as np | |
import pyro | |
import pyro.distributions as dist | |
from torch.distributions import constraints | |
from pyro.nn import PyroModule, PyroParam, PyroSample | |
from pyro.infer import Predictive, MCMC, NUTS |
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 matplotlib.pyplot as plt | |
import numpy as np | |
n = 100000 | |
x = np.random.normal(size=n) | |
y = np.random.normal(size=n) | |
pkw = {"marker": "o", "alpha": 0.1, "mew": 0, "ms": 2, "ls": ""} | |
fig, ax = plt.subplots(nrows=1) |
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
(finufft_install) ➜ finufft git:(master) ✗ make python3 | |
g++ -c -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp src/spreadinterp.cpp -o src/spreadinterp.o | |
g++ -c -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp src/utils.cpp -o src/utils.o | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c -o src/finufft1d.o src/finufft1d.cpp | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c -o src/finufft2d.o src/finufft2d.cpp | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c -o src/finufft3d.o src/finufft3d.cpp | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c -o src/dirft1d.o src/dirft1d.cpp | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c -o src/dirft2d.o src/dirft2d.cpp | |
g++ -fPIC -O3 -I src -Xpreprocessor -fopenmp -DNEED_EXTERN_C -Xpreprocessor -fopenmp -c - |
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 | |
from scipy.io import readsav | |
from matplotlib import pyplot as plt | |
w_idl = readsav("w_rl23.2142") | |
w = w_idl["w"] # wavelengths in AA | |
fl_idl = readsav("rl23.2127") | |
f = fl_idl["sp"] # fluxes in arbitrary units |
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 | |
c_kms = 2.99792458e5 # km/s | |
dv = 0.5 # km/s | |
wl_start = 5000.0 | |
wl_end = 5100.0 | |
CDELT1 = np.log10(dv/c_kms + 1.) |
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
date, PA, PA_err, rho, rho_err | |
1949.650 , 160. , . , . , . | |
1952.86 , . , . , 0.119 , . | |
1952.88 , . , . , 0.107 , . | |
1953.89 , . , . , 0.119 , . | |
1955.99 , . , . , 0.110 , . | |
1959.98 , 341.9, . , 0.111 , . | |
1962.01 , 344.3, . , 0.117 , . | |
1963.03 , . , . , 0.113 , . | |
1964.016 , 161.2, . , 0.280 , . |
NewerOlder