SNEWS2 / snewpdag

SNEWS2 alert calculations
BSD 3-Clause "New" or "Revised" License
2 stars 13 forks source link

tools for injection and skymaps #73

Closed tsengj10 closed 2 years ago

tsengj10 commented 2 years ago

Prob2CLMap takes FITS probability map files (from renderers.FitsSkymap) and makes a mollweide projection out of them. The CL's are calculated and just added.

InjectCsv allows one to inject messages directly into the DAG from a csv file. The simple format of a csv file makes injecting complicated payloads difficult, in which case it may be better simply to use python json instead. These are read directly from stdin by the snewpdag app, so you can just pipe them in.

tsengj10 commented 2 years ago

Added more tools.

gen.GenPointDts takes a csv file of detector pairs and generates dts accordingly. (Note: haven't tested smearing; just used to get truth dts.) Use as follows: python snewpdag/trials/Simple.py Control -n 1 | python -m snewpdag --log INFO --jsonlines snewpdag/data/test-dt.csv

snewpdag/data/pairs-27m.csv and pairs-40m.csv have example resolutions and biases of detector pairs as given by @mcolomermolla.

I also tested direct injection into DiffPointing: python -m snewpdag --log INFO --jsonlines snewpdag/data/test-dt.csv < snewpdag/data/pairs-min.py

This is convenient to get skymaps out without having to run a separate dag each time. The output files are indexed by the number of times the renderer is called, so you'll need to remember the order in which you injected the data. In this case I used numbers for pairs-27 for index 0, and pairs-40 for index 1.

I found it easier to edit pairs.py, and then delete the EOL's to produce pairs-min.py. The snewpdag module assumes one input payload per line at stdin.

To use a different supernova location, one should run test-dt.csv in the normal configuration first, with GenPointDts, and extract the payload information (in particular the dts dictionary) from the output. Paste and massage those into pairs.py, compress into pairs-min.py, and then you can run the multiple skymaps.