Content moved to this repo!
This file contains 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
#!/usr/bin/env janet | |
(use sh) | |
(import cmd) | |
# terminal formatting | |
(defn format [v] | |
(def t {:green "\e[0;32m" | |
:red "\e[0;31m" | |
:yellow "\e[0;33m" |
This file contains 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 | |
# Author: Simon Mutch <smutch.astro@gmail.com> | |
# Date: 2018-08-14 | |
set -e # error on exit | |
get_log_dir() { | |
echo "$JOBFS/log_mps-$1" | |
} |
This file contains 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 | |
import h5py as h5 | |
import matplotlib.pyplot as plt | |
from pathlib import Path | |
DATA_PATH = Path("tree_images.h5") | |
ID = "619000000001104" | |
with h5.File(DATA_PATH, "r") as fp: | |
image = fp[f"{ID}/mass"][:] |
This file contains 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
{"schemaVersion":1,"label":"coverage","message":"84%","color":"green"} |
This file contains 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
#!/usr/bin/env bash | |
bstat=( $(pmset -g batt | grep -Eo '[0-9]+%.*' | awk '{print($1,$2)}' | tr -d ";") ) | |
percentage=$(echo "${bstat[0]}" | tr -d "%") | |
case $(( | |
(percentage >= 0 && percentage < 25) ? 1 : | |
(percentage >= 25 && percentage < 50) ? 2 : | |
(percentage >= 50 && percentage < 75) ? 3 : |
This file contains 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
# --- | |
# jupyter: | |
# jupytext: | |
# formats: ipynb,py:percent | |
# text_representation: | |
# extension: .py | |
# format_name: percent | |
# format_version: '1.3' | |
# jupytext_version: 1.11.3 | |
# kernelspec: |
This file contains 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 | |
import xarray as xa | |
import h5py as h5 | |
from pathlib import Path | |
from tqdm import tqdm | |
GRIDS_DIR = Path("PATH_GOES_HERE") | |
def grid_path(snapshot: int, sub: int): | |
return GRIDS_DIR / f"snapshot_{snapshot:03d}.den.{sub}" |
This file contains 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 | |
import xarray as xa | |
import h5py as h5 | |
PATH_IN = "/fred/oz078/smutch/intensity_mapping/baseline/imapping_testrun/HIMass_grids.h5" | |
SNAPSHOT = 250 # z=0 | |
with h5.File(PATH_IN, "r") as fp: | |
ds = fp[f"Snap{SNAPSHOT:03d}"] | |
box_size = ds.attrs["box_size"][:] |
This file contains 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
#!/usr/bin/env python | |
"""Test the Genesis grids totals against cosmology. This is to help K Ren (see email 2020-03-17).""" | |
__author__ = "Simon Mutch" | |
__date__ = "2020-03-18" | |
from pathlib import Path | |
import logging |
NewerOlder