mirror of
https://github.com/Richard-Sti/csiborgtools_public.git
synced 2025-05-21 01:51:11 +00:00
Add printing
This commit is contained in:
parent
960c8b5945
commit
4b038e8d01
2 changed files with 8 additions and 1 deletions
|
@ -16,7 +16,7 @@ from csiborgtools import clustering, field, match, read, summary
|
||||||
|
|
||||||
from .utils import (center_of_mass, delta2ncells, number_counts, # noqa
|
from .utils import (center_of_mass, delta2ncells, number_counts, # noqa
|
||||||
periodic_distance, periodic_distance_two_points, # noqa
|
periodic_distance, periodic_distance_two_points, # noqa
|
||||||
binned_statistic, cosine_similarity) # noqa
|
binned_statistic, cosine_similarity, fprint) # noqa
|
||||||
|
|
||||||
|
|
||||||
# Arguments to csiborgtools.read.Paths.
|
# Arguments to csiborgtools.read.Paths.
|
||||||
|
|
|
@ -15,6 +15,7 @@
|
||||||
"""Collection of stand-off utility functions used in the scripts."""
|
"""Collection of stand-off utility functions used in the scripts."""
|
||||||
import numpy
|
import numpy
|
||||||
from numba import jit
|
from numba import jit
|
||||||
|
from datetime import datetime
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
# Positions #
|
# Positions #
|
||||||
|
@ -262,3 +263,9 @@ def binned_statistic(x, y, left_edges, bin_width, statistic):
|
||||||
if numpy.any(mask):
|
if numpy.any(mask):
|
||||||
out[i] = statistic(y[mask])
|
out[i] = statistic(y[mask])
|
||||||
return out
|
return out
|
||||||
|
|
||||||
|
|
||||||
|
def fprint(msg, verbose=True):
|
||||||
|
"""Print and flush a message with a timestamp."""
|
||||||
|
if verbose:
|
||||||
|
print(f"{datetime.now()}: {msg}", flush=True)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue