Code to calculate emittance from butterfly