SOLIX

research software · reproducibility · data pipeline

github ↗︎

i build solix for the data intelligence lab at tcu, where i work as a software engineer and research assistant. the name stands for solar observation labeling and indexing. it started as solarflare-labeler, a handful of scripts the lab used to prepare flare prediction datasets, became flare-indexer once it was a real package, and reached 1.0 as solix, a library meant to replace the one-off labeling script every flare prediction study ends up writing for itself. we’re also writing it up as a software paper.

the question it answers sounds simple. given an observation of the sun at some moment, did a significant flare happen in the hours after it? every observation gets a label, and that labeled table is what a prediction model trains on. solix takes an index of timestamps and a flare catalog, looks forward from each one, and builds the table.

how one label gets made index timestamps (+ active region) one instance or sequence event matcher flares that start in [t, t+w) from the same region, if labeling by region list of flares reducer e.g. strongest flare's flux one number labeler 0/1, class, count, or flux one labeled row repeated for every sample

solix calls each row of the index an instance. early on it was always an image, but the package never actually opens the files. an instance is just a timestamp and a path, which might point to an hmi magnetogram, an active-region patch, or a .npy array, and any extra columns ride along into the output. that made the library useful for whatever format a model expects instead of only the one we started with.

there are four ways to build a dataset, and each is its own class: full-disk or active-region, for single instances or for sequences. full-disk counts any flare on the sun. active-region counts only flares from the same numbered region, and since one patch can cover several regions, an instance can list more than one. one decision i cared about here: if an instance’s active region is missing, it matches nothing. it never quietly falls back to whole-sun matching, because a wrong label that looks right is much harder to catch than an empty one. what happens to that instance next is an explicit choice, labeled negative with a warning, dropped, or treated as an error.

target × sequence one instance a sequence full_disk any flare on the sun full_disk measured from the last one active_region same region only active_region built per region missing region → no match, never a full-disk fallback

the biggest change for 1.0 was deciding how a flare counts and then not letting it be configurable. earlier versions had settings for whether a flare counts by its start or its peak, and which edge of the window is included. every option made sense somewhere, but it also meant two datasets built with the same library could quietly disagree. solix now has exactly one rule: a flare counts if it starts within [t, t + w) of the instance time t. the window length is the only thing you choose.

that rule came out of validation. before 1.0, i built a full-disk, m-class dataset from real hmi and goes data and compared it, timestamp by timestamp, with the output of the lab’s legacy labeling script. on 63,649 images and 14,401 flare events, the two agreed on 99.99% of labels, and the six that didn’t all traced back to one cause: the legacy window was one second short of 24 hours. a bug like that is invisible until you compare against something, which is a big part of why the window is now one fixed, documented rule instead of a setting.

real data also doesn’t arrive in tidy csv files. hmi images come as lists of file paths with the timestamp buried in the filename, and a goes catalog has its own column names and four-digit noaa region numbers that have to be restored to five digits for flares after june 2002. solix has loaders for both, and when a listing has files that aren’t observations or two paths with the same timestamp, it either stops or reports exactly which rows it dropped, so nothing disappears without a trace. every flare needs full timestamps, not just times of day, so a flare that starts before midnight and peaks after it stays on the right days, and start, peak, and end are checked to be in order.

sequences are built from an explicit time grid: a cadence, how much time one sequence covers, and how far the next one slides. if any instance on the grid is missing, the whole sequence is skipped, never interpolated or filled in from a neighbor. the grid also makes downsampling safe. from 30-minute images, you can ask for an hourly cadence and get only the on-the-hour images. a report shows how many sequences were kept, how many were skipped, and which timestamps were missing.

hourly grid, 6h window, slide 3h 00:00 kept 03:00 kept 06:00 × skipped a missing file drops the whole sequence: never interpolated, never filled from a neighbor

labeling is split into two stages, a reducer and a labeler. a reducer turns the list of matched flares into one number: the strongest flare’s flux, a count, a cumulative index where every c-class flare adds its magnitude, m adds ten times, and x a hundred times, or flux relative to the sun’s background in the day before. a labeler turns that number into a label: yes or no above a goes class, one-hot classes, per-class presence, or the raw value for regression. that matters in research, because the next question is usually a variation of the last one, and now a variation is a different pair of pieces, or a small class with one method, instead of a new script. flares are always compared by numeric flux, never by class names. sorted as text, “m9.0” looks stronger than “m10.0”, even though m10.0 is the stronger flare.

this is roughly what a run looks like, with hourly six-hour sequences:

import solix

dataset = solix.FullDiskSequence(
    "24h",
    reducer=solix.MaxFluxReducer(),
    labeler=solix.BinaryThresholdLabeler("M"),
    cadence="1h",
    observation_window="6h",
    sliding_window="3h",
)
labels, report = dataset.build("full_disk_index.csv", "flare_catalog.csv", return_report=True)

the output plugs straight into pytorch or tensorflow, and the examples go all the way from real hmi images to a DataLoader.

looking back, most of this project was about making assumptions visible. which flare timestamp counts, where a window ends, what happens when an observation or an active region is missing: each of those used to be a quiet decision inside a script. now each one is either a fixed, documented rule or a named setting, with tests behind it. the package has over 400 tests, and running them is how i know a change to one of those rules didn’t quietly change someone’s dataset.