Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make corner plot more bilby-esk #13

Open
avivajpeyi opened this issue Sep 9, 2022 · 1 comment
Open

Make corner plot more bilby-esk #13

avivajpeyi opened this issue Sep 9, 2022 · 1 comment
Labels
enhancement New feature or request

Comments

@avivajpeyi
Copy link
Collaborator

I asked Paul after the meeting if he had some thoughts no plot-aesthetics. This is what he said:

I do have strong feelings on plots 😅 I guess it depends how deep their willing to go. To be honest, if in the first instance they can get the plots looking like Bilby plots it would be amazing. After that you'd want to provide the user functionality to change a whole range of things, but defaulting to Bilby would be a great start...

I think I can break this down a bit for yall. To start, lets compare RABIT vs Bilby corner plots:

RABIT Bilby
RABIT Bilby

Code to generate this below:

# ! pip install bilby --quiet

import numpy as np
from bilby.core.result import Result
import matplotlib.pyplot as plt

N = 10000
fake_data = dict(m1=np.random.normal(50,5,N), m2=np.random.normal(35,5,N))
bilby_result = Result()
bilby_result.posterior = pd.DataFrame(fake_data)
bilby_result.search_parameter_keys = list(fake_data.keys())
bilby_result.parameter_labels_with_unit = [r"$m_1\ [M_{\odot}]$",r"$m_2\ [M_{\odot}]$"]
fig = bilby_result.plot_corner(save=False)
fig.savefig("bilby.png", dpi=300)
@avivajpeyi
Copy link
Collaborator Author

Note that I think this mainly because Paul may be thinking about the plot download feature.

Comparing the plots, these are some things that I notice that paul may be thinking about

  • Latex labels + units:

    • As each parameter will have the same label, you can hardcode a hash-table of parameters and their labels+units (ask Avi for parameter-latex-labels or grab them from the prior files)
    • not all parameters will have a latex label -- for those you can probably default to the labels you have right now
  • Tick labels:

    • Bilby tick labels are rotated -- Im not sure how important this is to Paul...
    • The tick-labels (ie numbers) should be the same font as the axes labels (something to keep in mind when using Latex for axes labels)
  • Ticks:

    • Bilby seems to have only 2/3 ticks
    • Again, not sure how important this is to paul
    • If you want to do smth about this, i think corner does something clever to select the ticks
    • Bilby has ticks on the 1D histograms -- i think this would be good to add to RABIT
  • White plot background -- add to RABIT (at least for the download if possible)

  • 1D hist lines:

    • Rabit draws a line on the median
    • Bilby draws a lines to mark the 90% quantiles (region inside which 90% of the probability falls in)
    • See this bilby function to see how it figures out what the 90% quantiles are (actually, it seems like the work is actually done by corner... oh well)
  • Datapoints

    • Bilby plots a scatter of datapoints underneath the contours -- but I doubt this is necessary
  • 1D hist titles (only for when you have 1 dataset plotted)

    • Bilby gets away with the small number of ticks because it has some info in the 1D hist titles
    • The 1D hist titles are [median value +/- 90% errors]
    • If not hard, this would be nice to have in RABIT
  • axes spines

    • Bilby has axes splines (the black border) visible on all axes
    • Rabit has it only on the bottom/right most axes (tbh i kinda like this)...
    • I think this is necessary in bilby when the background is white...

Python code to get the [median+/-90%] used in the title: https://git.ligo.org/lscsoft/bilby/-/blob/master/bilby/core/result.py#L865

@megascrapper megascrapper added the enhancement New feature or request label Sep 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants