In the previous articles I presented a number of calculated results about Astrotracer.
→ Astrotracer ① "Why Do the Stars Stay Sharp While the Ground Blurs?"
→ Astrotracer ② "How Long Should You Track the Stars?"
→ Astrotracer ③ "Why Do Stars Still Trail Near the Edges with an Ultra-Wide Lens?"
For example, that the same 60 seconds produces different amounts of ground blur at different focal lengths.
That even where the stars are well held at the center of the frame, tracking residuals appear near the edges with ultra-wide lenses.
And in Astrotracer ③ "Why Do Stars Still Trail Near the Edges with an Ultra-Wide Lens?" I also showed that, comparing an ordinary ultra-wide lens and a fisheye at the same field of view, the fisheye gave the smaller tracking residual in this model.
At which point some readers may have thought:
"By the way, Murata — how exactly did you calculate that 'N px'?"
Fair enough: writing only "the calculation gave 24.14 px," without explaining that part, looks like lining up numbers that came out of a machine.
So in this article I explain how the numbers used in Astrotracer ①–③ were actually obtained.
Let me say up front that the calculation code itself was written with AI.
But it is not the case that I asked an AI
"calculate Astrotracer's error"
and used the numbers it returned as they were.
What is being modeled.
What conditions are given.
What is being measured as the "error."
Whether it can reproduce results that are already known.
I built the calculation model while checking each of those in turn.
And what it actually does, setting the formulas aside, is surprisingly simple.
Fig. 1: How the "N px" in ①–③ is produced. The starting point is working backwards from a point in the frame to the sky, not placing stars in the sky first. In practice the residual is computed at each sampled time and at each grid point in the frame, and this article compares the maximum of those. It is an idealized model, and does not reproduce PENTAX's control.
Take a look at the diagram above first.
1 First, lay out stars on the frame
The first thing I did was
lay out grid points on the sensor
For the full-frame model used here, the sensor is 35.9 × 24.0 mm.
Points are spaced evenly across it.
Each point is treated as
"a star is recorded here."
This surprised me a little when I first heard it.
I had assumed the calculation would go in the order
"place stars in the sky, then photograph them with the camera."
It is actually the reverse.
You first fix a position in the frame, and then work backwards to
"in which direction does the star recorded at this position actually lie in the sky?"
This way, every star being calculated is guaranteed to fall inside the frame.
It also lets you examine the corners as evenly as the center.
2 Work backwards from a point in the frame to a direction in the sky
Next, those grid points are traced backwards through the lens.
In ordinary shooting it goes
star in the sky → lens → sensor
Here it goes the other way:
sensor → lens → sky
Think of it as "inverse projection."
That gives a three-dimensional direction:
"the star recorded here in the upper right of the frame lies in this direction as seen from the camera."
What matters at this step is that the projection differs by lens.
3 An ordinary wide-angle and a fisheye map stars onto the frame differently
The reason Astrotracer ③ could compare fisheye lenses is that this is the part that was changed.
An ordinary wide-angle lens uses the common projection that renders straight lines as straight lines.
Fisheyes use other projections, such as
equidistant projection
equisolid-angle projection
stereographic projection
In other words,
for stars at the same angular distance from the center of the sky, where they land on the sensor differs by lens
With an ordinary wide-angle lens, for instance, the image is stretched more and more toward the edges of the frame.
A fisheye bends straight lines but, in exchange, compresses and stretches the periphery differently.
The reason Astrotracer ③ could investigate
"isn't a fisheye worse for Astrotracer?"
is that this projection formula was swapped out and the same sky recalculated.
In the actual code, in addition to rectilinear for the ordinary wide-angle case, several projections including fisheye types are implemented, and the comparison at matched field of view uses the three fisheye projections.
4 Rotate the Earth by 60 seconds
That gives the positions of the stars at the start of the exposure.
Next, advance time.
Say the exposure is 60 seconds.
The Earth keeps rotating during those 60 seconds.
The model uses the sidereal rotation rate,
7.2921159 × 10⁻⁵ rad/s
You do not need to memorize that number, of course.
What matters is that the angle
"this is how far the Earth has turned after 60 seconds"
is computed, and the directions of the stars are rotated by that amount.
Strictly speaking, it is not the sky itself that is being rotated: what is calculated is which way the stars appear to move as seen from the camera because of the Earth's rotation.
That gives
the sky at the start of the exposure
and
the sky 60 seconds later
5 Project the 60-second-later stars through the lens again
Next, the stars 60 seconds later are put through the lens once more.
That gives the positions:
a star that was here at the start arrives here in the frame after 60 seconds
In a fixed exposure, that is basically the trailing of the stars.
But here we are considering Astrotracer.
Astrotracer follows this motion of the stars by moving the image sensor.
So the next calculation follows.
6 How should the sensor move to bring the stars back?
PENTAX's sensor-shift mechanism can
shift the image sensor in X
shift it in Y
rotate it about the optical axis
These three degrees of freedom are not something I invented for this article; they are a mechanism described in the related patents.
So in the model as well, the calculation is
take the stars that moved over 60 seconds and try to bring them back to their original positions using the sensor's X/Y shift plus rotation
The important thing here is that
this does not claim that the actual PENTAX moves the sensor using the same calculation as this program
The real control algorithm is not known.
What I wanted to know is something more basic:
with only the ability to shift a flat sensor up, down, left and right and rotate it, how far can the motion of the whole sky be cancelled?
That is what is being examined.
7 Even when everything is matched, a little error remains
This is where Astrotracer ③ connects.
Looking only near the center of the frame, the stars can be matched quite cleanly.
Look at the whole frame, however, and
not every star returns exactly to its original position.
One star comes back almost perfectly.
Another is slightly off.
In the corners it is off by more.
That offset is the
tracking residual
that appeared again and again in Astrotracer ①–③.
8 What exactly does the "N" in "tracking residual N px" measure?
This is the part I most want to explain in this article.
The number in
"tracking residual 24.14 px"
is not an average.
Nor is it a value measured only in the corners.
Nor is it the length of the trail a star drew.
The actual calculation also divides the exposure into time steps and examines the positions of the stars.
Then, for
each sampled time × each grid point in the frame
it measures
"after tracking by moving the sensor, how far is it still from its original position?"
Of those, the
largest offset
is what the articles quote as "N px."
So 24.14 px means
at the worst place and the worst moment within the exposure time and frame area examined here, about 24.14 px of offset remained
It does not mean an average of 24.14 px.
9 Why the maximum rather than the average
Thinking about photographs makes this easy to see.
Suppose there are 100 stars in the frame.
99 of them are almost perfectly held.
But one, in a corner, is trailing badly.
Take the average in that state and you may get quite a small number.
To someone looking at the photograph, however,
that one badly trailed star is visible.
So in these articles I used the maximum in order to see
"how far across the frame can the stars be held?"
rather than
"how well are they matched on average?"
This is not a metric PENTAX uses for product evaluation.
It is the evaluation method I chose for thinking about tracking residual in these articles.
10 "Match the center" and "match the whole frame as well as possible" were calculated separately
Fig. 2: For the same motion of the celestial sphere, both the size and the distribution of the remaining error change depending on how you assume the sensor's X/Y shift plus rotation is matched. Diagonal field of view 114 degrees, 9×9 grid. The shading is a schematic of the distribution, not per-cell values. Both are ways of matching within the model, not PENTAX's actual control algorithm.
In this model there is more than one way to match the sensor.
One is
making the stars near the center of the frame match well.
The other is
mathematically searching for the state that best fits the stars across the whole frame using only X/Y shift plus rotation.
The numbers that appear in Astrotracer ①–③ are the former: matched to the center of the frame.
Under the same conditions, the residual changes with which matching you use. For a diagonal field of view of 114 degrees, full frame, facing south at 40° altitude, 60 s, matching to the center of the frame gives about 24.14 px, while the best fit across the whole frame gives about 17.85 px.
For the latter, grid points across the whole frame are used and a least-squares fit finds the best-fitting planar shift and rotation.
Neither way of matching means
"this is how PENTAX controls it."
The latter in particular is a calculation for seeing
how far you could get if you used only the three motions of X/Y shift plus rotation to fit the whole frame as favorably as possible
Residual still remains.
Which connects to what Astrotracer ③ explained:
"it does not follow that the edges trail simply because the control accuracy is poor."
11 Ground blur turned out to be a simpler idea
Fig. 3: Ground blur is the relative motion of the stationary ground image as seen from the moving image sensor.
In Astrotracer ①② I calculated ground blur as well as the stars.
That idea is simpler.
The camera and lens are fixed on the tripod.
So, idealized, the image of the ground itself stays in the same place on the image plane.
But with Astrotracer, the sensor underneath it moves to follow the stars.
Seen from the sensor, the image of the ground then drifts in the opposite direction.
In other words,
the ground is not being moved.
Relative to the sensor that moved in order to follow the stars, the fixed image of the ground appears to move.
That is the basic idea behind the ground blur used in Astrotracer ①②.
12 This is also why the same formula as the 500 rule appeared
In Astrotracer ② "How Long Should You Track the Stars?" I showed a slightly interesting result.
Considering the 500 rule used for fixed exposures and the ground blur when using Astrotracer with the same acceptable amount, the same time came out.
That is not a coincidence.
In a fixed exposure,
the Earth's rotation moves the stars across the sensor.
With Astrotracer,
the sensor is moved to cancel that motion of the stars.
So with the same angular rate, the same focal length and the same acceptable displacement, you get the same relationship.
Both the amount the stars move in a fixed exposure and the amount the ground blurs with Astrotracer take the same form, f · ω · T · cos δ. So the match is not a coincidence — in terms of the formula, they are the same thing seen from different sides.
This was one of the places where calculating it made me think "ah, of course."
13 For the fisheye comparison, only the lens part was swapped
The fisheye comparison done in Astrotracer ③ is basically the same calculation.
Create the stars.
Rotate the Earth.
Project again.
Shift and rotate the sensor in X/Y.
Measure the largest remaining offset.
What was changed is mainly
how the lens projects the sky onto the sensor
Also, comparing at the same focal length alone changes the area of sky covered.
So for the main comparison, conditions were matched so that the ordinary wide-angle lens and the fisheye had the same diagonal field of view.
In that state only the projection was changed, and the same calculation repeated.
The result is the finding in Astrotracer ③ that
at the same field of view, across the range examined here, the fisheye had the smaller tracking residual
For example, in the 114° diagonal comparison, the 24.14 px for the ordinary wide-angle lens and 3.67, 4.53 and 5.12 px for the three fisheye projections shown in Astrotracer ③ are the values when matched to the center of the frame.
Switch the same conditions to the best fit across the whole frame and the ordinary wide-angle becomes 17.85 px, with 3.32, 3.35 and 4.85 px for the three fisheye projections. Changing the matching does not change the relationship that the fisheye is smaller. Both are ways of matching within the model, and do not represent the tracking algorithm of an actual PENTAX body.
14 Only the equatorial mount is calculated in a different place
Fig. 4: In the calculation too, the equatorial mount's correction enters before the projection. In the idealized model the residual for the stars becomes 0.00 px, but that is because polar alignment error, flexure and atmospheric refraction are not in the model — it does not mean a real equatorial mount has zero error.
Astrotracer ③ also described the difference from an equatorial mount.
Turning that into a calculation model makes it very clear.
With Astrotracer the order is
the stars move
→ the lens projects
→ the sensor follows the resulting image
With an ideal equatorial mount, the camera and lens themselves are rotated by exactly the amount the stars move.
That is,
the relative orientation between the stars and the camera is preserved before the projection into the lens
In this ideal model the stars and the camera are rotated by the same rotation matrix, so the direction of a star as seen from the camera does not change.
As a result, the model's tracking residual for the stars is 0.00 px.
Of course, that does not mean
a real equatorial mount has zero error
In practice there is polar alignment error, periodic error, flexure, atmospheric refraction and more.
It is 0.00 px because this is an idealized model that does not include them.
15 So how far can this calculation be trusted?
Having explained all that, the opposite question arises.
"Can the numbers from a model really be trusted?"
There is a great deal this model does not include.
The actual internal control algorithm of a PENTAX body.
Mechanical error.
Calibration error.
Atmospheric refraction.
Lens aberrations.
Vibration.
The specific distortion of a real lens.
It is not a simulator that reproduces all of that.
So I cannot say
"a real K-1 at 14 mm and 60 s will always trail 24.18 px."
The figure 24.18 px is a result of the idealized model set up here, nothing more.
Note that the 24.14 px in Astrotracer ③ is the value with the diagonal field of view matched to exactly 114 degrees, whereas this 24.18 px is the value with the focal length fixed at 14 mm. The conditions are almost the same, but what was held constant differs, so the numbers differ slightly.
So what is it useful for?
For questions like
can shifting and rotating the sensor alone cancel the motion of the celestial sphere across the whole frame?
What difference does the projection alone make to the tracking residual between an ordinary wide-angle lens and a fisheye?
Why do an equatorial mount and sensor-shift tracking give different results?
I use it to separate out the mechanisms themselves.
16 I did not stop at "the calculation is done"
There is one more thing I was careful about this time.
Use AI to write calculation code and you can produce as many numbers as you like.
Whether those numbers are correct is a separate matter.
So for the main figures used in Astrotracer ①–③, I re-checked them mechanically against existing calculation results, unit conversions, projection formulas, matched-field-of-view conditions and so on.
There were 166 checks.
The result was
165 PASS / 1 FAIL
And that one was not an error in a calculation result.
It was a mistake in a number written in the text, for the half-diagonal of a full-frame sensor.
It counts as one check item, but the same typo had made its way into several drafts.
Correcting it to the right value and re-checking did not change any calculation results. The existing main figures and the self-validation of the fisheye comparison also passed.
If anything, doing this re-check let me find a written error.
17 On having AI do the calculation
I did not write the calculation code from scratch by hand this time.
I used AI a great deal.
But having done it, what struck me again is that
having AI perform a calculation is not the same as trusting the numbers AI produces
What is being calculated.
Where reality ends and idealization begins.
What the resulting "N px" means.
Whether a known result can be reproduced by another method.
Use the numbers without checking those, and I would not be able to explain them myself.
Going back through the code to reorganize the calculation method for this article, I at least put it into a form where I can explain, in my own words,
what was modeled.
What was given as input.
What was compared.
What the "N px" actually measures.
Summary
To sum the calculation up very simply once more:
place points on the frame
↓
work backwards to where in the sky the star at that point lies
↓
rotate the Earth by the exposure time
↓
project the stars onto the frame through the lens again
↓
shift the sensor in X and Y and rotate it to follow the stars
↓
measure the offset that still remains
↓
take the largest offset over the exposure and across the frame, in pixels
That is the calculation.
This is what the
"tracking residual N px"
in Astrotracer ①–③ actually is.
Looking only at the formulas, it seems to be doing something quite difficult.
But follow it step by step and
it computes where the stars move to, follows them with the sensor, and measures what offset is left.
Basically, that is all.
And it was precisely because I had this model that I could go back and re-examine the question I had left alone for years:
"Is it really because it is a fisheye that stars trail near the edges with an ultra-wide lens?"