@@ -121,7 +121,7 @@ def noise_coeval_power_spectrum_1d(ncells, z, depth_mhz, obs_time=1000, subarray
121121 return pn , kn , n_modes
122122 return pn , kn
123123
124- def noise_map (ncells , z , depth_mhz , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , total_int_time = 6. , int_time = 10. , declination = - 30. , uv_map = None , N_ant = None , uv_weighting = 'natural' , sefd_data = None , nu_data = None , fft_wrap = False , verbose = True ):
124+ def noise_map (ncells , z , depth_mhz , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , total_int_time = 6. , int_time = 10. , declination = - 30. , uv_map = None , N_ant = None , uv_weighting = 'natural' , sefd_data = None , nu_data = None , fft_wrap = False , verbose = True , suppress_sharp_features_uv_map = False ):
125125 """
126126 It creates a noise map by simulating the radio observation strategy (1801.06550).
127127
@@ -167,7 +167,7 @@ def noise_map(ncells, z, depth_mhz, obs_time=1000, subarray_type="AA4", boxsize=
167167 noise_real = np .random .normal (loc = 0.0 , scale = rms_noi , size = (ncells , ncells ))
168168 noise_imag = np .random .normal (loc = 0.0 , scale = rms_noi , size = (ncells , ncells ))
169169 noise_arr = noise_real + 1.j * noise_imag
170- noise_four = apply_uv_response_noise (noise_arr , uv_map , boxsize = boxsize , uv_weighting = uv_weighting )
170+ noise_four = apply_uv_response_noise (noise_arr , uv_map , boxsize = boxsize , uv_weighting = uv_weighting , suppress_sharp_features_uv_map = suppress_sharp_features_uv_map )
171171 # noise_four = apply_uv_response_noise_briggs(noise_arr, uv_map, robust=2.0, epsilon=1e-6)
172172 win_2d = signal_window (ncells , 'blackmanharris' , ndim = 2 )
173173 noise_four = noise_four * np .fft .fftshift (win_2d )
@@ -191,12 +191,15 @@ def _suppress_sharp_features_uv_map(uv_map, boxsize=None, method='gaussian', fil
191191 print (f'{ method } to suppress sharp features in the uv maps is not supported. Choose from "gaussian", "binned".' )
192192 return uv_map_smooth
193193
194- def apply_uv_response_noise (noise , uv_map , boxsize = None , uv_weighting = 'natural' , uv_map_min = 0.01 ):
194+ def apply_uv_response_noise (noise , uv_map , boxsize = None , uv_weighting = 'natural' , uv_map_min = 0.01 , suppress_sharp_features_uv_map = False ):
195195 '''
196196 Apply the effect of uv coverage on the noise array.
197197 '''
198198 if uv_weighting .lower () in ['nat' , 'natural' , 'natural_weighting' ]:
199- uv_map_smooth = _suppress_sharp_features_uv_map (uv_map , boxsize = boxsize , method = 'binned' , filter_param = 15 )
199+ if suppress_sharp_features_uv_map :
200+ uv_map_smooth = _suppress_sharp_features_uv_map (uv_map , boxsize = boxsize , method = suppress_sharp_features_uv_map , filter_param = 15 )
201+ else :
202+ uv_map_smooth = uv_map
200203 out = noise / np .sqrt (uv_map_smooth )
201204 elif uv_weighting .lower () in ['uni' , 'uniform' , 'uniform_weighting' ]:
202205 out = noise
@@ -368,7 +371,7 @@ def apply_uv_response_on_coeval(array, z, subarray_type="AA4", boxsize=None, tot
368371 data3d [:,:,k ] = data2d
369372 return data3d
370373
371- def noise_cube_coeval (ncells , z , depth_mhz = None , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , total_int_time = 6. , int_time = 10. , declination = - 30. , uv_map = None , N_ant = None , uv_weighting = 'natural' , verbose = True , fft_wrap = False , sefd_data = None , nu_data = None ):
374+ def noise_cube_coeval (ncells , z , depth_mhz = None , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , total_int_time = 6. , int_time = 10. , declination = - 30. , uv_map = None , N_ant = None , uv_weighting = 'natural' , verbose = True , fft_wrap = False , sefd_data = None , nu_data = None , suppress_sharp_features_uv_map = False ):
372375 """
373376 It creates a noise coeval cube by simulating the radio observation strategy (1801.06550).
374377
@@ -421,13 +424,13 @@ def noise_cube_coeval(ncells, z, depth_mhz=None, obs_time=1000, subarray_type="A
421424 print ("Creating the noise cube..." )
422425 sleep (1 )
423426 for k in tqdm (range (ncells ), disable = not verbose ):
424- noise2d = noise_map (ncells , z , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data )
427+ noise2d = noise_map (ncells , z , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data , suppress_sharp_features_uv_map = suppress_sharp_features_uv_map )
425428 noise3d [:,:,k ] = noise2d
426429 if verbose :
427430 print ("...noise cube created." )
428431 return jansky_2_kelvin (noise3d , z , boxsize = boxsize )
429432
430- def noise_cube_lightcone (ncells , z , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , save_uvmap = None , total_int_time = 6. , int_time = 10. , declination = - 30. , N_ant = None , uv_weighting = 'natural' , fft_wrap = False , verbose = True , n_jobs = 4 , checkpoint = 64 , sefd_data = None , nu_data = None ):
433+ def noise_cube_lightcone (ncells , z , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , save_uvmap = None , total_int_time = 6. , int_time = 10. , declination = - 30. , N_ant = None , uv_weighting = 'natural' , fft_wrap = False , verbose = True , n_jobs = 4 , checkpoint = 64 , sefd_data = None , nu_data = None , suppress_sharp_features_uv_map = False ):
431434 """
432435 It creates a noise cube by simulating the radio observation strategy (1801.06550)
433436 considerng the input redshift (z) as the central slice of the cube.
@@ -549,14 +552,14 @@ def noise_cube_lightcone(ncells, z, obs_time=1000, subarray_type="AA4", boxsize=
549552 if k + 1 < zs .size : depth_mhz = np .abs (cm .z_to_nu (zs [k + 1 ])- cm .z_to_nu (zs [k ]))
550553 else : depth_mhz = np .abs (cm .z_to_nu (zs [k ])- cm .z_to_nu (zs [k - 1 ]))
551554 uv_map , N_ant = uvs ['{:.3f}' .format (zi )], uvs ['Nant' ]
552- noise2d = noise_map (ncells , zi , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , verbose = verbose , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data )
555+ noise2d = noise_map (ncells , zi , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , verbose = verbose , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data , suppress_sharp_features_uv_map = suppress_sharp_features_uv_map )
553556 noise3d [:,:,k ] = jansky_2_kelvin (noise2d , zi , boxsize = boxsize )
554557 verbose = False
555558 if verbose :
556559 print ('z = {:.3f} | {:.2f} % completed' .format (zi ,100 * (k + 1 )/ zs .size ))
557560 return noise3d
558561
559- def noise_lightcone (ncells , zs , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , save_uvmap = None , total_int_time = 6. , int_time = 10. , declination = - 30. , N_ant = None , uv_weighting = 'natural' , fft_wrap = False , verbose = True , n_jobs = 4 , checkpoint = 64 , sefd_data = None , nu_data = None ):
562+ def noise_lightcone (ncells , zs , obs_time = 1000 , subarray_type = "AA4" , boxsize = None , save_uvmap = None , total_int_time = 6. , int_time = 10. , declination = - 30. , N_ant = None , uv_weighting = 'natural' , fft_wrap = False , verbose = True , n_jobs = 4 , checkpoint = 64 , sefd_data = None , nu_data = None , suppress_sharp_features_uv_map = False ):
560563 """
561564 It creates a noise lightcone by simulating the radio observation strategy (1801.06550).
562565 We assume the third axis to be along the line-of-sight and therefore
@@ -680,7 +683,7 @@ def noise_lightcone(ncells, zs, obs_time=1000, subarray_type="AA4", boxsize=None
680683 else :
681684 depth_mhz = np .abs (cm .z_to_nu (zs [k ])- cm .z_to_nu (zs [k - 1 ]))
682685 uv_map , N_ant = uvs ['{:.3f}' .format (zi )], uvs ['Nant' ]
683- noise2d = noise_map (ncells , zi , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , verbose = verbose , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data )
686+ noise2d = noise_map (ncells , zi , depth_mhz , obs_time = obs_time , subarray_type = antxyz , boxsize = boxsize , total_int_time = total_int_time , int_time = int_time , declination = declination , uv_map = uv_map , N_ant = N_ant , uv_weighting = uv_weighting , verbose = verbose , fft_wrap = fft_wrap , sefd_data = sefd_data , nu_data = nu_data , suppress_sharp_features_uv_map = suppress_sharp_features_uv_map )
684687 noise3d [:,:,k ] = jansky_2_kelvin (noise2d , zi , boxsize = boxsize )
685688 if verbose :
686689 print ('\n z = {:.3f} | {:.2f} % completed' .format (zi ,100 * (k + 1 )/ zs .size ))
0 commit comments