atompy.save_1d_as_txt#
- atompy.save_1d_as_txt(histogram, edges, fname, **savetxt_kwargs)[source]#
Save a 1d histogram to a file.
Saves the centers of the bin, not the edges.
- Parameters:
- histogram
ndarray, shape(n,) The histogram values.
- edgesndarray, shape(n+1,)`
Edges of histogram.
- **savetxt_kwargs
numpy.savetxt()keyword arguments. Useful to, e.g., set a header with theheaderkeyword.
- histogram
Examples
samples = np.random.default_rng().normal(size=1_000) h, edges = np.histogram(samples, 50) ap.save_1d_as_txt(h, edges, "filename.txt")