These are chat archives for astropy/astropy

Apr 2017
Gregory Green
Apr 06 2017 23:38
I have a question about some timings I've been doing of the SkyCoord code.
Reshaping a SkyCoord (in v1.3.2) seems to take several orders of magnitude longer than reshaping a numpy array
Reshaping a SkyCoord (frame="galactic", no distances) from (20,10,3) to (200,3) takes 30 ms in my tests. Reshaping a single numpy.ndarray (dtype="f8") with the same initial and final shapes takes 0.0004 ms in my tests (it's basically indistinguishable from zero time).
Does anyone have any idea why that would be?
My methodology was to run timeit.repeat twice for each test. The first run creates the SkyCoord (or numpy array) with random data over and over again, but doesn't reshape it. The second run does the same, but reshapes it. I take the difference of the two times as the time to reshape the object.
Gregory Green
Apr 06 2017 23:50
One more interesting hint about this: as far as I can tell, the 30 ms to reshape a SkyCoord does not scale at all with the size of the SkyCoord. Reshaping from (2,1,3) -> (2,3) takes exactly as much time as reshaping from (20,10,3) -> (200,3).