Open itachi-gf opened 1 year ago
Hi @itachi-gf, you can do this two ways (sorry, the docs should be updated...):
foregrounds.diffuse_foreground(lsts, fqs, bl_vec)
(i.e. drop the Tsky_mdl). The bl_vec
should be a length-3 array of the baseline vector in nano-seconds.fg = foregrounds.DiffuseForeground(Tsky_mdl); fg(lsts, fqs, bl_vec)
if you want control over the sky model -- by default I think it probably uses the Tsky model you were trying to use anyway (but @r-pascua can confirm). Hi @itachi-gf, you can do this two ways (sorry, the docs should be updated...):
- Use
foregrounds.diffuse_foreground(lsts, fqs, bl_vec)
(i.e. drop the Tsky_mdl). Thebl_vec
should be a length-3 array of the baseline vector in nano-seconds.- Use
fg = foregrounds.DiffuseForeground(Tsky_mdl); fg(lsts, fqs, bl_vec)
if you want control over the sky model -- by default I think it probably uses the Tsky model you were trying to use anyway (but @r-pascua can confirm).
Hello, I want to use this to simulate RFI for creating a training set for deep learning. Which part should I refer to?
Hi @itachi-gf, sorry for the slow response. An alternative to @steven-murray's suggestion is to do the following:
vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, freqs, bl_vec, Tsky_mdl=Tsky_mdl)
Just like Steven said, you need to provide the baseline vector, not just the length, so that the simulator can figure out the appropriate fringe-rate filter to use.
Regarding simulating RFI, you can use the tools in the rfi
module, but the RFI generated by the various routines is much more simplistic than real RFI. What's the purpose of the deep learning training set you're trying to make? Are you trying to make something that can detect RFI, something that can emulate RFI, or something that can fill in flagging gaps? Depending on your goal, I think I'd have different suggestions for things to try.
Hope this helps!
Hi,@r-pascua ,Thank you for your response! I intend to create a model capable of detecting RFI, such as a UNet. In this regard, I could use some guidance and suggestions. Could you please let me know how I should get started?
Tsky_mdl = noise.HERA_Tsky_mdl['xx'] vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, freqs, bl_vec, Tsky_mdl=Tsky_mdl)
ValueError Traceback (most recent call last) Cell In[9], line 2 1 Tsky_mdl = noise.HERA_Tsky_mdl['xx'] ----> 2 vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, freqs, bl_vec, Tsky_mdl=Tsky_mdl)
File ~/rfi_code/hera_sim/hera_sim/foregrounds.py:134, in DiffuseForeground.call(self, lsts, freqs, bl_vec, **kwargs) 128 raise ValueError( 129 "A sky temperature model must be specified in " 130 "order to use this function." 131 ) 133 if omega_p is None: --> 134 raise ValueError( 135 "A beam area array or interpolation object is " 136 "required to use this function." 137 ) 139 # support passing beam as an interpolator 140 if callable(omega_p):
ValueError: A beam area array or interpolation object is required to use this function.
Since you're using the sky temperature model appropriate for the phase I instrument, I'd like to suggest that you instead do the following:
import hera_sim
hera_sim.defaults.set("h1c")
# whatever code you have leading up to this next line
vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, freqs, bl_vec)
Regarding your question about RFI, I suppose the tools available in hera_sim.rfi
could serve as a starting point for testing your RFI detection tool, but the RFI that hera_sim
simulates is going to be very easy to detect, and it is not very realistic. So, the tools provided in hera_sim.rfi
are potentially appropriate for testing your RFI detection tool, but would not make a good training set for a tool designed to be used on real data.
Tsky_mdl = noise.HERA_Tsky_mdl['xx'] vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, fqs, bl_len_ns, Tsky_mdl)
TypeError Traceback (most recent call last) Cell In[14], line 2 1 Tsky_mdl = noise.HERA_Tsky_mdl['xx'] ----> 2 vis_fg_diffuse = foregrounds.diffuse_foreground(lsts, fqs, bl_len_ns, Tsky_mdl)
TypeError: DiffuseForeground.call() takes 4 positional arguments but 5 were given
Following the documentation's instructions, I encountered an issue at this point. Could you please advise on how to resolve it? My system is Ubuntu 22.04, and the Python version is 3.11