dctools.utilities.misc_utils

Miscellaneous utility functions.

Functions

add_noise_with_snr(signal, snr_db[, seed])

Add Gaussian noise to a NumPy array to achieve a desired SNR (in decibels).

deep_copy_object(obj[, skip_list])

Simplified version that handles special types better.

get_home_path()

Get the user home directory path in a cross-platform way.

list_all_days(start_date, end_date)

Return a list of datetime.datetime objects for each day between dates.

make_serializable(obj)

Make an object JSON serializable.

make_timestamps_serializable(gdf)

Convert datetime columns in a DataFrame to ISO format strings.

nan_to_none(obj)

Recursively replace NaN values with None in an object (dict, list, or scalar).

serialize_optimized(obj)

Convert object to JSON-serializable form efficiently for large structures.

serialize_structure(obj)

Serialize a complex object into JSON and save to file.

to_float32(obj)

Recursively converts all float64 data to float32 in xarray objects or dicts.

transform_in_place(obj, func)

Recursively apply a function to all elements of a nested structure in place.