Project code
Project Page on Github: https://github.com/erellaz/SatelliteTrailRemover
The URL to use for the PixInsight scripts automatic upload:
https://raw.githubusercontent.com/erellaz/SatelliteTrailRemover/refs/heads/main/updates
Motivation
Satellite trails on astronomical images have been a problem for many years. I started working on the problem in 2020 with some Radon Transform (here is the initial commit), but the solution was not robust and barely usable. Academia picked up on the idea 3 years later with some improvements (here), but robustness was still lacking, as well as an easy to use tool. So I waited for somebody else to develop the solution. I waited until November 14, 2026, when I saw Starship 42 landing here, in Texas, on its catch tower. And then, it dawned on me: a solution was needed, and it was needed now. So I started the effort discussed here.
The goal of the project was a satellite trail removal solution with the following features:
- easy to implement for the user, ideally part of Weighted Batch Pre Processing (hereafter WBPP) in PixInsight or equivalent,
- easy to parametrize (and the best parametrization is to have the default just work),
- easy to QC (so a Satellite blink application opening the clean frames by default was needed),
- free to use, re-use, modify, and even free to use commercially, because it is obvious a good solution would have implication well past the amateur market,
- with a detection threshold beyond what the human eye can see,
- no false positive,
- and a removal that reveal the underlying data, when possible.
There was another problem: my Moravian C100 exhibits some slight sensor banding on underexposed images, and I had developed an efficient Fourier deband to take care of the problem. I wanted the deband to be deployed (optionally) alongside the satellite remover in a WBPP style workflow, because I believe both belong to the pre-stack workflow.
Method
Having played with the problem since the 2020 Radon code mentioned above, I had come to two principles: satellite removal was a pre-stack problem, and the solution was to model the satellite trails then perform an adaptive subtraction of that signal to the image.
I will talk a lot about adaptive subtraction. If you do not have time for the paper above (you should though), here is the short of it. Adaptive subtraction removes an unwanted signal from an image by subtracting a model of that signal. The model is first adjusted to fit the image, one small window at a time. So you start with two images: your actual image, and a model of what you want to remove. The model is not exact. Brightness changes from place to place, the stars are slightly too sharp or too soft, and the position is off by a fraction of a pixel. If you subtract the model as it is, those errors spoil the result.
Instead, adaptive subtraction asks: “how much of the model, slightly blurred or shifted, best explains what I see?” It adjusts the model’s strength, and shape through a small matching filter kernel, to match the image in that window, and only then it subtracts it. Mathematician say they “minimize the difference between the image and the matched model in the sense of an L1 or L2 norm using a matching filter kernel”.
Anyways, the choice of those two guiding principles (operate pre-stack and build the satellite remover around an adaptive subtraction) are not scientific truth. They come from having observed the seismic processing industry in the last 25 years: most processes in that industry have moved from post-stack to pre-stack, each time providing a significant improvement in quality. As for the modeling then adaptive subtraction strategy, it has just become the standard in geophysics. Now, maybe somebody has better guiding principles for their own development and can provide better better result? I am waiting with anticipation….but buckle up because the method proposed here works very well.
From here, the question was: how do I get a model of satellite trails to subtract (or adaptively subtract) to each frame? For astronomical imaging, I think the answer is obvious: stack the data with a high rejection algorithm (Winsorized sigma stacking, rejecting at 2.5 sigma is what I use currently). Then do an adaptive subtraction of that stack to each light frame. What you get is the satellite signal plus all the random noise, which we’ll call that the residuals.
Now the residuals needs to be cleaned to select only the satellite trails. At that point, the Radon transform does work reliably, because the residuals are a simplified image, not crowded with stars and nebula. In fact the program does much more than just Radon, pulling many tricks available in the image and signal processing toolbox to reliably select only the satellite trails. Anyways, I was very happy to see that the Radon introduced 6 years ago found its place in the definitive solution, it felt like closing the loop at long last.
Then those satellite models, one per light frame, can be subtracted to the light frames. Because the satellite trails have already been matched, another adaptive subtraction may not be strictly necessary (I am still doing some research on that very point).
All this of course needs to happen on registered light frames, because the frames are compared to a high rejection registered stack. This has implications should the user be interested in a drizzled stack, which is build from calibrated rather than registered frames.
Then the lights frames, registered and free of satellite trails, can be stacked (again) but this time with a low rejection algorithm, or no rejection at all, revealing the faint signal coveted by astronomers.
This works extremely well if you have enough lights to created a high rejection stack to derive your satellite model from. In case you do not have that, the model could be constructed in other ways. To be clear I have not done it (yet), so take the following paragraph as “carefree talk”. Talk is cheap while building something that actually works well is in fact difficult.
One could construct the satellite trails from ephemeris (like here) but let the adaptive subtraction match the trail(s) amplitude, width and exact position. Or construct the frame to be subtracted to each light from a catalog (eg: Gaia) using the usual tricks for building a synthetic starfield, do the adaptive subtraction to match the synthetic image to each light and remove the stars, then continue the pipeline as above. Or one could do star removal, structures removal preserving the satellites…. Many variants can thus be imagined and adapted to each use case. But for us astronomy imagers, the methodology implemented in the script just works very robustly, and (I think), should be preferred, as it does not require a catalog or ephemeris but is strictly based on the image set.
Implementation
The code I distribute is 100% Javascript and works as custom scripts in PixInsight. What 99% of users will want to do 99% of the time is extremely simple:
- Open Weighted Batch Pre Processing and parametrize as usual.
- In WBPP, open the Pipeline tab and drop in either Desat_WBPP.js (or if they want both debanding and satellite removal, drop DebandDesat.js instead). Please note you do not have to do the deband if you do not need to. Just use the right script in the pipeline builder.
- Run WBPP as usual.
Then, if the user wants a QC of the satellite removal, the companion script TrailBlink can be opened, and provided with the output folder of WBPP. TrailBlink will show side by side each image with and without the satellite trails, as well as the residuals and the satellite signal being removed.
That’s it.
If a user wants to change the default parameters in either Deband or Desat, just open the respective standalone script provided before launching WBPP, parametrize, and execute the standalone script one one test image, those parameters become the new default, and they persist until changed again, surviving even a restart.



