astroplan icon indicating copy to clipboard operation
astroplan copied to clipboard

Months observable gives unexpected result

Open knservis opened this issue 3 years ago • 3 comments

Hi,

I was trying the following:

from astroplan.constraints import AtNightConstraint
from astroplan import Observer, FixedTarget, months_observable
mwa = Observer.at_site('Murchison Widefield Array')
bs = FixedTarget.from_name('Barnard star')
months_observable(constraints=[AtNightConstraint.twilight_civil()], observer=mwa, targets=[bs])

gives me [{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12}]

I was expecting to get about 6 months for that star of dec ~+4d

Is this a bug or just me?

knservis avatar Nov 06 '21 07:11 knservis

Hi,

If you edit your code to the following:

from astroplan.constraints import AtNightConstraint, AirmassConstraint
from astroplan import Observer, FixedTarget, months_observable

mwa = Observer.at_site('Murchison Widefield Array')
bs = FixedTarget.from_name('Barnard star')
constraints = [AtNightConstraint.twilight_astronomical(), AirmassConstraint(max=1.5)]
months_observable(constraints=constraints, observer=mwa, targets=[bs])

You'll get a result more like what you're expecting: [{3, 4, 5, 6, 7, 8, 9, 10}].

The main problem here is that you haven't defined any type of altitude or airmass constraint, and none is included by default. So it's counting any time that is night time as an observable time, even when the target is not above the horizon.

Does anyone subscribed have opinions about whether or not we should catch this corner case? Clearly targets below the horizon are not observable, but right now we don't catch the case when the user supplies no altitude-constraint and force it to pass times only when the alt > 0.

bmorris3 avatar Nov 08 '21 07:11 bmorris3

Hi @bmorris3

Thank you for that workaround, which I did use but I thought that the above was a bug and that is why I reported it. I am not sure what the intended intention of constraints is but it seems counter-intuitive. What is the intended meaning of AtNightContraint? At night anywhere in the world? I took it to mean nighttime between the specified twilight for the observer..

knservis avatar Nov 08 '21 11:11 knservis

What is the intended meaning of AtNightContraint?

This is specific to the observatory that you specify as the observer in the months_observable call.

I took it to mean nighttime between the specified twilight for the observer..

Correct.

bmorris3 avatar Nov 08 '21 12:11 bmorris3