Skip to content

Instantly share code, notes, and snippets.

View matthewfeickert's full-sized avatar

Matthew Feickert matthewfeickert

View GitHub Profile
@matthewfeickert
matthewfeickert / README.md
Last active July 15, 2020 03:08
Python dependency thoughts

This got long, so TLDR: Micky's reactions are what I would call "correct". If people want reproducible environments that's great, but pip freeze is not going to get you there.

The answer is (like most things in life) it depends. What are you trying to do? I tend to split along this line into two idea groups: "libraries" and "applications".

At this point I'd suggest that you read the following to make sure that we're on the same page about these words.

Hopefully you read them, but the TLDR on those is:

  • Libraries are supposed to work in an ecosystem of things and so should strive to only require the minimum restrictions on dependencies that will still gaurentee a stable API. Here you probably just want to have the core dependencies be specified with minimum version numbers or
@matthewfeickert
matthewfeickert / .gitignore
Last active July 10, 2020 08:43
xAH CMake FetchContent problem
*.asetup.save
build/
submitDir/
@matthewfeickert
matthewfeickert / CMakeLists.txt
Last active July 1, 2020 06:12
Minimal failing exampe of CMake
cmake_minimum_required (VERSION 3.14 FATAL_ERROR)
set(CMAKE_CXX_STANDARD 14)
project(testing_frugal)
include(FetchContent)
FetchContent_Declare(
nlohmann_json
GIT_REPOSITORY https://github.com/nlohmann/json.git
GIT_TAG v3.8.0
@matthewfeickert
matthewfeickert / roussou_debug.py
Last active October 29, 2020 03:42
David Rousso toys notebook converted to script
import numpy as np
import pyhf
stopRHadron_spec = {
'channels': [
{
'name': 'channel1',
'samples': [
{
'data': [1.364790054231882],
@matthewfeickert
matthewfeickert / README.md
Last active May 17, 2020 05:45
Example for Anna

Example of Python classes and the use of self

Click this button to run an example in Binder:

Binder

As you can see from requirements.txt I've added some fun Python libraries, that are available in the Binder instance so you can use them in this sandbox environment.

@matthewfeickert
matthewfeickert / .gitignore
Last active April 15, 2020 04:46
Giordon CLs example
*.pdf
HistFactory/
validation.txt
.xml2json_output
roundtrip.json
@matthewfeickert
matthewfeickert / hzz.txt
Created January 2, 2020 20:25
CMS Combine toy example
# derived from Table 4 (page 58) of http://arxiv.org/pdf/1312.5353v3
imax 3 number of bins
jmax 2 number of samples minus one
kmax * number of nuisance parameters
--------------------------------------------------------
bin bin4e bin2e2m bin4m
observation 4 13 8
--------------------------------------------------------
bin bin4e bin2e2m bin4m bin4e bin2e2m bin4m bin4e bin2e2m bin4m
@matthewfeickert
matthewfeickert / Dockerfile
Last active October 17, 2019 21:12
A quickly thrown together Dockerfile to get Python 3.8 and Jupyter together
FROM python:3.8
MAINTAINER Matthew Feickert <[email protected]>
USER root
WORKDIR /root
SHELL [ "/bin/bash", "-c" ]
RUN apt-get -qq -y update && \
@matthewfeickert
matthewfeickert / README.md
Last active October 7, 2019 02:34
MG5aMC_PythonMEs Minimal Working Example

MG5aMC_PythonMEs Minimal Working Example

Kyle notified people over email and Twitter that Valentin Hirschi had gotten MadGraph to export matrix element codes for Feynman diagrams into a form that can be used by differentiable machine learning libraries (e.g., TensorFlow and PyTorch). The project is called MG5aMC_PythonMEs. This is a short walkthrough of doing the simplest possible thing: just running the code that MG5aMC_PythonMEs generates. As I don't have much experience with MadGraph5_aMC@NLO and its installation and use instructions are quite bad I threw together a Docker image that at leasts somewhat works. This walkthrough will use that.

To be clear, this is never how you would actually do anything with a Docker image. This is just throwing things against the wall at the moment.

@matthewfeickert
matthewfeickert / README.md
Last active October 1, 2019 01:13
Testing Python Docstrings with doctest and pydocstyle

Testing Python Docstrings with doctest and pydocstyle

Setup

Like any good project, we'll create a virtual environment for this example. You can use your virtual environment tool of choice, but I'm just going to show with Python's venv (and some help from venv-activate)

cd
mkdir venvs
cd venvs