Astropy: get_moon์€ ๋น„ ์Šค์นผ๋ผ ์‹œ๊ฐ„์„ ์ง€์›ํ•˜์ง€ ์•Š์Šต๋‹ˆ๋‹ค.

์— ๋งŒ๋“  2016๋…„ 06์›” 10์ผ  ยท  3์ฝ”๋ฉ˜ํŠธ  ยท  ์ถœ์ฒ˜: astropy/astropy

get_moon ๋Š” ์Šค์นผ๋ผ ์‹œ๊ฐ„์œผ๋กœ ๋งŒ ํ…Œ์ŠคํŠธ๋˜๋ฉฐ ์Šค์นผ๋ผ ์‹œ๊ฐ„ ์ด ์•„๋‹Œ ๊ฒฝ์šฐ ์‹คํŒจํ•ฉ๋‹ˆ๋‹ค.

In [16]: import numpy as np

In [17]: from astropy.coordinates import get_moon

In [18]: from astropy.time import Time

In [19]: import astropy.units as u

In [20]: get_moon(Time.now() + np.linspace(0, 1)*u.day)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-20-7d6db65d30c7> in <module>()
----> 1 get_moon(Time.now() + np.linspace(0, 1)*u.day)

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/solar_system.py in get_moon(time, location, ephemeris)
    376     """
    377
--> 378     return get_body('moon', time, location=location, ephemeris=ephemeris)
    379
    380 get_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/solar_system.py in get_body(body, time, location, ephemeris)
    336         location = time.location
    337
--> 338     cartrep = _get_apparent_body_position(body, time, ephemeris)
    339     icrs = ICRS(cartrep)
    340     if location is not None:

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/solar_system.py in _get_apparent_body_position(body, time, ephemeris)
    283     # used.
    284     if ephemeris == 'builtin' and body.lower() == 'moon':
--> 285         return get_body_barycentric(body, time, ephemeris)
    286
    287     # Calculate position given approximate light travel time.

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/solar_system.py in get_body_barycentric(body, time, ephemeris)
    214             cartesian_position_body = earth_pv_bary[..., 0, :]
    215         elif body == 'moon':
--> 216             cartesian_position_body = calc_moon(time).cartesian.xyz.to(u.au).value
    217         else:
    218             sun_bary = earth_pv_bary[..., 0, :] - earth_pv_helio[..., 0, :]

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/orbital_elements.py in calc_moon(t)
    245                                           equinox=t)
    246
--> 247     return SkyCoord(ecliptic_coo.transform_to(ICRS))

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/baseframe.py in transform_to(self, new_frame)
    847             msg = 'Cannot transform from {0} to {1}'
    848             raise ConvertError(msg.format(self.__class__, new_frame.__class__))
--> 849         return trans(self, new_frame)
    850
    851     def is_transformable_to(self, new_frame):

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/transformations.py in __call__(self, fromcoord, toframe)
    913
    914             curr_toframe = t.tosys(**frattrs)
--> 915             curr_coord = t(curr_coord, curr_toframe)
    916
    917         # this is safe even in the case where self.transforms is empty, because

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/transformations.py in __call__(self, fromcoord, toframe)
    704
    705     def __call__(self, fromcoord, toframe):
--> 706         res = self.func(fromcoord, toframe)
    707         if not isinstance(res, self.tosys):
    708             raise TypeError('the transformation function yielded {0} but '

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/builtin_frames/ecliptic_transforms.py in geoecliptic_to_gcrs(from_coo, gcrs_frame)
     42 @frame_transform_graph.transform(FunctionTransform, GeocentricTrueEcliptic, GCRS)
     43 def geoecliptic_to_gcrs(from_coo, gcrs_frame):
---> 44     rmat = _ecliptic_rotation_matrix(from_coo.equinox)
     45     newrepr = cartrepr_from_matmul(rmat, from_coo, transpose=True)
     46     gcrs = GCRS(newrepr, obstime=from_coo.equinox)

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/builtin_frames/ecliptic_transforms.py in _ecliptic_rotation_matrix(equinox)
     27     rnpb = erfa.pnm06a(jd1, jd2)
     28     obl = erfa.obl06(jd1, jd2)*u.radian
---> 29     return np.asarray(np.dot(rotation_matrix(obl, 'x'), rnpb))
     30
     31

/Users/bmmorris/anaconda/lib/python3.5/site-packages/astropy-1.2.dev15671-py3.5-macosx-10.5-x86_64.egg/astropy/coordinates/angles.py in rotation_matrix(angle, axis, unit)
    716         return np.matrix(((1, 0, 0),
    717                           (0, c, s),
--> 718                           (0, -s, c)))
    719     else:
    720         axis = np.asarray(axis)

/Users/bmmorris/anaconda/lib/python3.5/site-packages/numpy/matrixlib/defmatrix.py in __new__(subtype, data, dtype, copy)
    268
    269         # now convert data to an array
--> 270         arr = N.array(data, dtype=dtype, copy=copy)
    271         ndim = arr.ndim
    272         shape = arr.shape

ValueError: setting an array element with a sequence.

์ด๊ฒƒ์€ PyEphem์—์„œ ์ฒœ์ฒด ํƒœ์–‘๊ณ„ ์ฒœ์ฒด๋ ฅ (์˜ˆ : ์ฒœ์ฒด ๊ณ„ํš / ์ฒœ์ฒด ๊ณ„ํš # 35)์œผ๋กœ ์ฒœ์ฒด ๊ณ„ํš ์Šค์œ„์น˜๋ฅผ ์ฐจ๋‹จํ•ฉ๋‹ˆ๋‹ค.

cc @StuartLittlefair @eteq

Affects-dev Bug coordinates

๋ชจ๋“  3 ๋Œ“๊ธ€

@ bmorris3-๊ทธ๋™์•ˆ ์ด๊ฒƒ์ด ์ฐจ๋‹จ๊ธฐ๊ฐ€๋˜๋Š” ๊ฒƒ์„ ํ”ผํ•˜๊ธฐ ์œ„ํ•ด ์•„๋งˆ๋„ astropy์˜ get_moon ์ฃผ์œ„์— ๋ž˜ํผ๋ฅผ ๋งŒ๋“ค์–ด ์Šค์นผ๋ผ ์‹œ๊ฐ„์„ 1 ์š”์†Œ ๋ฐฐ์—ด๋กœ ์ž๋™ ๋ณ€ํ™˜ ํ•œ ๋‹ค์Œ ๊ฒฐ๊ณผ๋ฅผ ์Šฌ๋ผ์ด์Šค ํ•  ์ˆ˜ ์žˆ์Šต๋‹ˆ๊นŒ?

@ bmorris3 ์ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ•˜๊ธฐ ์œ„ํ•ด PR์„ ์ œ์ถœํ–ˆ์Šต๋‹ˆ๋‹ค (# 5085). ํ˜„์žฌ ๋น„ ์Šค์นผ๋ผ ์‹œ๊ฐ„๊ณผ ๋น„ ์ง€๊ตฌ ์ค‘์‹ฌ ๊ด€์ฐฐ์ž๋ฅผ ์‚ฌ์šฉํ•  ์ˆ˜ ์—†๊ธฐ ๋•Œ๋ฌธ์— ์—ฌ์ „ํžˆ ๋ฌธ์ œ๊ฐ€ ์žˆ์Œ์„ ์•Œ ์ˆ˜ ์žˆ์Šต๋‹ˆ๋‹ค. ์ฆ‰

In [1]: times = Time(["2015-08-28 03:30", "2015-09-05 10:30"])

In [2]: coord.get_moon(times)
Out[2]: 
<SkyCoord (GCRS: obstime=['2015-08-28 03:30:00.000' '2015-09-05 10:30:00.000'], obsgeoloc=[ 0.  0.  0.] m, obsgeovel=[ 0.  0.  0.] m / s): (ra, dec, distance) in (deg, deg, AU)
    [(312.90593078, -13.48302806, 0.00243266),
     (71.86378932, 17.3464189, 0.0025424)]>

์ž˜ ์ž‘๋™ํ•˜์ง€๋งŒ

In [3]: lapalma = coord.EarthLocation.of_site('lapalma')

In [4]: coord.get_moon(times, location=lapalma)
-----------------------------------------------------------------
ValueError                      Traceback (most recent call last)
<ipython-input-4-b157ecbc7846> in <module>()
----> 1 coord.get_moon(times, location=lapalma)

/usr/local/lib/python3.5/site-packages/astropy/coordinates/solar_system.py in get_moon(time, location, ephemeris)
    378     """
    379 
