question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Coordinates performance regression in 4.3

See original GitHub issue

This code runs in 0.8 seconds in astropy 4.2 but 40 seconds in astropy 4.3

from ctapipe.coordinates import CameraFrame
import astropy.units as u
from astropy.coordinates import EarthLocation, AltAz, SkyCoord
from astropy.time import Time
import numpy as np
from time import perf_counter


N = 100000
location = EarthLocation.of_site('Roque de los Muchachos')
obstime = Time.now() + np.linspace(0, 1, N) * u.hour

altaz = AltAz(location=location, obstime=obstime)
alt = np.full(N, 70) * u.deg
az = np.full(N, 180) * u.deg
pointing = SkyCoord(alt=alt, az=az, frame=altaz)

x = np.random.uniform(-1, 1, N) * u.m
y = np.random.uniform(-1, 1, N) * u.m

t0 = perf_counter()
camera_frame = CameraFrame(focal_length=28 * u.m, obstime=obstime, location=location, telescope_pointing=pointing)
coords = SkyCoord(x=x, y=y, frame=camera_frame)
t1 = perf_counter()
print(t1 - t0)

CameraFrame implementation here: https://github.com/cta-observatory/ctapipe/blob/master/ctapipe/coordinates/camera_frame.py

I’ll check and comeback with profiling

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:18 (18 by maintainers)

github_iconTop GitHub Comments

1reaction
ayshihcommented, Sep 27, 2021

Ah, I see that quirk is actually a major part of the problem here. Can you change the function at the bottom of astropy/coordinates/builtin_frames/cirs_observed_transforms.py to this:

@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, AltAz, AltAz)
@frame_transform_graph.transform(FunctionTransformWithFiniteDifference, HADec, HADec)
def observed_to_observed(from_coo, to_frame):
    if from_coo.is_equivalent_frame(to_frame):  # loopback to the same frame
        return to_frame.realize_frame(from_coo.data)
    # for now we just implement this through CIRS to make sure we get everything
    # covered
    return from_coo.transform_to(CIRS(obstime=from_coo.obstime)).transform_to(to_frame)
0reactions
maxnoecommented, Sep 28, 2021

Ok, I included the changes in #12203

Read more comments on GitHub >

github_iconTop Results From Across the Web

Full-Frame Scene Coordinate Regression for Image-Based ...
manner, we propose to perform the scene coordinate regression ... ordinate CNN to achieve good localization performance. ... 4.3cm, 2.1◦. 4.7cm, 1.3◦.
Read more >
Chapter 4 Generalized Linear Models (GLM)
Logistic regression and probit regression for binary data. ... The glmnet package uses cyclical coordinate descent which successively optimizes the ...
Read more >
Performance Enhancement of Logistic Regression for Big ...
4.3 Performance Analysis with Different Settings of Data Memory Ratio . . 40. 4.3.1 Testing parameters and input conditions (fixed memory size) ....
Read more >
COORDINATE DESCENT ALGORITHMS FOR NONCONVEX ...
In this paper we investigate the application of coordinate descent algorithms to SCAD and MCP regression models, for which the penalty is nonconvex....
Read more >
Spatial prediction of apartment rent using regression - arXiv
Abstract. Employing a large dataset (at most, the order of n = 106), this study attempts enhance the literature on the comparison between...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found