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

multi_model_analysis command #215

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
scaffolding for multi_model_analysis
No actual functional code as of yet, but the scaffolding for a multi_model_analysis function has been created. There's a bunch of comments in the new file regarding implementation.
  • Loading branch information
tylerbarna committed Sep 4, 2023
commit e5cd8e00676fdd385c49d332c038fd541a71f4d2
28 changes: 28 additions & 0 deletions nmma/em/multi_model_analysis.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import argparse
import json
import os
from ast import literal_eval

import bilby
import bilby.core
import matplotlib
import numpy as np
import pandas as pd
from astropy import time
from bilby.core.likelihood import ZeroLikelihood

from .analysis import get_parser

matplotlib.use("agg")

## TODO: make this script use all arguments from analysis.py, ideally in some dynamic way so it doesn't have to be updated every time analysis.py is updated. The only two arguments that would be different are the model and prior files, which would be based on a list of models/priors provided as an argument for this script
## maybe also have bestfit stored as true in this script, so that it can be used to make plots of the bestfit model for each model/prior combination
## also potentially skip the plotting part of analysis.py, since that will be done here (this might preclude the corner plots from being output, but perhaps we can just call the plot argument since it doesn't really matter if the individual model lightcurves are output or not since they're not all that large in size)

def main():

## call analysis.py:main() multiple times, but with the model and prior files based on a list of models/priors provided as an argument for this script

## after the analyses are done, make a combined plot of each model along with the data. Essentially the same thing as the plotting done in analysis.py, but with all models on the same plot

## may benefit from having an additional file that ranks the models based on the difference in their log evidence/likelihood values, so that the "best" model has the highest difference in log evidence/likelihood compared to the other models, the second "best" model has the second highest difference in log evidence/likelihood compared to the other models, etc. This would streamline analysis rankings.
1 change: 1 addition & 0 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,7 @@ def readfile(filename):
"gwem_resampling_condor=nmma.em.gwem_resampling_condor:main",
"gwem_Hubble_estimate=nmma.em.gwem_Hubble_estimate:main",
"light_curve_analysis_condor=nmma.em.analysis_condor:main",
"multi_model_analysis=nmma.em.multi_model_analysis:main",
]
},
classifiers=[
Expand Down