Skip to content

Instantly share code, notes, and snippets.

View iphysresearch's full-sized avatar
🏛️
researching .....

He Wang iphysresearch

🏛️
researching .....
View GitHub Profile
@iphysresearch
iphysresearch / pt_level_5.py
Created May 31, 2025 09:10
A complete example of a pipeline algorithm in Python provided by the framework.
import numpy as np
import scipy.signal as signal
from scipy.signal.windows import tukey
from scipy.signal import savgol_filter
def pipeline_v2(strain_h1: np.ndarray, strain_l1: np.ndarray, times: np.ndarray) -> tuple[np.ndarray, np.ndarray, np.ndarray]:
"""
The pipeline function processes gravitational wave data from the H1 and L1 detectors to identify potential gravitational wave signals.
It takes strain_h1 and strain_l1 numpy arrays containing detector data, and times array with corresponding time points.
The function returns a tuple of three numpy arrays: peak_times containing GPS times of identified events,
@iphysresearch
iphysresearch / git-prompt.sh
Created September 8, 2024 15:16
git-prompt.sh
# bash/zsh git prompt support
#
# Copyright (C) 2006,2007 Shawn O. Pearce <spearce@spearce.org>
# Distributed under the GNU General Public License, version 2.0.
#
# This script allows you to see repository status in your prompt.
#
# To enable:
#
# 1) Copy this file to somewhere (e.g. ~/.git-prompt.sh).
@iphysresearch
iphysresearch / conda_auto_env.sh
Created September 8, 2024 15:13
conda_auto_env.sh
#!/bin/bash
# automatically activates conda environments when entering directories
# with a conda environment file which must be named one of
# - env(ironment).y(a)ml
# - requirements.y(a)ml
# if env doesn't exist yet, create it; deactivate env when exciting folder
# installation: copy chpwd() to .bashrc or save the whole script as
# file and source it in .bashrc, e.g. by placing it in /usr/local/bin
# or by symlinking conda_auto_env there
@iphysresearch
iphysresearch / spline.py
Created December 2, 2023 16:55 — forked from kazewong/spline.py
Cubic Spline with lineax
import lineax as lx
import jax.numpy as jnp
import jax
from jaxtyping import Float, Array
class CubicSpline:
x_grid: Float[Array, str("batch")] # input x data
y_grid: Float[Array, str("n")] # input y data
@iphysresearch
iphysresearch / README.md
Created November 24, 2023 08:04 — forked from typebrook/README.md
A bash script for gist management #bash #gist
@iphysresearch
iphysresearch / git-prompt-with-conda-auto-env.sh
Last active September 8, 2024 16:10
Git prompt with conda and conda-auto-env
#!/bin/bash
# Ensure the script uses bash
# REF: https://albertotb.com/Git-prompt-with-conda-and-conda-auto-env/
# add the following to the end of your ~/.bashrc file:
GREEN="\[\033[38;5;155m\]"
DARK_GREEN="\[\033[00;32m\]"
GRAY="\[\033[38;5;8m\]"
ORANGE="\[\033[38;5;220m\]"
BLUE="\[\033[38;5;117m\]"
@iphysresearch
iphysresearch / ds-project-organization.md
Created October 25, 2023 09:44 — forked from ericmjl/ds-project-organization.md
How to organize your Python data science project

How to organize your Python data science project

Having done a number of data projects over the years, and having seen a number of them up on GitHub, I've come to see that there's a wide range in terms of how "readable" a project is. I'd like to share some practices that I have come to adopt in my projects, which I hope will bring some organization to your projects.

Disclaimer: I'm hoping nobody takes this to be "the definitive guide" to organizing a data project; rather, I hope you, the reader, find useful tips that you can adapt to your own projects.

Disclaimer 2: What I’m writing below is primarily geared towards Python language users. Some ideas may be transferable to other languages; others may not be so. Please feel free to remix whatever you see here!

Disclaimer 3: I found the Cookiecutter Data Science page after finishing this blog post. Many ideas overlap here, though some directories are irrelevant in my work -- which is to

@iphysresearch
iphysresearch / cumulative_numbe_of_GWevents.py
Last active November 5, 2020 09:42
Python script to plot cumulative number of events vs days in O1, O2, O3 (not including breaks). See more: https://iphysresearch.github.io/blog/post/gw/cumulative_numbe_of_gwevents/
import numpy as np
import datetime
import matplotlib.pyplot as plt
gw_event = [20150914,20151012,20151226, # O1 events
20170104,20170608,20170729,20170809,20170814,20170817,20170818,20170823,
20190408,20190412,20190413,20190413,20190421,20190424,20190425,20190426,
20190503,20190512,20190513,20190514,20190517,20190519,20190521,20190521,
20190527,20190602,20190620,20190630,20190701,20190706,20190707,20190708,
20190719,20190720,20190727,20190728,20190731,20190803,20190814,20190828,
@iphysresearch
iphysresearch / MFCNN.py
Last active September 14, 2021 01:40
Chapter 6 - MFCNN
import mxnet as mx
from mxnet import nd, gluon
from mxnet.gluon.nn import Dense, ELU, LeakyReLU, LayerNorm, Conv2D, MaxPool2D, Flatten, Activation, Dropout
import os, sys, datetime
from loguru import logger
#### REF #### https://loguru.readthedocs.io/en/stable/api/logger.html
# DEBUG 10 # INFO 20 # WARNING 30 # ERROR 40 # CRITICAL 50
config = {
"handlers": [
@iphysresearch
iphysresearch / C4_mass_dis.py
Created June 2, 2020 06:32
Chapter 4 - Mass distribution
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
sns.set(context='paper',
style='ticks',
font_scale=1,
rc={'figure.figsize': (8, 5),
'figure.dpi': 100, # need fixed
'xtick.direction': 'in',