Skip to content

Instantly share code, notes, and snippets.

#!/usr/bin/env python
from __future__ import print_function
import sys
import numpy as np
from scipy.ndimage.measurements import center_of_mass
dxy = 0.1
#include<iostream>
int main() {
double total = 0;
double tmp;
while (std::cin >> tmp) {
total += tmp;
}
std::cout << total;
return 0;
#include<iostream>
#include<stdexcept>
#include<string>
void print_usage() {
std::cout << "usage: test [args...]\n"
<< '\n'
<< " help display this message and exit\n"
<< " x <int> set x\n";
}
#!/usr/bin/env python3
"""
Reduce event-by-event observables (multiplicity, Qn vectors) to batch
quantitities (<mult>, flow cumulants) for each design point and centrality.
Creates files <IC name>_<observable>.dat.
"""
import glob
#!/usr/bin/bash
# Provides a command-line interface to generate a bibtex file using Inpire's web tool
# https://inspirehep.net/submit?doctype=bibtex&act=SBI
# Usage: ./generate-bibtex.sh file.tex
curl --silent \
--form "step=1" \
--form "access=`date +%s_%N`" \
--form "act=SBI" \
#!/usr/bin/env python3
""" Read an array from stdin and write to a numpy file. """
import sys
import numpy as np
def main():
import subprocess
# Read a gzipped file from within Python.
# Faster than the standard library gzip module.
# Require Python 3.2+ for context manager support.
with subprocess.Popen(('zcat', filename), stdout=subprocess.PIPE) as proc:
for l in proc.stdout:
pass
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import division, print_function
import sys
import numpy as np
import h5py
@jbernhard
jbernhard / oscar2013.md
Created September 15, 2015 13:54
OSCAR 2013 format specification

OSCAR 2013

This document specifies new formats for

  • hydro full evolution
  • hydro hypersurfaces
  • particle evolution

These formats aim to be as simple and flexible as possible while still containing all necessary information. Ideally, existing files should be convertible by simply prepending several comment lines.

@jbernhard
jbernhard / corrected-woods-saxon
Last active October 13, 2015 16:38
Correct Woods-Saxon distribution diffusivity (surface thickness) for finite nucleon size.
#!/usr/bin/env python3
"""
Determine how finite nucleon size affects the Woods-Saxon distribution.
Specifically, finite nucleons increase the effective diffusivity $a$ (surface
thickness). This script computes the change by convolving the radial
Woods-Saxon function with a Gaussian of width $w$, then fitting the resulting
convolution to a Woods-Saxon with corrected diffusivity $a'$.