Skip to content

Instantly share code, notes, and snippets.

View matthewfeickert's full-sized avatar

Matthew Feickert matthewfeickert

View GitHub Profile
@chrisalbon
chrisalbon / gist:9affdbe840ac0a30fd5d0faa63169eb0
Created March 2, 2024 19:18
VSCode Terminal <-> File keyboard shortcut
// Place your key bindings in this file to override the defaults
[
// Toggle between terminal and editor focus
{
"key": "ctrl+`",
"command": "workbench.action.terminal.focus"
},
{
"key": "ctrl+`",
"command": "workbench.action.focusActiveEditorGroup",
@phinate
phinate / yield_prop.py
Last active August 8, 2023 17:11
three ways to propagate yields
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")
#!/bin/bash -e
# check for CMSSW environment
if [ -z "$CMSSW_BASE" ]; then
echo '$CMSSW_BASE not set'
exit 1
fi
# check for python3 in actual CMSSW area
if ! (cd $CMSSW_BASE && scram tool info python3 >& /dev/null); then
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@tacaswell
tacaswell / overlays.md
Created February 11, 2022 00:42
Notes on conda "overlays"

Hot-fixing and extending conda environments

Introduction

We deploy root-owned conda environments which are the basis of the data collection and analysis environments. On one hand because these are owned by root they are write-protected and ensure that users can not accidentally break the environment, on the other hand because they are write-protected they can not be upgraded or extended. While we want to run with a stable, standard, well understood software environment, we do need this

@dantrim
dantrim / linfit2dpix.py
Last active February 1, 2022 18:57
Fitting a 2D pixel matrix over "time" steps (or some other independent quantity)
import numpy as np
# create dummy two-dimensional (3x3) data that represents
# per-pixel measured quantities taken at various "time steps"
# (say, 4 of such steps):
pixel_maps = np.asarray([
[
[0, 0, 0],
[2, 2, 2],
[3, 3, 3],
@dantrim
dantrim / update_register.sh
Last active June 11, 2021 22:44
Updates an integer value of a field at a specific path
#!/bin/bash
# This is an example showing how to update a value of a specified key
# (that is potentially nested) in a JSON file using shell variables
# in some shell script. For example, some utility for updatiing in-place
# a common set of fields in a JSON configuration file.
# In the snippet below, we assume that the input is a key ("register_name")
# in some nested JSON object whose path is "RD53B.GlobalConfig".
filename=${1}
@matthewfeickert
matthewfeickert / README.md
Last active March 4, 2024 06:24
Motivation for using Python virtual environments for easy sharing
@dantrim
dantrim / hbd.py
Last active May 30, 2021 20:59
HBD
#!/usr/bin/env python
import pytest
import some_lib
@pytest.fixture
def not_a_day_over():
return 29
def test_current_age(not_a_day_over):
@kratsg
kratsg / ATLASSUSY_ReproducibleSummaryPlots.ipynb
Last active December 7, 2023 10:59
ATLAS SUSY Reproducible Summary Plots
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.