Journey's End

Jul 04
2026

Siril Script to Calculate Total Sequence Exposure Time

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

Datetime Display in Django

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

Adventures in Compressed DNG

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 …

Dec 23
2023

On NS*DateFormatters

There now exists NSDateFormatter and NSISO8601DateFormatter and their behaviour when a timezone is not set is not the same: NSDateFormatter produces strings formatted for local time while NSISO8601DateFormatter produces string formatted for UTC.

As an example, given a date-time of 2000-12-31T23:00:00Z

NSDateFormatter with no timezone set and full …

ts=01:16 tags=[objective-c,code]

Feb 19
2022

Aug 05
2018

IPython Notebook on GPS Timing and CDMA

In \[1\]:
%matplotlib inline import matplotlib import numpy as np import matplotlib.pyplot as plt
# 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 …

Apr 12
2016

Method Forwarding in Objective-C Pitfall

A common pitfall of trying to use message forwarding in Objective-C is forgetting to implement

- (NSMethodSignature *)methodSignatureForSelector:(SEL)aSelector

in addition to

- (void)forwardInvocation:(NSInvocation *)anInvocation

Another problem is that sometimes calling objects will use

- (BOOL)respondsToSelector:(SEL)aSelector

to determine if your proxy object can respond to a particular …

Sep 12
2014

Sep 12
2014

Adventures in Python Optimisation

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 …
ts=14:41 tags=[python,c,code,software]

Aug 26
2014

From Lyx/Latex to Word

This is sort of a placeholder post. Busy meeting a deadline, but this should help future Steve and anyone else when you need to turn your Lyx document into a Word document while keeping the format mostly sane. Broken, but sane.

  1. Export as Latex (plain).
  2. Run

    • latex <name of tex …

Aug 26
2014

Jan 27
2012

Getting pyglet setup in OS X 10.7.2

  1. Create a virtual env and activate it
  2. hg clone https://code.google.com/p/pyglet/
  3. pushd pyglet; python setup.py install
  4. popd
  5. easy_install  pyobjc==2.3 # the ==2.3 is required as of 2012-01-27, or pyobjc-core will not install
  6. python -c "import pyglet" # this step should not fail 

Cheers,
Steve …

ts=04:58 tags=[code,osx,oss,howto]

May 18
2011

May 08
2011

Firehol and mDNS

Here is my firehol.conf that allows multicast mDNS packets through:

# define mdns so we will accept it
server_mdns_ports="udp/5353"
client_mdns_ports="5353"


interface eth+ multi
   policy return
   server mdns accept
   server multicast accept                                                                                                        


interface eth+ home src "\${home_ips}"
    server  all         accept
    client  all         accept

Initially I had the server …

ts=03:05 tags=[software,code]

Apr 17
2011

TIL: const, NSError, NSApplicationsupportDirectory

  • const char *foo; is not the same as char * const foo; The former declares a pointer to constant char, while the latter declares a constant pointer to char.
  • - [NSError localizedDescription] returns the object for key NSLocalizedDescriptionKey in the error's userInfo dictionary. I always wondered how to set it since there …
ts=15:34 tags=[software,code]

Jan 27
2011

iPhone 4 layer export script for Gimp

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 …

Jan 22
2011

Socket.IO Framing Protocol

Socket.IO is a great library and framework that doesn't seem to have a good description of the protocol available. In interest of helping others when they google "socket.io framing protocol", this post was born.

The description of the framing protocol used by Socket.IO below is taken from …

ts=14:55 tags=[software,code]

Jan 16
2011

UIGraphicsBeginImageContext on iPhone 4

I generate UIImages in some of my iOS applications, and prior to the iPhone 4 they all worked fine. With the introduction of the iPhone 4 and Retina Display, I realised my generated images were blurry even though I am rendering them at twice the resolution.

It turns out this …

ts=10:21 tags=[software,code]

Sep 21
2010

Jun 09
2010

Script to make IPAs for ad-hoc distribution.

This script produces an IPA, then verifies to make sure the IPA is actually valid.

PRODUCT_NAME=""
IPA="\\({PRODUCT_NAME}.ipa" APP="\\).app"

if [ -z "\${PRODUCT_NAME}" ]; then
        echo "PRODUCT_NAME not set";
        exit 1;
fi

rm -rf ipa
mkdir -p ipa/Payload &&
cp -R build/Debug-iphoneos/\\({APP} ipa/Payload/ && pushd ipa && zip -q …

ts=05:22 tags=[software,code]
Next → Page 1 of 3