Code Monkey home page Code Monkey logo

ptarcade's People

Contributors

andrea-mitridate avatar davecwright3 avatar kdolum avatar nanonay avatar rafael-robson avatar riroro13 avatar tanner-trickle avatar tobiass0701 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ptarcade's Issues

issue with uniform prior from 0 to 1

I test the code with a very simple model file where $\Omega_{\rm gw} h^2 = 0$

import numpy as np
from ptarcade.models_utils import prior

parameters = {
            'test' : prior("Uniform", 0 , 1)
            }

smbhb = False
name = "test"


def spectrum( f , test ):
    Omegah2 = 0
    return 0*f

and I run it with
ptarcade -m test_model.py

it runs quickly and I get the chain. The posterior is
image

which I believe does not reflect the uniform prior from 0 to 1. The issue is still here when I add Nsamp or burn a lot of samples in the beginning.

However when I change the prior from 1 to 2 the issue is gone:
image

So I suppose that something happened in the definition of the uniform prior?

Utility function to compute integrated energy density

Is your feature request related to a problem? Please describe.
Some models are bounded by BBN or CMB bounds on cosmological energy density. Having a switch to include these bounds in the prior function would be useful for constraining posteriors

Describe the solution you'd like

  1. Create a utility function to calculate the integrated energy density across frequency for a model spectrum supplied with input parameters
  2. Use that utility function in the log-prior function. If the integrated energy density is greater than a chosen bound, return -inf

Describe alternatives you've considered
We could just take the posterior and remove samples that result in energy densities greater than the bound? How would these two methods change the posterior?

Additional context
I'd like to compute the integrated energy density of the different spectra I'll be using to compare each other

Improve README

Our full documentation is great, but we should add some more information, images, etc. to the README.

Bug report : plot_utils.plot_posteriors

Attribute error for params in 'plot_utils.plot_posteriors'. I am using the conda environment method to run PTArcade.

Following the quick start section in from the arXiv documentation I can run the mcmc step but when I run the commands for plotting

p_utils.plot_posteriors([chain] , [params]) 

I get the following error

File ~/miniconda3/envs/ptarcade/lib/python3.10/site-packages/ptarcade/plot_utils.py:827, in <listcomp>(.0)
    824 N_chains = len(chains)
    826 priors = params
--> 827 params = [np.array(list(par.keys())) for par in params]
    829 if par_to_plot is None:
    830     par_to_plot = [None] * N_chains

AttributeError: 'numpy.ndarray' object has no attribute 'keys'

The chains seem to import no problem

after running

chain, params = c_utils.import_chains('./chains/np_model/') 

the output is

Starting import from ./chains/np_model/
Finished importing   chains/np_model in 0.13s

Perhaps I am doing something basic wrong, but I'm unsure.

Any help you could give would be greatly appreciated. Thanks so much for making this very exciting tool.

Cheers,
Andrew

Google colab compatibility

Hello, I am sorry if this is a bit naive or silly. But I was wondering if PTArcade can be somehow made compatible with Windows, or can be made possible to be installed on Google Colab?

Before doing pip install, one needs to install Tempo2. And from what I gathered, it can not be installed on Windows. Due to such linux/ mac dependencies, I am unable to install PTArcade on Google colab.

Is it possible to have a version which works on windows too? Or if there's already a way to do it, I will be grateful for the help.

Also, this is the first time I am posting/ commenting on GitHub, so I am open to any suggestions/ feedback.

Thank you!

Alert user about spatial correlation limitations for certain datasets

For NG15 the user can choose between the data with and without spatial correlations in Ceffyl mode. There is not such a choice for IPTA2 and NG12.

Solution

Do not error out. Capture the user's config, print a statement to STDOUT that we are falling back to the available mode for the given dataset.

prior parameter constraints & a little question about spec_importer & parallel

Describe the bug
a) Is there a way to impose constraints on parameters using specific settings? For instance, assuming I have parameters
a and b with a Uniform prior ranging from [0,1], I'd like to enforce a condition where x≥y. This is reminiscent of the example found in Bilby's documentation.

b) The documentation provides a method for importing a spectrum:

log_spectrum = spec_importer(path)
def spectrum(f, p):
    return 10**log_spectrum(np.log10(f), p=p)

Given this, is it feasible to modify the log_spectrum function to accommodate additional parameters and subsequently retrieve the final spectrum as demonstrated below?

def spectrum(f, p, A):
    return A * 10**log_spectrum(np.log10(f), p=p)

c) Is this package capable of parallel execution on both High-Performance Computing (HPC) systems and personal PCs? If so, how can one configure the number of threads or cores utilized by the package?

Build Singularity container with GitHub actions

Integration of PTArcade with Cobaya

Hi, I am trying to study the joint analysis of PTA data with other cosmological data such as Planck using the MCMC sampler Cobaya. Can the PTArcade be integrated with cosmological samplers? Please let me know how to do it if it is possible.

plot_posteriors out directory

plot_posteriors crashes when save = False if it does not find a directory named plots in the local directory.

Possible solutions:

  • change it so that a plots directory is created if none is found in the local directory.
  • save the plot in the local directory by default

Related to this we should allow the user to specify the output directory.

I installed ptarcade via pip and conda, both show successfully installed. But it alway failed when I try to import the ptarcade module. I'm work on Ubuntu 22.04 with python version 3.10.12 (conda python version 3.11).

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. Ubuntu 22.04]
  • Python version [e.g. 3.10.11]
  • Python environment [e.g. conda, venv]
  • Version [e.g. 0.1.2]

Additional context
Add any other context about the problem here.

Compute the bend frequency

Is your feature request related to a problem? Please describe.
Input spectrum models have a peak frequency. It'd be nice to have a separate method to compute it for given spectral parameters

Describe the solution you'd like
Add a separate method in the input models to compute f0

Describe alternatives you've considered
I can just copy the code out of model.py and add my own f0 function for each input model. But it'd be nice to have it as a formal part of each input spectrum

Additional context
I want to see where the peak frequency compares to the PTA band

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.