danieljprice / splash

SPLASH is an interactive visualisation and plotting tool using kernel interpolation, mainly used for Smoothed Particle Hydrodynamics simulations
https://splash-viz.readthedocs.io
GNU General Public License v2.0
55 stars 41 forks source link

Accessing variables to annotate plots? #49

Closed SJaffa closed 2 years ago

SJaffa commented 3 years ago

I would like to place some text on each plot, either as part of the time legend or somewhere else, giving the number of sinks in that snapshot. In the legend menu it says "You can print any header variables using %(var):", but I can't find what the names of the available variables are (I'm using Gandalf for my simulations so using the Seren data reading scripts). I've tried n_sink, stot, nsink, npartoftype(3) and other variable names I have seen for this value in the code but it just puts "%variableName" on the plots.

Could you add an option to print a list of available variables that it has read from the header or put this somewhere in the documentation?

Francyrad commented 3 years ago

I'm pretty sure that you can write what you want and where you want in each plot, just press save after have written. I don't exactly remember the exact letter to press (both with and without caps lock), but i surely did it in the past.

PS: can you please add an "Issue" section in Gandalf? I tried to install it because i wanted to study planet formation from a little cloud collapse, a thing that Gandalf should handle, however the installation ends in some python error and i've no idea how to handle it. Let me know!

SJaffa commented 3 years ago

I can annotate the plot interactively, but I want to be able to access variables like the number of sink particles that the code knows without having to do that manually for each plot. I want to run this on our local cluster to plot about 300 snapshots so I don't really want to be doing each one by hand.

danieljprice commented 3 years ago

thanks for flagging this @SJaffa, this feature is just not implemented for the Gandalf/Seren data read at the moment, should not be too hard to fix (essentially the header quantities need to be read into the generic arrays headertags(:) and headervals(:) during the data read routine, after that everything should work)

I will also add a -gandalf as a shortcut for -seren or -f seren

danieljprice commented 3 years ago

I've just pushed a fix for this, however I do not know from the data read how to identify the header values in the Gandalf read. The relevant lines of code are in src/read_data_seren.f90 and go something like this:

 !--identify integer header variables and copy into headervals
 headertags(1:8) = (/'ptot      ','stot      ','pboundary ','picm      ',&
                     'pgas      ','pcdm      ','pdust     ','pion      '/)
 headervals(1:8,step) = real(idata(1:8))

 !--tag double precision header variables with "dp_data1,dp_data2 etc."
 do j=1,size(dpdata)
    headertags(8+j) = 'dp_data'
    headervals(8+j,step) = dpdata(j)
 enddo
 call make_tags_unique(8+size(dpdata),headertags)

so I have identified the integer variables, and at least made it read the double precision variables with a generic tag (dpdata1,dpdata2,dpdata3 etc). However if you or someone else is able to supply the actual labels this would be helpful :)

As in, for each entry in the "dpdata" array we need a corresponding tag.