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 _flatten_dict(dct: dict[str, Any]) -> list[str]: | |
| # for each key: | |
| # - find values | |
| # - if dict: recurse | |
| # - elif list: recurse for each item | |
| # - else: check if bool. | |
| # - if bool and True, compose a string that you pass around | |
| # to join the param names. | |
| # This was coded for a specific use-case and YAML design; it should | |
| # be fairly straightforward to adapt to produce just the keys. |
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 pyproj | |
| import pyresample | |
| import xarray | |
| import numpy as np | |
| def lon_lat_to_geostationary_area_coords( | |
| x: float, | |
| y: float, |
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
| .editor-group-watermark > .letterpress{ | |
| background-image: url("https://raw.githubusercontent.com/Aikoyori/ProgrammingVTuberLogos/main/VSCode/VSCode-Thick.png") !important; | |
| opacity: .75; | |
| aspect-ratio: 3/2 !important; | |
| } |
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
| .editor-group-watermark > .letterpress{ | |
| background-image: url("https://raw.githubusercontent.com/Aikoyori/ProgrammingVTuberLogos/main/VSCode/VSCode-Thick.png") !important; | |
| opacity: .75; | |
| aspect-ratio: 3/2 !important; | |
| } |
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 xarray | |
| variables = [ | |
| 'u_component_of_wind', | |
| 'v_component_of_wind', | |
| 'geopotential', | |
| 'temperature', | |
| # ... full list of variables here: https://console.cloud.google.com/storage/browser/gcp-public-data-arco-era5/ar/1959-2022-full_37-1h-0p25deg-chunk-1.zarr-v2;tab=objects?pli=1&prefix=&forceOnObjectsSortingFiltering=false | |
| ] |
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 json | |
| import pyhf | |
| from pyhf.contrib.utils import download | |
| import cabinetry | |
| download("https://www.hepdata.net/record/resource/1935437?view=true", "bottom-squarks") | |
| ws = pyhf.Workspace(json.load(open("bottom-squarks/RegionC/BkgOnly.json"))) | |
| patchset = pyhf.PatchSet(json.load(open("bottom-squarks/RegionC/patchset.json"))) | |
| ws = patchset.apply(ws, "sbottom_600_280_150") | |
| cabinetry.workspace.save(ws, "bottom-squarks.json") |
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 jax.scipy as jsp | |
| import equinox as eqx | |
| import jax.numpy as jnp | |
| from jax import Array | |
| import jax | |
| jax.config.update("jax_enable_x64", True) | |
| @jax.jit |
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 polars as pl | |
| import os | |
| import shutil | |
| q = ( | |
| pl.scan_csv("l.csv") | |
| ) | |
| df = q.collect() |
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 os | |
| import glob | |
| from re import sub | |
| import subprocess | |
| for fname in glob.glob("images/*.pdf"): | |
| subprocess.run( | |
| [ | |
| "inkscape", | |
| "--pdf-poppler", |
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 annotations | |
| from jax import numpy as jnp | |
| from typing import Any | |
| def convert_jax(spec: dict[str, Any]) -> None: | |
| for key, value in spec.items(): | |
| value_type = type(value) | |
| if value_type == dict: | |
| convert_jax(value) |
NewerOlder