Pandas HDF5: Adding FAST System Noise to Simulate Observed Maps
import pandas as pd import numpy as np
add FAST system noise on the blur map to simulate true observed map
sigma = 800 # \mu Jy, Standard Deviation of noise
read map
filepath = '/home/wangjiaxin/final/blurred/flux_blurred_all_gal_300f.hdf5' with pd.HDFStore(filepath, mode='r') as store: S_df = store['S'] xbin_df = store['x_bin_edge'] ybin_df = store['y_bin_edge'] fbin_df = store['nu_bin_edge']
add noise
noise = np.random.normal(0, sigma, S_df.shape) newdata = S_df + noise
save
output = '/home/dyliu/Filament/TNG_100/flux_blurred_all_gal_300f_800n.hdf5' with pd.HDFStore(output, mode='w') as store: store['S'] = newdata store['x_bin_edge'] = xbin_df store['y_bin_edge'] = ybin_df store['nu_bin_edge'] = fbin_df
This code demonstrates how to add realistic system noise from the FAST telescope to a blurred astronomical map, simulating a true observed map.
The code uses the Pandas library and HDF5 file format for efficient data handling.
The pd.HDFStore function is used to read and write data from the HDF5 file.
The np.random.normal function is used to generate random noise with the specified standard deviation.
The code adds the noise to the blurred map and then saves the new data to a new HDF5 file.
This code can be used to simulate realistic observations of astronomical sources, which can then be used to test different data analysis techniques.
原文地址: https://www.cveoy.top/t/topic/nesk 著作权归作者所有。请勿转载和采集!