--> 380     return get_body('moon', time, location=location, ephemeris=ephemeris)
    381 
    382 get_moon.__doc__ += indent(_EPHEMERIS_NOTE)[4:]

/usr/local/lib/python3.5/site-packages/astropy/coordinates/solar_system.py in get_body(body, time, location, ephemeris)
    344         gcrs = icrs.transform_to(GCRS(obstime=time,
    345                                       obsgeoloc=obsgeoloc,
--> 346                                       obsgeovel=obsgeovel))
    347     else:
    348         gcrs = icrs.transform_to(GCRS(obstime=time))

/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in __init__(self, *args, **kwargs)
    540 
    541             # Validate input by getting the attribute here.
--> 542             getattr(self, fnm)
    543 
    544         args = list(args)  # need to be able to pop them

/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in __get__(self, instance, frame_cls)
    210             out = self.default
    211 
--> 212         out, converted = self.convert_input(out)
    213         if instance is not None and converted:
    214             setattr(instance, '_' + self.name, out)

/usr/local/lib/python3.5/site-packages/astropy/coordinates/baseframe.py in convert_input(self, value)
    333                 raise ValueError('The provided value has shape "{0}", but '
    334                                  'should have shape "{1}"'.format(value.shape,
--> 335                                                                   self.shape))
    336             if (oldvalue.unit == value.unit and hasattr(oldvalue, 'value') and
    337                 np.all(oldvalue.value == value.value)):

