How to calculate limiting magnitude as a function of exposure time and location on the sky?

I want to calculate magnitude limits (m5, I presume) as a function of exposure time, for particular location on the sky for Rubin. I am new to this area and so would appreciate any orientation.

I’ve been searching through the LSST GitHub for different repositories on how I may do this but am not sure what’s the best direction to go in. I’ve found SMTN-002 which appears to do this easily but for zenith only. I recently found the rubin_sim_notebooks repository, which contains notebooks which look to be close to what I’m looking for, but not quite.

In short, I’m looking for a LSST tool for which I can input a ugrizY band, an RA/Dec, and an exposure time (perhaps also number of exposures), which will return a limiting magnitude. What’s the closest resource to this tool?

Hi @melanieAzaidel, thanks for this question.

I have a short code snippet that will get you an estimate of the coadded m5 depth for a given band, for a given cumulative exposure time, below. It does not include the effects atmospheric extinction (which is a function of airmass, for an individual visit), nor Galactic extinction and reddening (which is a function of RA,Dec).

import numpy as np

def coadd_m5(band, exptime):

    # From SMTN-002:
    single_visit_m5 = {'u': 23.70, 'g': 24.97,
                       'r': 24.52, 'i': 24.13,
                       'z': 23.56, 'y': 22.55}

    single_visit_exptime = 30.0

    svm5 = single_visit_m5[band]
    Nv = exptime / 30.0
    result = svm5 + (1.25 * np.log10(Nv))

    return result

print('r-band, m5 depth for one 30s exposure: ', coadd_m5('r', 30.0))
print('r-band, m5 depth for ten 30s exposures: ', coadd_m5('r', 300.0))
print('r-band, m5 depth for one hundred 30s exposures: ', coadd_m5('r', 3000.0))

The results will be:
r-band, m5 depth for one 30s exposure: 24.52
r-band, m5 depth for ten 30s exposures: 25.77
r-band, m5 depth for one hundred 30s exposures: 27.02

If this is sufficient for your purposes, please mark this reply post as the solution? And if it doesn’t, let us know and we can continue the conversation.

Hi, thank you for this snippet, this is definitely helpful as a initial estimate.

I’d like to determine the detectability of specific sources by Rubin, and so I’m ideally looking for a tool which will at least account for Galactic extinction and reddening.

Specifically, I want to know for a particular source of known magnitude and RA/Dec, how long Rubin would need to observe to reach the magnitude of the source. How can I involve effects of the atmosphere and Galaxy?

You might find this notebook I just added helpful.
Calculate m5 any visit

What this notebook does is show you how to calculate the limiting magnitude for any hypothetical visit at any RA/Dec (you do need the time in order to do this correctly, to evaluate the airmass for the visit), as requested in your first question.

I saw you also were wondering about coadded depths, so I also showed how to calculate coadded depth, and also about dust extinction effects, so I added an illustration of that as well. As you noted at first – the tools in rubin_scheduler/rubin_sim are there, they just weren’t put together to do quite what you asked.

That said, I’m not sure it’s quite what you ended up asking about. If you have a source of known magnitude, this known magnitude likely already includes galactic extinction and you would just want to compare this to the coadded m5 achieved in a set of visits. And if you’re trying to evaluate a set of visits, you could either look at the variable individual visit image depth (if you knew when the visits occurred) or you could use an estimate of the m5 depth as Melissa demonstrated (knowing that this is just an estimate, and in reality the depth will vary and include different airmass extinction, different seeing, and different skybrightness). If you wanted to include at least some estimate for these effects, you could evaluate the best airmass your source is likely to reach, given its declination and the latitude of Rubin and then use this as the basis for the airmass extinction and effect on the FWHM … the skybrightness will remain variable, but you might be able to use some median values from the baseline simulation (see the MAF metrics at usdf-maf.slac.stanford.edu etc).

Thanks @ljones!!

@melanieAzaidel if Lynne’s post and notebook sufficiently answer your question, please mark that post as the solution? And as always, if not, let us know and we can continue to help.

Thank you @ljones! That notebook and those pieces of advice give me a lot to work with, and seems to be very close to exactly what I’m looking for. From here I think I can figure out more by trying the various estimates out myself.

I really appreciate the very kind and rapid responses! :smile: