Skip to content

Instantly share code, notes, and snippets.

@xzackli
xzackli / settings.json
Created July 19, 2023 19:15
vscocde settings (CITA)
{
"python.terminal.activateEnvironment": false,
"python.defaultInterpreterPath": "/fs/lustre/cita/zack/miniconda3/bin/",
"terminal.integrated.env.linux": {
"XDG_CACHE_HOME": "/fs/lustre/cita/zack/cache/",
"JULIA_DEPOT_PATH": "/fs/lustre/cita/zack/jl"
},
"julia.additionalArgs": [
],
using Bolt
using Plots
𝕡 = CosmoParams(Ω_c=0.224) # set kwargs like so to change the default values
bg = Background(𝕡)
𝕣 = Bolt.RECFAST(bg; OmegaB=𝕡.Ω_b, Yp=𝕡.Y_p, OmegaG=𝕡.Ω_r, Tnow=2.725)
@time rhist = Bolt.recfastsolve(𝕣);
using ReverseDiff
using ReverseDiff: GradientTape, compile
import ForwardDiff
using Interpolations
function test_diff(p)
t = 0.0:0.1:10.0
u = sin.(4 .* t)
small_tiles 0.44394799401034324
large_tiles 0.4916475503080907
high_cadence_constant_scan_1_el 0.40603891843921086
high_cadence_constant_scan_3_el 0.5005072385162868
high_cadence_variable_scan 0.4041414803590428
@xzackli
xzackli / integration_variable.jl
Last active August 15, 2022 16:51
bolt integration variable test
# using Revise
using Bolt
using Plots
using Printf
using Interpolations, DataInterpolations
using DelimitedFiles
using OrdinaryDiffEq
import Bolt: PerturbationIntegrator, unpack, hierarchy!, initial_conditions, δ_kron
using OffsetArrays
@xzackli
xzackli / benchmark_matmul_vs_sht.md
Last active March 12, 2022 19:32
benchmarking a big matrix-vector multiplication vs SHT

I'm running this on with Pixell.jl on the alm2map branch. I need to find time to write some unit tests before I merge that branch to master. Benchmark results are on a 16-core AMD EPYC.

using Pixell, BenchmarkTools, Tullio
using Pixell: degree, arcminute  # not exported by default

## let's make up a big patch similar to ACT DR6 / SO view of the southern sky
box = [180   -180;            # RA
       -70     30] * degree   # DEC
shape, wcs = geometry(CarClenshawCurtis, box, 8 * arcminute)  # note: 8x downgraded from native ACT/SO maps
; Function Attrs: willreturn mustprogress
define nonnull {} addrspace(10)* @preprocess_julia__ODEFunction_15_4335({ [12 x {} addrspace(10)*] } %0, {} addrspace(10)* nocapture nofree nonnull readnone %1) local_unnamed_addr #3 !dbg !9 {
entry:
%2 = call {}*** @julia.get_pgcstack() #4
%3 = call cc38 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)**, i32, {} addrspace(10)*)* @jl_invoke to {} addrspace(10)* ({} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*, {} addrspace(10)*)*)({} addrspace(10)* addrspacecast ({}* inttoptr (i64 139935024279360 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 139935249317888 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 139934913746984 to {}*) to {} addrspace(10)*), {} addrspace(10)* addrspacecast ({}* inttoptr (i64 139939739935008 to {}*) to {} addrspace(10)*)) #4, !dbg !10
%4 = call cc37 nonnull {} addrspace(10)* bitcast ({} addrspace(10)* ({} addrspace(10)*
@xzackli
xzackli / julia_package_kit.md
Last active March 13, 2021 19:38
quick set of instructions for

Step 1

Create a package locally using PkgTemplates

using PkgTemplates
t = Template(;
    user="YOURGITHUBUSERNAME",
    authors="YOUR ACTUAL NAME",
 julia=v"1.5",
import numpy as np
import healpy as hp
import matplotlib.pyplot as plt
import pymaster as nmt
# This script showcases the ability of namaster to compute Gaussian
# estimates of the covariance matrix.
# A similar example for flat-sky fields can be found in
# test/sample_covariance_flat.py
#------Experiments to test (separated with commas)-----
data.experiments=['act_s1316_sim','Planck_lensing','Planck_lowl','Planck_highl_TTTEEE_lite']
#------ Parameter list -------
# data.parameters[class name] = [mean, min, max, 1-sigma, scale, role]
# - if min max irrelevant, put to None
# - if fixed, put 1-sigma to 0