Skip to content

Instantly share code, notes, and snippets.

View maedoc's full-sized avatar

marmaduke woodman maedoc

  • aix-marseille university
  • here
View GitHub Profile
@maedoc
maedoc / test-ins-s3.py
Created September 24, 2024 13:47
use minio s3 bucket easily from python
import os
import time
import s3fs
fs = s3fs.S3FileSystem(
endpoint_url="http://10.67.123.1:9000",
key="adni-user",
secret="12345679"
)
@maedoc
maedoc / o3-loop-switch.S
Last active September 18, 2024 21:03
-O3 optimizes away loop/switch for compile time data
bistable:
movaps xmm3, xmm0
movaps xmm1, xmm0
mulss xmm3, xmm0
mulss xmm1, xmm3
divss xmm1, DWORD PTR .LC0[rip]
addss xmm1, xmm0
movaps xmm0, xmm1
mulss xmm0, xmm1
addss xmm0, xmm3
@maedoc
maedoc / fused.c
Last active June 26, 2024 14:54
Fused kernels for simulations
#include<stdbool.h>
#include<stdio.h>
struct sim {
const int rng_seed;
const int num_item;
const int num_node;
const int num_svar;
const int num_time;
@maedoc
maedoc / ahoyn.py
Created March 29, 2024 17:46
simple adaptive Heun integrator
def heun(y, t, dt):
d1 = dfun(y, t)
d2 = dfun(y + dt*d1, t + dt)
err = np.mean(np.abs((d1 - d2)))#/(1e-9+d2)))
return y + dt/2*(d1 + d2), err
def solve_adapt1(y0, ts, tol):
ys = [y0]
max_dt = dt = ts[1] - ts[0]
t0 = ts[0]
@maedoc
maedoc / ndim-visitor-jax.py
Last active December 11, 2023 13:22
Compare visiting N-dimensions with Jax scans vs pre-generated indices with NumPy meshgrid
import os
# use cpu for this
os.environ['CUDA_VISIBLE_DEVICES'] = ''
########################### numpy style
import numpy as np
n = 5
size = 4
@maedoc
maedoc / 23-11-24-localfdr.ipynb
Created November 24, 2023 13:08
a short example of local fdr outlier detection
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-12-gain-ball-geom.ipynb
Created October 12, 2023 11:58
comparing point vs extended geometry for source sensor forward model
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / 23-10-11-taichi-test.ipynb
Created October 12, 2023 08:33
Short test of taichi on tight numerical loops
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / simple-sbi.ipynb
Created October 5, 2023 10:33
Simple examples of simulation based inference
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@maedoc
maedoc / discretized-linear-delays.ipynb
Last active September 11, 2023 15:08
discretized linear delays
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.