VERITAS-Observatory / V2DL3

VERITAS (VEGAS and Eventdisplay) to DL3 Converter
BSD 3-Clause "New" or "Revised" License
8 stars 1 forks source link

v2dl3-vegas: Optimization, ITM Support, FoV Cuts #148

Closed tmcahill closed 2 years ago

tmcahill commented 2 years ago

This v2dl3-vegas patch contains optimization and new options for event filling.

This update is not as large as the line count implies. Most is from refactoring EventClass.py and parts of irfloader.py into EffectiveAreaFile.py for the optimization.

New features

Optimization

EffectiveAreaFile objects now wrap all effective area files in v2dl3-vegas. This is necessary for a few reasons:

This also makes the code cleaner. I was able to streamline a lot of code where there were previously multiple behaviors for whether or not EA files were being wrapped by an EventClass. Replacing EventClass and associated var names with EffectiveAreaFile is more clear than how I'd previously used event class names in behaviors that weren't exclusive to event class mode.

Runtime

I measured runtime for this optimization using 3 program runs of 12-run runlists. Outputs from the runtime tests were compared with fitsdiff and found to have no differences.

Runtime was 2.5x faster when not using event classes:

Before:
real    0m31.767s  user    0m28.083s  sys     0m3.067s
real    0m31.388s  user    0m28.110s  sys     0m2.768s
real    0m32.592s  user    0m28.396s  sys     0m3.161s

mean real: 31.916

After:
real    0m12.827s  user    0m10.776s  sys     0m1.586s
real    0m12.763s  user    0m10.831s  sys     0m1.479s
real    0m13.173s  user    0m10.926s  sys     0m1.559s

mean real: 12.921

Runtime was 3x faster when using two event classes:

Before:
real    0m54.721s  user    0m49.755s  sys     0m3.886s
real    0m55.445s  user    0m50.119s  sys     0m4.344s
real    0m54.907s  user    0m49.727s  sys     0m4.016s

mean real: 55.024

After:
real    0m19.896s  user    0m15.936s  sys     0m2.041s
real    0m18.791s  user    0m15.812s  sys     0m2.014s
real    0m18.856s  user    0m15.902s  sys     0m1.992s

mean real: 19.181

Our computer cluster yielded very similar results. v2dl3-vegas is now more than twice as fast.

All features from this branch have been independently tested and verified with fitsdiff. Control tests for pre-existing use cases were also ran and compared to main branch outputs.

Changelog

genHDUList.py

v2dl3_for_vegas.py

EventClass.py -> EffectiveAreaFile.py

VegasDataSource.py:

fillEVENTS_not_safe.py:

fillRESPONSE_not_safe.py:

irfloader.py:

For VEGAS review

Should be easy, not much was added that wasn't already being done in V2DL3.

tmcahill commented 2 years ago

Thanks for the quick review Dr. Maier!

tmcahill commented 2 years ago

v2dl3-vegas CI is successful. Fits differences are accounted for:

single-evclass:

point-like-1:

point-like-2:

multi-evclass: