PrincetonUniversity / Iseult

Python plotting program for Tristan-MP
https://princetonuniversity.github.io/Iseult/
GNU General Public License v3.0
7 stars 7 forks source link

Add Support for Loading Tristan v2 Spectra #20

Closed bcaddy closed 3 weeks ago

bcaddy commented 1 month ago

Summary

Add support for loading and plotting spectra from Tristan v2 data files.

Spectra

Iseult now reads in and displays Tristan v2 spectra. Tristan v2 spectra are binned in X, Y, and Z instead of just X as is done in Tristan v1. To account for this Iseult sums over the Y and Z axis to reduce Tristan v2 data to the same format as Tristan v1 data.

Other

Cloning Instructions

$ git clone git@github.com:bcaddy/Iseult.git bob-iseult
$ cd bob-iseult
$ git checkout --track origin/master-tv2Spectra

if you already have that repo cloned locally then

$ cd path/to/bob-iseult
$ git checkout --track origin/master-tv2Spectra
ntoles commented 1 month ago

There is a difference in what Tristan v1 and v2 save as spectra. v1 saves number of particles in an energy bin divided by gamma. This is why in spectra.py line 172-3 multiplies back by gamma before doing plots.

            self.spece[:,i] *= self.gamma
            self.specp[:,i] *= self.gamma

v2 saves just the number of particles per bin without this division by gamma. I see two possibilities to rectify this. Either divide spece and specp by gamma after reading v2 data, so that the rest of the code is unchanged; or only do this multiplication by gamma in spectra.py for data in v1 format.

bcaddy commented 1 month ago

Done, I converted the v2 data to v1 format. I used ebins not gamma since there is no dataset named gamma in Tristan v2 and I think we decided that ebins was the same thing.

ntoles commented 4 weeks ago

Testing on this data: /scratch/gpfs/ar3676/2_test/output

When I select measurement coordinates for the spectrum that are between 40 and 80, i get errors that there is no electrons in that region and no spectrum is plotted. "RUNTIME WARNING: spectra.py can't find the electrons in the integration region, spectra will be incorrect"

There should be 20 bins in x in this run, so it should be possible to zoom in. To reproduce. Right click on spectral plot (lower left), Measurements tab, unclick "Energy Region relative to shock?", type 40 and 80 into electron Energy Int region. Same for ions as well, though it can be different.

Could you check?

ntoles commented 3 weeks ago

Seems to work correctly!