ValueError: The provided value has shape "(3, 2)", but should have shape "(3,)"

๋ถ„๋ช…ํžˆ ๊ทธ๋ ‡์ง€ ์•Š์Šต๋‹ˆ๋‹ค. ์œ„์˜ ๊ฒฝ์šฐ๊ฐ€ ์ž‘๋™ํ•˜๋ ค๋ฉด # 4926์— ๋Œ€ํ•œ ์ˆ˜์ •์ด ํ•„์š”ํ•ฉ๋‹ˆ๋‹ค. ๋‹ค์Œ์— ์‹œ์ž‘ํ•˜๊ฒ ์Šต๋‹ˆ๋‹ค.

๋‚ด๊ฐ€ ํ™•์ธํ–ˆ๊ณ  @ bmorris3 ์˜ ์˜ˆ์ œ๋Š” ์ด์ œ # 5085 ๋ณ‘ํ•ฉ์œผ๋กœ ์ž‘๋™ํ•ฉ๋‹ˆ๋‹ค. @ bmorris3 , ๋ฌธ์ œ # 4926 ํ•ด๊ฒฐ์ด ์˜ํ–ฅ์„ ๋ฏธ์น˜๊ณ  ์žˆ๋‹ค๋ฉด ๋‹ค๋ฅธ ๋ฌธ์ œ๋ฅผ ์ž์œ ๋กญ๊ฒŒ์—ฌ์‹ญ์‹œ์˜ค!

์ด ํŽ˜์ด์ง€๊ฐ€ ๋„์›€์ด ๋˜์—ˆ๋‚˜์š”?
0 / 5 - 0 ๋“ฑ๊ธ‰