[AstroPy] problems with astroplan

Steven Boada boada at physics.rutgers.edu
Mon Nov 7 14:43:45 EST 2016


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

-- 

Steven Boada

Postdoctoral Researcher
Rutgers University
boada at physics.rutgers.edu




More information about the AstroPy mailing list