Code Monkey home page Code Monkey logo

c3pp's Introduction

Documentation Status astropy


cosmoglobe is a python package that interfaces the Cosmoglobe Sky Model with Commander outputs for the purpose of producing astrophysical sky maps.

Features

See the documentation for a more comprehensive guide.

Initialize the Cosmoglobe Sky Model (this downloads and caches a ~800 MB file with the sky model data)

import cosmoglobe

model = cosmoglobe.sky_model(nside=256)

Simulate the sky at 150 GHz in units of MJy/sr, smoothed to 40 arcmin with a gaussian beam:

import astropy.units as u

emission = model(150*u.GHz, fwhm=40*u.arcmin, output_unit="MJy/sr")

Integrate over a bandpass:

import numpy as np
import healpy as hp
import matplotlib.pyplot as plt

# Reading in WMAP K-band bandpass profile.
bandpass_frequencies, bandpass_weights = np.loadtxt(wmap_bandpass.txt, unpack=True)

# The units of the detector must be specified even if the bandpass is pre-normalized.
bandpass_weights *= u.Unit("K_RJ") # Specify K_RJ or K_CMB
bandpass_frequencies *= u.GHz

model.remove_dipole() # Remove the dipole from the CMB component
emission = model(
    freqs=bandpass_frequencies, 
    weights=bandpass_weights, 
    fwhm=0.8*u.deg, 
    output_unit="mK_RJ",
)

hp.mollview(emission[0], hist="norm") # Plotting the intensity
plt.show()

Installation

cosmoglobe can be installed via pip

pip install cosmoglobe

Funding

This work has received funding from the European Union's Horizon 2020 research and innovation programme under grant agreements No 776282 (COMPET-4; BeyondPlanck), 772253 (ERC; bits2cosmology) and 819478 (ERC; Cosmoglobe).

License

GNU GPLv3

c3pp's People

Contributors

dncnwtts avatar eirikgje avatar maksymbrl avatar trygvels avatar unfunfunt avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar

c3pp's Issues

Polarization plots

First, can we make a plot of Q and U as an option? A la this:

Image Pasted at 2021-2-3 21-55

Second, would it be possible to plot headless vectors as an option?

image

"plot" not working properly

Running c3pp plot while specifying -min and/or -max gives an error message:

File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/click/core.py", line 764, in call
return self.main(*args, **kwargs)
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/click/core.py", line 717, in main
rv = self.invoke(ctx)
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/click/core.py", line 1137, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/click/core.py", line 956, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/click/core.py", line 555, in invoke
return callback(*args, **kwargs)
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/c3postproc/commands.py", line 214, in plot
Plotter(input, dataset, nside, auto, min, max, minmax, range, colorbar, lmax, fwhm, mask, mfill, sig, remove_dipole, logscale, size, white_background, darkmode, pdf, cmap, title, ltitle, unit, scale, verbose,)
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/c3postproc/plotter.py", line 371, in Plotter
ticklabels = [fmt(i, 1) for i in ticklabels]
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/c3postproc/plotter.py", line 371, in
ticklabels = [fmt(i, 1) for i in ticklabels]
File "/mn/stornext/u3/krisjand/.local/lib/python3.6/site-packages/c3postproc/plotter.py", line 786, in fmt
TypeError: bad operand type for abs(): 'str'

Apparently, the min/max values are stored as string (or something).

Furthermore, running "plot" with the -range option does nothing (the range is not applied).

Colorbar labels

The support for specifying which values the labels on the color bar takes have been removed. This leads to none or badly places labels on color bar.

Suggestion: Add the feature back to the code if possible.

Remake colorbar labels if using logscale

If using log-scale on user defined limits (e.g. "-min 1 -max 4") the color bar returns the log-limits and not 10 to the power of the limits in the labels of the color bar. It would be nice if the labels of the limits looks like 10^1 and 10^4 (not just 1 and 4), especially when the units of the color bar is not the logarithm.

Add possibility to make GIFs

Some kind of functionality where you could give a deterministic filename-scheme and make GIFs out of them would be cool!

Userdefined color bar units

Would be nice if there was a possibility to use a user defined label for the units of a color bar in a plot. E.g. when plotting the synchrotron amplitude at reference frequency 408 MHz, the intuitive unit would be K_RJ (not uK) as the values typically range between 10 and 300 K_RJ.

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.