[AstroPy] problems with astroplan

Gautham Narayan gnarayan at noao.edu
Mon Nov 7 15:53:00 EST 2016


Hi Steven,

Specify the time as well as the date. 2016-11-11 is being parsed at 
2016-11-11 00:00:00 UTC, at which point it's only 5pm here in AZ, so 
it's not yet civil twilight at Kitt Peak.

print(astroplan.is_observable(constraint, kpno, target[:1], 
times=[Time('2016-11-11 12:15:00')]))
# prints True

Cheers,
-Gautham




On 11/07/2016 01:48 PM, Steven Boada wrote:
> I Gautham,
>
> OK, maybe my example was a little misleading. I mentioned what the 
> example should do, but it isn't what I expect it to do.
>
> Basically, I am trying to figure out if my object is observable from 
> KPNO, and then I am going to use all the fancy scheduling stuff in 
> astroplan to figure out which objects I want to observe when. The 
> problem is that the line that prints false is checking whether or not 
> my object is observable. I know it *is* observable, so I don't 
> understand why it is printing false instead of true.
>
> As Eric mentioned, it is probably something to do with the observation 
> times, but I can't seem to find what I am missing. I want the example 
> to print True True instead of True False.
>
> Thanks for your help.
>
> steven
>
> On 11/07/2016 03:43 PM, Gautham Narayan wrote:
>> Hi Steven,
>>
>> Maybe I'm missing something but you're example is supposed to print 
>> True and then False. That's what is in the comments even.
>>
>>
>> print(kpno.target_is_up(start_time, target))
>> # should print True
>>
>> print(astroplan.is_observable(constraint, kpno, target[:1], 
>> times=Time('2016-11-11')))
>> # should print false.
>>
>> Cheers,
>> -Gautham
>>
>>
>>
>>
>> On 11/07/2016 12:43 PM, Steven Boada wrote:
>>> Hi Eric,
>>>
>>> I apologize for my example not working. That is what I get for 
>>> typing it out in the same console I had been testing things in. Here 
>>> is a much more complete example.
>>>
>>> I've specified the timezone, but it still prints True and then False.
>>>
>>> import astroplan
>>> from astroplan import Observer, FixedTarget
>>> from astroplan.constraints import AtNightConstraint
>>> from astropy.coordinates import SkyCoord
>>> from astropy.time import Time
>>>
>>> # make telescope location
>>> kpno = Observer.at_site('KPNO', timezone='MST')
>>>
>>> # make target coordinates
>>> coords = SkyCoord(131.1331774, 62.41165761, unit='deg', frame='icrs')
>>>
>>> # make all the targets
>>> target = [FixedTarget(name='test', coord=coords)]
>>>
>>> # make the observing time
>>> start_time = Time('2016-11-10 18:54:00')
>>> end_time = Time('2016-11-11 5:27:00')
>>> time_delta = end_time - start_time
>>> observable_time = start_time + time_delta * np.linspace(0,1,75)
>>>
>>> print(kpno.target_is_up(start_time, target))
>>> # should print True
>>>
>>> # now we try to do all the fancy scheduling
>>> # set our only constraint to be at night
>>> constraint = AtNightConstraint.twilight_civil()
>>>
>>> print(astroplan.is_observable(constraint, kpno, target[:1], 
>>> times=Time('2016-11-11')))
>>> # should print false.
>>>
>>> Thanks again.
>>>
>>> On 11/07/2016 02:36 PM, Eric L. N. Jensen wrote:
>>>> Hi Steven,
>>>>
>>>> Since you don’t specify a timezone on your start_time variable, I’m 
>>>> guessing that it is probably being interpreted as UTC, in which 
>>>> case your specified target isn’t up at KPNO.
>>>>
>>>> You don’t show an import statement that would define your call to 
>>>> “Time” so I’m not 100% sure what routine it is and how it’s 
>>>> interpreting the specified time, but being sure about timezones is 
>>>> where I’d start troubleshooting this.
>>>>
>>>> Eric
>>>>
>>>>
>>>>> On Nov 7, 2016, at 2:22 PM, Steven Boada 
>>>>> <boada at physics.rutgers.edu> wrote:
>>>>>
>>>>> Hi list,
>>>>>
>>>>> I'm headed to KPNO and I'm trying out astroplan for the first 
>>>>> time. But I'm getting some confusing output. Here's an example.
>>>>>
>>>>> from astroplan import Observer, FixedTarget
>>>>> from astropy.coordinates import SkyCoord
>>>>>
>>>>> # make telescope location
>>>>> kpno = Observer.at_site('KPNO')
>>>>>
>>>>> # make target coordinates
>>>>> coords = SkyCoord(131.1331774, 62.41165761, unit='deg', frame='icrs')
>>>>>
>>>>> # make all the targets
>>>>> target = [FixedTarget(name='test', coord=coords)]
>>>>>
>>>>> # make the observing time
>>>>> start_time = Time('2016-11-11 01:54:00')
>>>>> end_time = Time('2016-11-11 12:30:00')
>>>>> time_delta = end_time - start_time
>>>>> observable_time = start_time + time_delta * np.linspace(0,1,75)
>>>>>
>>>>> print(kpno.target_is_up(start_time, target))
>>>>> # should print True
>>>>>
>>>>> # now we try to do all the fancy scheduling
>>>>> # set our only constraint to be at night
>>>>> constraint = AtNightConstraint.twilight_civil()
>>>>>
>>>>> print(astroplan.is_observable(constraint, kpno, targets[:1], 
>>>>> times=Time('2016-11-11')))
>>>>> # should print false.
>>>>>
>>>>>
>>>>> Looking up the airmass etc. on the web, the target is certainly 
>>>>> visible from KPNO. I'm obviously missing something, but I can't 
>>>>> seem to figure out what it is.
>>>>>
>>>>> Thanks for your help.
>>>>>
>>>>>
>>>>> steven
>>>>>
>>>>>
>>>>> -- 
>>>>>
>>>>> Steven Boada
>>>>>
>>>>> Postdoctoral Researcher
>>>>> Rutgers University
>>>>> boada at physics.rutgers.edu
>>>>>
>>>>> _______________________________________________
>>>>> AstroPy mailing list
>>>>> AstroPy at scipy.org
>>>>> https://mail.scipy.org/mailman/listinfo/astropy
>>>> _______________________________________________
>>>> AstroPy mailing list
>>>> AstroPy at scipy.org
>>>> https://mail.scipy.org/mailman/listinfo/astropy
>>>
>>
>>
>


-- 
Dr. Gautham Narayan
NOAO/UA
950 N. Cherry Ave., Rm. 118
Tucson, AZ 85719
(309) 531-1810




More information about the AstroPy mailing list