Header Mods & Misc: Astrobin Exporter - setiastro/setiastrosuitepro GitHub Wiki

Header Mods & Misc: Astrobin Exporter

Export a per-night / per-filter exposure summary to a CSV that you can paste into AstroBin’s Advanced Upload. Reads FITS (and XISF when the optional reader is available), aggregates exposures, and maps local filter names → AstroBin numeric IDs.


What it does

  • Scans selected .fit/.fits/.xisf files.
  • Reads headers (object, filter, exposure time, gain/ISO, binning, temps, etc.).
  • Groups frames as Object → Filter → Exposure and then aggregates by date, filter ID, exposure.
  • Lets you fill missing metadata (f/number, calibration counts, Bortle, SQM, FWHM).
  • Builds a CSV preview and provides Copy CSV.

UI at a glance

  • Left pane

    • Select Folder… / Add Files… / Clear
    • Hierarchy tree: Object → Filter → Exposure → file with checkboxes (toggle to include/exclude).
  • Right pane

    • Global inputs (used when headers are empty/zero):

      • f/number, darks, flats, flat-darks, bias, Bortle, mean SQM, mean FWHM
      • Group nights noon → noon (prevents splitting a night at local midnight)
    • Filter ID mapping

      • Shows current map (e.g., Ha→4408, OIII→4413, …).

      • Manage Filter IDs… opens an editor with:

        • 2-column table (local filter name ↔ AstroBin ID)
        • Optional offline CSV for lookup & autocompletion (ID — Brand — Name)
        • Quick link to AstroBin Equipment Explorer (Filters)
    • Aggregated table (read-only)

    • CSV Preview + Recompute / Copy CSV


How aggregation works

  1. Inclusion Only files checked in the tree are included.

  2. Date bucketing

    • Uses FITS/XISF DATE-OBS if available.
    • Option “noon → noon (local)” shifts by −12 h before taking the date, so one observing night isn’t split at midnight.
  3. Filter ID

    • The displayed filter name is converted to an AstroBin numeric ID using your mapping.
    • If a row’s filter is not a number, it is shown in red to remind you to fix the mapping.
  4. Group key Rows are aggregated by (date, filter ID, exposure duration).

  5. Counts & means

    • number = number of files in the group
    • temperature = rounded mean of focuser/sensor temperature samples (when present)
  6. Fallbacks For each aggregated field, if the header value is empty or zero, the corresponding Global input value is used.

  7. ISO vs Gain rule If gain is present (> 0), the output ISO field is left blank (AstroBin expects one or the other).


CSV columns

The CSV is generated in this order:

date,filter,number,duration,gain,iso,binning,sensorCooling,fNumber,
darks,flats,flatDarks,bias,bortle,meanSqm,meanFwhm,temperature

If any group has a nonzero gain, the iso column is omitted entirely.

You can copy the CSV with Copy CSV and paste it directly into AstroBin’s uploader.


File formats & headers

  • FITS: read via astropy.io.fits.

  • XISF: read via optional legacy.xisf.XISF:

    • If the XISF reader is not available, XISF files are skipped and the status line indicates how many were skipped.
  • Typical keys used when present:

    • OBJECT, FILTER, EXPOSURE/EXPTIME, GAIN, ISO, XBINNING/XBIN/CCDXBIN, CCD-TEMP, FOCTEMP, DATE-OBS
  • The exporter is conservative: missing/odd types are handled safely and logged in the status line.


Filter ID editor (details)

  • Stored in QSettings under astrobin_exporter/filter_map as name=id;name=id;….

  • Offline DB (CSV) support:

    • Load once, then Search offline DB… to find an ID by brand/name.
    • The editor column provides autocompletion that inserts only the ID.

Tips

  • Load all calibrated stacks for a target, then uncheck any runs you don’t want in the tree.
  • If you shoot with variable exposure lengths, you’ll get one row per exposure time for the same date and filter ID (as required by AstroBin).
  • Use noon → noon when imaging past midnight to keep a single “night” together.
  • Red filter entries in the table mean missing numeric ID → fix them via Manage Filter IDs….

Status & messages

The status line will read things like:

  • Loaded 42 file(s).
  • Loaded 40 file(s) (2 failed) — skipped 5 XISF (reader unavailable).

Errors while reading individual files are logged but won’t stop the session; you can still export with the rest.


Defaults & persistence

  • Global inputs, noon → noon, last folder, filter map, and the offline CSV path are saved across sessions via QSettings.

Dialog name: AstroBin Exporter Output: CSV text (copy to clipboard) and an on-screen preview.