Giter VIP home page Giter VIP logo

fgspectra's People

Contributors

beringueb avatar dpole avatar mabitbol avatar sgiardie avatar umbnat92 avatar xzackli avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

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

fgspectra's Issues

fg_spectra call from another directory

Hey guys,

I have written the simplest script for fgspectra:

from fgspectra import cross as fgc
from fgspectra import power as fgp
from fgspectra import frequency as fgf

ksz = fgc.FactorizedCrossSpectrum(fgf.UnitSED(), fgp.kSZ_bat())

it works when I run it in the fgspectra folder, but not when I try to run it from somewhere else.
It seems that the error is in: power.py, pkg_resources.resource_filename('fgspectra', 'data/')
Cheers,

Thibaut

CorrelatedFactorizedCrossSpectrum

I think this should take two frequency functions and two power spectrum functions?
Currently it takes callables with shape (comp, ... freqs) and (...,comp,comp,ell) but we dont have anything to generate those.

Linear combination of templates?

I thought it might be useful to support a power spectrum class corresponding to an arbitrary linear combination of input templates with free coefficients.

Not necessarily super urgent.

tsz x cib

I'm trying to get correlated tSZ x CIB following Zack's notebook: https://github.com/simonsobs/fgspectra/blob/master/notebooks/ACT_Models.ipynb

The output of

# joint tSZ, CIB, and their correlation
        tSZ_and_CIB(
            {'kwseq': (
                {'nu':freqs, 'nu_0':par['nu_0']},
                {'nu': freqs, 'nu_0':par['nu_0'], 'temp':par['T_d'], 'beta':par['beta_c']} 
                )},
            {'kwseq': ( 
                {'ell':ells, 'ell_0':par['ell_0'], 
                 'amp':par['a_tSZ']},
                {'ell':ells, 'ell_0':par['ell_0'], 
                 'alpha':2-par['n_CIBC'], 'amp':par['a_c']},
                {'ell':ells, 'ell_0':par['ell_0'], 
                 'amp': -par['xi'] * np.sqrt(par['a_tSZ'] * par['a_c'])}
                )})

however seems to be a tuple with one element whose shape is (1, 2998) where I've asked for 2998 multipoles. Shouldn't this be at least a (2,2,2998) array? @xzackli

Installation

Accidentally installed with python 2 before switching environments to 3 and there is the warning:
Found existing installation: fgspectra 0.1
Can't uninstall 'fgspectra'. No files were found to uninstall.

FYI

Implementation of Models in SO MBS

We received the request to provide tools that reproduce the spectra in the map-based simulations. There are two ways of accomplishing this.

File-based

  1. Compute the spectra from the simulations themselves
  2. Compress them
  3. Store them on disk
  4. Include in fgspectra the file or a link to it
  5. Provide a utility function that reads these spectra and de-compress them

Model based

  1. We write a model for each component and each correlation between the components

In spite of the number of steps, the former is much easier and quicker to carry out. The main downside is that it would not implement true models: there would not be any free parameter.

example documentation for creating a new model

I'd like to propose a tutorial page for creating a new foreground model in fgspectra. I'm hoping to get some feedback on this, before making a branch and trying to write this up.

I'm thinking the radio sources flux cut PR example sounds like it could be turned into a tutorial. I'm also thinking of making up a silly example involving a cross-correlation between i.e. Poisson sources and tSZ.

Amplitudes

Where do we add in amplitudes of these things?
The user just tacks it on at the end?

Model for the power from radio sources as a function of the flux cut

We have received a request for this model, but details are not clear.
To potential users, please express any need that could be not obvious (or feel free to mark down also the obvious ones).
To radio sources experts, please provide information about the functional form (and, of course, the parameters) that we should use in the implementation
Thanks!

New components

What new components do we need?
Current SEDs:
Power law, MBB, free-free, constant
Current power spectrum models:
Power law, arb template file (existing templates: tSZ_150_bat template, kSZ_bat, tSZxCIB)

Spinning dust SED? Power spectrum shape?
Add requests here

use meshgrid for some components instead of broadcasting

The numpy broadcasting is potentially confusing, might be good to have some examples which use np.meshgrid instead. Consider what I had to write for tSZxCIB for example,

return (2 * (ThermalSZ.f(nu_1, T_CMB)[...,np.newaxis] * CIB.mu(nu_2, beta, T_d, T_CMB) +
                     CIB.mu(nu_1, beta, T_d, T_CMB)[...,np.newaxis] * ThermalSZ.f(nu_2, T_CMB))
/ (2 * ThermalSZ.f(nu_0, T_CMB) * CIB.mu(nu_0, beta, T_d, T_CMB)))

The [..., np.newaxis] is very numpy but kind of tricky to work with / understand.

Make fgspectra installable via pip

Hi!

We are hoping to package SOLikeT for PyPI in the next few weeks, but at the moment we are dependent on fgspectra for the foregrounds. At the moment our requirements.txt points to a specfic branch on the github repo:
fgspectra @ git+https://github.com/simonsobs/fgspectra@act_sz_x_cib#egg=fgspectra

For SOLikeT to go on PyPI having requirements like this is forbidden, though. We could solve this by having fgspectra on PyPI too so the depedency just becomes fgspectra.

Would you be able to do this? Or if we do it would you accept the PR? Or some combination?

Default params

Did we ever define a set of defaults? For example for nu_0s? Or do we leave this completely to the user?

bandpass integration

Paraphrased from @damonge,

fgspectra can include bandpass convolution, as long as

  1. it does it at the SED level, and
  2. the code that does it lives in a separate module that other pipelines can also use.

and from @dpole

integration functions don’t take a list of file names as arguments but rather a list of arrays

Probably a good first attempt should be just to copy over the tile-c bandpass module. The default behavior should be to have a delta function bandpass.

SEDs and PowerSpectrum

How should we treat default parameters in here?
And can we have the user set some params (e.g. nu0 and ell0) when initializing the class?

tSZ cross spectrum evaluation

When you build the tSZ cross spectrum you have to pass a nested list for the frequencies: [[nu0, nu1]] because there are no SED parameters and it unpacks the list automatically assuming there are. Just to be aware

Deleting closed or useless branches

I periodically open this issue in any repo I work on. We've got several branches open that I think we can delete.

handle_defaults
add_the_models_back_in
exploit_correlated_factorized
polarization_models

@xzackli and @mabitbol please say "ok" if you agree or let me know the branches that are actually still active. Thanks!

Units

Decide and implement how to deal with units.

General cross spectrum function

We'd like to have a function that takes the SED of X and Y and produces an SED of (X1Y2 + X2Y1) for the CorrelatedFactorizedCrossSpectrum class. But we need to be careful that things aren't going to be double counted (e.g. is there an issue when nu1=nu2?).

Accessing parameters

I'm wondering if we can add support to the cross spectrum class that will allow us to see and access the SED and power spectrum parameters easily, like how it is done in FGBuster.

Basic Example Notebook

Hi, I tried running the code from Basic_Example.ipynb and got an error on In [6]: "TypeError: ThermalSZ object argument after ** must be a mapping, not tuple."

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.