Skip to content

Add interstellar scattering to ps_inject#244

Open
hudsonbridg wants to merge 3 commits into
chime-sps:mainfrom
hudsonbridg:final_injection_scattering
Open

Add interstellar scattering to ps_inject#244
hudsonbridg wants to merge 3 commits into
chime-sps:mainfrom
hudsonbridg:final_injection_scattering

Conversation

@hudsonbridg

Copy link
Copy Markdown

Added a function to ps_inject that applies interstellar scattering. The implementation models scattering using the thin-screen approximation with an exponential pulse broadening function that scales with frequency. This is applied via convolution using a frequency-summed effective kernel, constructed by weighting per-channel pulse broadening functions according to a pulsar spectral index (beta) and summing across the CHIME band.

Adjustable parameters:
alpha : scattering spectral index
beta : pulsar spectral index
tauref : reference scattering timescale
nuref : reference frequency

Scattering can be disabled by setting tauref = 0.

This addition allows for more realistic injections by accounting for interstellar scattering.

This work is the core implementation of an undergraduate thesis completed at UBC.

@larskuenkel

larskuenkel commented May 25, 2026

Copy link
Copy Markdown
Contributor

I had a first look now. Sorry for the delay!

One limitation of the current implimentation is that you are summing over the CHIME band and applying this to input profile. So the summed profile at the correct DM will look as expected but there might be a small difference on the adjacent DMs. Not sure if there is any noticeable difference.

We could merge this without this limitation and Rey or I can look if we can figure out if there is a need to change anything in the future.


return prof_fft, phases

def scattering(self, prof_fft, n_harm, alpha=-4.4, beta=-1.6,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is a bit odd in a class function to define arguments, that the function can just pull fheir attributes. So you could remove these arguments and instead just use self.alpha, self.beta, ... in this function.

# Transform kernel to Fourier harmonics
K = rfft(k_eff, n=nbin)
K_harm = K[1 : n_harm + 1]
prof_fft *= K_harm

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the K_harm normalized in a way, in order to change the signal strength as would be expected from scattering? Rey probably know better than me.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scattering kernel is going to be way too powerful unless you prenormalize it. The rfft in scipy automatically scales by sqrt(N) so in this case ~sqrt(1000)... you can use the known RMS noise in the power spectrum to prenormalize your scattering kernel before taking the rfft, or more simply, normalize post facto by dividing by the 1st harmonic.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a look and I think there is no jump in power currently when using the scattering. When adding a small scattering time scale, the total injected powers remains pretty much the same as without it and drops of when a longer time scale is used.

So I think it might be fine.

# CHIME constants
bandmin = 400.0
bandmax = 800.0
nchan = 16384

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can add a line importing the first two from sps_constants. As for nchan, it will vary with pointing... need to pull from the power spectrum object.

bstart = bandmin + dnu / 2.0
bend = bandmax - dnu / 2.0
obsfreq = np.linspace(bstart, bend, nchan)
tsamp = 1000.0 / (self.f * nbin)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Where is the 1000 coming from?

@reyniersquillace reyniersquillace left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this would benefit from a presentation by Hudson on the telecon and discussion as a group!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants