Initial Release
A code-golf submission for the InterSystems Employee Programming Challenge #1. Processes 20 Gaia DR3 epoch photometry files to identify variable stars with >100% flux variation in either the BP or RP band.
src/RunScript.macThe entire solution is a single Python one-liner embedded in an ObjectScript $SYSTEM.Python.Run() call:
import os s = lambda c: ( # Parse flux array "[1.2,NaN,3.4,...]" -> (min, max) or (0,0) (v := [float(x) for x in c[1:-1].split(',') if x if x < 'N']) and (min(v), max(v)) or (0, 0) )
open('/o/r.csv', 'w').write( 'source_id,bp_min_flux,bp_max_flux,rp_min_flux,rp_max_flux,percentage_change\n' + ''.join( f'{q[0].split(",")[1]},{a},{b},{c},{d},{p}\n' for l in os.popen('zcat /i/') # decompress all .gz files via shell if '/' < l[0] < ':' # keep only data rows (start with digit) if (q := l.split('"')) # split on double-quote to isolate array fields for a, b, c, d in [s(q[17]) + s(q[27])] # bp flux (field 18) + rp flux (field 28) if (p := max( a and (b-a)/a100 or -1, # bp percentage change c and (d-c)/c*100 or -1 # rp percentage change )) > 100 ) )
os.popen('zcat /i/*') — eliminates import gzip, glob, csv by leveraging shell decompression and globbing'/' < l[0] < ':' — filters data rows (ASCII digits 48-57) in 15 chars, skipping # comments and the text headerx < 'N' — filters NaN values lexicographically (4 chars vs x != 'NaN')for q in [...] clause/i/, /o/) — saves ~56 chars vs full IRIS pathsdocker-compose up --build
Then invoke:
iris session IRIS -U USER "d Run^RunScript"
Output is written to data/out/r.csv on the host (mounted as /o/r.csv inside the container).
The docker-compose.yml mounts:
./dataset → /i (input gzipped CSVs)./data/out → /o (output directory)./ → /home/irisowner/dev (full project for IRIS to load the source)