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
alias feh='feh --keep-zoom-vp' | |
alias dus='du -s -BM * | sort -n' | |
alias carta='docker run -ti -p 3002:3002 -v $PWD/.carta:/home/cartauser/.carta -v $PWD:/images cartavis/carta --no_log' | |
docker-shell() { | |
# Help message | |
if [[ "$1" == "--help" ]]; then | |
echo "Usage: docker-shell [user|root] [image_name] [cpu|gpu]" | |
echo "Default: docker-shell user debian:buster-slim cpu" |
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
#!/bin/bash | |
conda create -n cal_benchmark python=3.11 | |
conda activate cal_benchmark | |
pip install jax[cuda12] jaxlib 'numpy<2' nvtx | |
python standalone_lm_multi_step.py | |
conda deactivate |
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 python:3.11.7 | |
RUN apt-get update && apt-get install -y gdb lldb sudo rsync \ | |
build-essential cmake g++ gcc python3 python3-pip \ | |
python3-numpy python3-nose python3-setuptools libcfitsio-dev \ | |
libhdf5-dev libboost-dev gfortran flex bison libblas-dev liblapack-dev \ | |
libfftw3-dev | |
# install CASA |
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 sympy as sp | |
pi = sp.pi | |
def perley_lmn_from_icrs(alpha, dec, alpha0, dec0): | |
dra = alpha - alpha0 | |
l = sp.cos(dec) * sp.sin(dra) | |
m = sp.sin(dec) * sp.cos(dec0) - sp.cos(dec) * sp.sin(dec0) * sp.cos(dra) |
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 __future__ import (absolute_import, unicode_literals, division, print_function) | |
from astropy.coordinates import AltAz | |
from astropy.coordinates.attributes import (TimeAttribute, EarthLocationAttribute) | |
from astropy.coordinates.baseframe import (BaseCoordinateFrame, RepresentationMapping, frame_transform_graph) | |
from astropy.coordinates.representation import (CartesianRepresentation) | |
from astropy.coordinates.transformations import FunctionTransform | |
class ENU(BaseCoordinateFrame): |
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 collections import deque | |
class FairAsyncRLock: | |
""" | |
A fair reentrant lock for async programming. Fair means that it respects the order of acquisition. | |
""" | |
def __init__(self): | |
self._owner: asyncio.Task | None = None | |
self._count = 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
def fill_in_empty_cells(voxels, length_scale_voxels=3, support=9, zero_threshold=1e-5): | |
""" | |
Fill in zero-values (or values less than zero_threshold) with smoothed values. | |
Leave the non-zero bins as they are. | |
Args: | |
voxels: [batch, voxels_per_dimension, voxels_per_dimension, voxels_per_dimension, num_properties] | |
support: float, length scale for exponential kernel how "near" in pixels to interpolate. | |
support: int, how big to make the kernel, should be big enough that there are no regions of this size without a value. |
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
def speed_test_jax(): | |
import numpy as np | |
from jax import jit, value_and_grad, random, numpy as jnp | |
from jax.scipy.optimize import minimize as minimize_jax | |
from scipy.optimize import minimize as minimize_np | |
import pylab as plt | |
from timeit import default_timer | |
import jax | |
JAX_VERSION = jax.__version__ |
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
def speed_test_jax(): | |
import numpy as np | |
from jax import jit,value_and_grad, random | |
from jax.scipy.optimize import minimize as minimize_jax | |
from scipy.optimize import minimize as minimize_np | |
import pylab as plt | |
from timeit import default_timer | |
S = 3 |
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
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
<ipython-input-65-a4128a1c8e7f> in <module>() | |
14 gp = pm.gp.Marginal(cov_func=cov_func) | |
15 f = gp.marginal_likelihood('f',X,y,0.1) | |
---> 16 f_star = gp.conditional('fstar',Xnew) | |
17 | |
~/anaconda3/envs/kerastf/lib/python3.6/site-packages/pymc3-3.3rc2-py3.6.egg/pymc3/gp/gp.py in conditional(self, name, Xnew, pred_noise, given, **kwargs) | |
501 |
NewerOlder