ebachelet / pyLIMA

GNU General Public License v3.0
31 stars 8 forks source link

errors while running pyLIMA_example_3 #43

Closed XinliHao closed 4 years ago

XinliHao commented 4 years ago

When I try to run pyLIMA_example_3, there are some errors occor. I didn't edit the example at all . It remained its initial appearance. I don't know why? wo can help me ? Or who met the same question with me? Thank you so much !

error position:

Name = survey,your_event, location = 'Earth', start_obs =2457465.500000, end_obs = 2457665.500000,

sampling(hours) = 4, location='Earth', uniform_sampling=False, filter = 'I', altitude = 1000 m, longitude = -109.285399,

latitude = -27.130814, bad_weather_percentage = 10%, moon_windows_avoidance (degree)=30,

minimum_alt=30)

my_survey = microlsimulator.simulate_a_telescope('survey',my_own_creation, 2457365.500000,2457965.500000,4, 'Earth','I', uniform_sampling=False, altitude=1000, longitude = -109.285399, latitude = -27.130, bad_weather_percentage=10.0 / 100, moon_windows_avoidance=30, minimum_alt=30) print('Survey simulation done')


TypeError Traceback (most recent call last)

in 6 uniform_sampling=False, altitude=1000, longitude = -109.285399, latitude = -27.130, 7 bad_weather_percentage=10.0 / 100, moon_windows_avoidance=30, ----> 8 minimum_alt=30) 9 print('Survey simulation done') ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/pyLIMA-0.8.2-py3.6.egg/pyLIMA/microlsimulator.py in simulate_a_telescope(name, event, time_start, time_end, sampling, location, filter, uniform_sampling, altitude, longitude, latitude, spacecraft_name, bad_weather_percentage, minimum_alt, moon_windows_avoidance, maximum_moon_illumination) 209 Sun = get_sun(Time(time_of_observations, format='jd')).transform_to(altazframe) 210 Moon = get_moon(Time(time_of_observations, format='jd')).transform_to(altazframe) --> 211 Moon_illumination = moon_illumination(Sun, Moon) 212 Moon_separation = target.separation(Moon) 213 observing_windows = np.where((telescope_altaz.alt > minimum_alt * astropy.units.deg) ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/pyLIMA-0.8.2-py3.6.egg/pyLIMA/microlsimulator.py in moon_illumination(sun, moon) 29 """ 30 ---> 31 geocentric_elongation = sun.separation(moon).rad 32 selenocentric_elongation = np.arctan2(sun.distance * np.sin(geocentric_elongation), 33 moon.distance - sun.distance * np.cos(geocentric_elongation)) ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/astropy-4.1rc1-py3.6-linux-x86_64.egg/astropy/coordinates/sky_coordinate.py in separation(self, other) 1019 from .angle_utilities import angular_separation 1020 -> 1021 if not self.is_equivalent_frame(other): 1022 try: 1023 kwargs = {'merge_attributes': False} if isinstance(other, SkyCoord) else {} ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/astropy-4.1rc1-py3.6-linux-x86_64.egg/astropy/coordinates/sky_coordinate.py in is_equivalent_frame(self, other) 974 for fattrnm in frame_transform_graph.frame_attributes: 975 if not BaseCoordinateFrame._frameattr_equiv(getattr(self, fattrnm), --> 976 getattr(other, fattrnm)): 977 return False 978 return True ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/astropy-4.1rc1-py3.6-linux-x86_64.egg/astropy/coordinates/baseframe.py in _frameattr_equiv(left_fattr, right_fattr) 1337 return False 1338 -> 1339 return np.all(left_fattr == right_fattr) 1340 1341 def is_equivalent_frame(self, other): ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/astropy-4.1rc1-py3.6-linux-x86_64.egg/astropy/coordinates/representation.py in __eq__(self, value) 957 """ 958 # BaseRepresentationOrDifferental (checks classes and compares components) --> 959 out = super().__eq__(value) 960 961 # super() checks that the class is identical so can this even happen? ~/anaconda3/envs/pyLIMAvirtualEnv/lib/python3.6/site-packages/astropy-4.1rc1-py3.6-linux-x86_64.egg/astropy/coordinates/representation.py in __eq__(self, value) 341 """ 342 if self.__class__ is not value.__class__: --> 343 raise TypeError(f'cannot compare: objects must have same class: ' 344 f'{self.__class__.__name__} vs. ' 345 f'{value.__class__.__name__}') TypeError: cannot compare: objects must have same class: CartesianRepresentation vs. NoneType
ebachelet commented 4 years ago

It seems like an Astropy issue. It seems you are using a version which might be not the latest stable, can you try downgrading to the last stable version?

XinliHao commented 4 years ago

It seems like an Astropy issue. It seems you are using a version which might be not the latest stable, can you try downgrading to the last stable version?

wow! Thank you very much !The problem is solved!

ebachelet commented 4 years ago

Great! I close this.