Jul 04
2026
When stacking sub-exposures of different durations while also disabling images based on FWHM and
visual inspection the question of "what is the total exposure time" can be difficult to answer. The
following python script should answer the question.
from collections import Counter
import sirilpy as s
siril = s.SirilInterface()
siril.connect()
seq = siril.get_seq()
print(f'Computing exposure time for sequence {seq.seqname}')
print(f'Sequence has {seq.number} images, {seq.selnum} selected/enabled')
exp_time_table = Counter()
for idx, imparam in enumerate(seq.imgparam):
if not imparam.incl:
continue
header = siril.get_seq_frame_header(idx, return_as='dict')
exp_time_table[header['EXPTIME']] += 1
total_exp_time_s = 0
for exp_time, count in exp_time_table.items():
print(f'Exposure time: {count:4d} x {exp_time:4.0f} secs')
total_exp_time_s += exp_time * count
total_exp_time_min = total_exp_time_s / 60
total_exp_time_hr = total_exp_time_s / 3600
print(f'Total exposure time: {total_exp_time_s:.0f} secs (={total_exp_time_min:.1f} mins '
f'={total_exp_time_hr:.1f} hrs)')
Example output:
14:06:45: Computing exposure time for sequence r_ngc_6188_combined_
14:06:45: Sequence has 606 images, 566 selected/enabled
14:06:46: Exposure time: 293 x 60 secs
14:06:46: Exposure time: 248 x 30 secs
14:06:46: Exposure time: 25 x 120 secs
14:06:46: Total exposure time: 28020 secs (=467.0 mins =7.8 hrs)
Apr 20
2026
Suppose you have instruments in different timezones taking readings. You might have the following
Django data model:
class Instrument(models.Model):
timezone_utc_offset_hours = models.FloatField(...)
...
class Reading(models.Model):
instrument = models.ForeignKey(Instrument, ...)
timestamp = models.DateTimeField(auto_now_add=True)
...
Furthermore suppose settings.py contains the following:
...
USE_TZ = True
TIME_ZONE = "Europe/Paris"
...
It …
May 24
2025
I have been working with industrial cameras and frame-grabbers that simply gives me a dump of their sensor data. To make that data useful it needs to undergo demosaicing, ideally using one of the modern demosaic algorithms like RCD rather than simple interpolation or the rather outdated VNG. Unfortunately the …
Apr 10
2025
Because KeepassXC lacks the ability to decode QR code for TOTP setup and not all MFA implementations show the required secret in text format, I use the following snipet to read the QR code information locally:
python -c 'from cv2 import QRCodeDetector; from PIL.ImageGrab import grabclipboard; import numpy as …
Feb 04
2023
In order to install the arcgis package in conda, you have to specify the architecture osx-64 otherwise the package will not be found. This works because MacOS will capable of running x86_64 code on Apple Silicon processors - that is how efficient they are!
conda install -c esri/osx-64 arcgis
In …
Aug 05
2018
# GPS Timing
¶
Carrier-phase detection is suppose to yield better timing information than tracking the pseudorandom code stream. The reason for this is supposedly that the higher frequency carrier allows for more accurate measurements of the …
May 07
2016
I needed to read Lecroy binary waveforms files recently, and the one python script I had found didn't read them properly due to improper handling of 16 bit samples.
I wrote an alternative lecroy.py that should be a drop-in replacement. It handles 16 bit waveforms and exports a LecroyBinaryWaveform …
Sep 12
2014
Previously we found that PyPy achieves the best performance gain, executing fieldfunc_py in ~6 us. At the end of that article, I mentioned that the C implementation is up to 50x faster, managing the same calculation in ~0.12 us.
The naive conclusion is that the best thing is to …
Sep 12
2014
Recently I found myself looking at the following piece of code and trying to optimise it:
from __future__ import division
import numpy as np
MagneticPermeability = 4*np.pi*1e-7
MagneticPermeabilityOver4Pi = MagneticPermeability / (4*np.pi)
def fieldfunc_py(p, q, moment):
r = p - q
rmag = np.sqrt(r.dot(r))
rdash3 = rmag …
Jul 21
2012
By default system python loads "fake" readline (fake because it actually uses libedit) from /System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/readline.so. Even if you install readline (which goes into /Library/Python/2.7/site-packages), it will still load it, even if you fiddle …
Jan 27
2011
I often mockup iPhone interfaces on the Gimp, then exporting each layer for use as backgrounds. For iOS 4 each image needs to be exported twice: one at full resolution with @2x in its filename, and once at half-resolution without the @2x. e.g. nav_bg@2x.png and nav_bg.png …
Oct 11
2009
I generated a gpg keypair for myself today, and I was looking for a fairly safe way to back it up. I don't particularly trust DVD/CDs, and keeping it on flash is even more worrying. I wanted a means of backup I can see and touch.
Paperbak would be …
Oct 09
2008
But you can get the current function's name by using:
sys._getframe().f_code.co_name
Seems to work alright for debugging purposes. See the link embedded in the title for the origins and 3 other methods.
Cheers,
Steve
Jul 16
2008
I have set up an unofficial git respository for libfg patches and new swig generated python interface, as Gavin Baker (the author) appears to be busy with other things. This is a maintance only repository as far as libfg goes - I don't plan on adding any more features (since all …
Apr 28
2008
Firstly, I am the kind of guy who likes tabs over spaces, because I don't like forcing my particular preferences on to other people. To wax poetic, I like to give other people the freedom of choosing how they want their code indented. This of course brings me into the …
Dec 31
2007
I was tired of converting all my HTML ebooks to rtf, then to pdb using Palm Doc Converter only to lose all the nice touches like bold, italics and headings. Since there didn't seem to be a HTML to PML converter for OS X, I wrote one to get more …