Limits
The scripts do not process OSC (One Shot Color) data at this point. There is no conceptual barrier, but I do not have the data, so I have not implemented it, as I would not be able to reliably test. Doing OSC would require careful consideration, to take advantage of the crosstalk between the 3 color channels. The implementation would dependent on the Bayer Matrix. Maybe somebody has the data, the time and will fork the project?
Drizzle support is implemented but consider it beta testing for now.
The trails need to be straight lines, or close to it, due to the Radon transform. However some optics have Seidel distortion (an optical aberration) and wide angle system have projection distortion, due to the Beltrami theorem. I have not tested those limits. They should hit for a field of view wider than 90 degrees or poorly corrected optics. Enabling distortion correction at registration and preferring the use of the gnomonic projection should help, but only to a point. The implications of those 2 distortions in the drizzle workflow is yet another compounding layer I have not looked into.
There seem to be some edge effects in some cases (edge of image) if the image rotates from frame to frame. The solution is, of course, simple: the imaging system should not allow the images to rotate.
When an image has a lot of sub on one side of the Meridian, and very few subs on the other side, and the telescope has diffraction spikes, and those spikes are not aligned in the image when the meridian changes, there can be a case where those spike can be interpreted as trail. I think I have hardened the code against this (because, I must admit it happens to my CDK), but we shall see as feedback comes. This is really an instrument problem, though.
The process is pre-stack by design, and if you stack hundreds of frames, any pre-stack process becomes hundreds of time more expensive in terms of compute than the post-stack alternative. It is worth it, tough, if you look for quality, and…. it is just a compute problem.
The processes are parallelized, and each subprocess competes for memory, so the script limits the number of processes to avoid exhausting the memory. Depending on the hardware I think serious optimization is possible. Also I have not looked at GPU optimization.
I did all the testing on my CDK 14. So we shall see if the parameters are suboptimal for other systems, with a different focal length.
And of course there is the limit of not having enough frames for the winsorized stack…
The AI controversy
This script was developed with an AI assistant. It is purely deterministic though, and I believe it is in full compliance with the PCL License and the CDP policy, as well as Juan’s explanation here. I have posted the script on the PixInsight forum here, so it should be easy to clarify any misunderstanding or oversight from my part.
I do not want to enter the controversy, and hope I will not be dragged into it. I can testify however that compliance with complicated and changing rules is a drain on amateur programmers with no commercial aspirations.
License
I released my code under MIT license. I am aiming at maximum adoption, and have no problem with people reusing my code, even for commercial application, and even reusing the code for their closed source application.
Final words
Anyways, enjoy, because it’s free, it’s open source and even better, it does work very well, at long last!
And if there is something you do not like, comment (respectfully) on one of the forums or on Github, or, better, fork and show me how it should really be done.
Or you may also just create you own better alternative, which I’d love to see and learn from.