nasa-lambda / cmb_footprint Goto Github PK
View Code? Open in Web Editor NEWLibrary to plot footprints of cosmological surveys
Library to plot footprints of cosmological surveys
I've tried to use a custom map for the background, similar to what has been commented in the various examples.
import numpy as np
import matplotlib.pyplot as plt
import healpy as hp
import os
import sys
separator = os.sep
fullpath = os.getcwd().split(separator)
source_path = separator.join(fullpath[0:-2])
sys.path.append(source_path)
from cmb_footprint import footprint
if __name__ == '__main__':
background_map = np.arange(hp.nside2npix(256))
fp = footprint.SurveyStack(
background_map, config='../footprint.cfg',
coord_bg='G', coord_plot='G',
min=background_map.min(), max=background_map.max())
fp.superimpose_survey('BOSS-LSS-RANDOM2', color='green')
plt.show()
That produces the following output:
Any help is greatly appreciated, I really enjoyed playing around with the package!
This package has stopped working with versions of matplotlib>=3.5.0 and cbar=True. Here is the output for one of the examples:
$ python plot_lss.py
Warning: Ignoring XDG_SESSION_TYPE=wayland on Gnome. Use QT_QPA_PLATFORM=wayland to run on Wayland anyway.
WARNING: AstropyDeprecationWarning: "verbose" was deprecated in version 1.15.0 and will be removed in a future version. [cmb_footprint.config_handler]
WARNING: AstropyDeprecationWarning: "verbose" was deprecated in version 1.15.0 and will be removed in a future version. [healpy.visufunc]
WARNING: AstropyDeprecationWarning: "verbose" was deprecated in version 1.15.0 and will be removed in a future version. [cmb_footprint.config_handler]
Traceback (most recent call last):
File "/home/msyriac/repos/cmb_footprint/examples/plot_lss.py", line 28, in <module>
fp.superimpose_survey('BOSS-LSS-RANDOM2',color='green')
File "/home/msyriac/repos/cmb_footprint/footprint.py", line 323, in superimpose_survey
self.superimpose_hpxmap(hpx_map, label, color=color,
File "/home/msyriac/repos/cmb_footprint/footprint.py", line 168, in superimpose_hpxmap
self.fig.colorbar(im0, cax=ax_color, orientation='horizontal',
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/figure.py", line 1158, in colorbar
cb = cbar.Colorbar(cax, mappable, **cb_kw)
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/colorbar.py", line 493, in __init__
self.draw_all()
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/colorbar.py", line 577, in draw_all
X, Y, extendlen = self._mesh()
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/colorbar.py", line 1132, in _mesh
y, extendlen = self._proportional_y()
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/colorbar.py", line 1247, in _proportional_y
y = np.ma.filled(norm(y), np.nan)
File "/home/msyriac/.local/lib/python3.10/site-packages/matplotlib/colors.py", line 1245, in __call__
raise ValueError("minvalue must be less than or equal to maxvalue")
ValueError: minvalue must be less than or equal to maxvalue
Hi,
I tried to run the plot_lss script from a clean checkout:
python plot_lss.py
the stack trace is here:
python plot_lss.py
Traceback (most recent call last):
File "plot_lss.py", line 15, in <module>
from cmb_footprint import footprint
File "/home/yfeng1/source/cmb_footprint/footprint.py", line 24, in <module>
from cmb_footprint.config_handler import ConfigHandler
File "/home/yfeng1/source/cmb_footprint/config_handler.py", line 28, in <module>
from astropy.coordinates import SkyCoord
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/__init__.py", line 13, in <module>
from .baseframe import *
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/baseframe.py", line 1218, in <module>
from .earth import EarthLocation
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/earth.py", line 10, in <module>
from .builtin_frames import ITRS
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/builtin_frames/__init__.py", line 28, in <module>
from .fk5 import FK5
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/builtin_frames/fk5.py", line 12, in <module>
from .utils import EQUINOX_J2000
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/coordinates/builtin_frames/utils.py", line 16, in <module>
from ...utils import iers
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/utils/iers/__init__.py", line 4, in <module>
from .iers import *
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/utils/iers/iers.py", line 62, in <module>
from ...table import Table
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/table/__init__.py", line 25, in <module>
from .jsviewer import JSViewer
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/table/jsviewer.py", line 190, in <module>
io_registry.register_writer('jsviewer', Table, write_table_jsviewer)
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/io/registry.py", line 189, in register_writer
_update__doc__(data_class, 'write')
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/io/registry.py", line 105, in _update__doc__
format_table = get_formats(data_class)
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/io/registry.py", line 68, in get_formats
format_table.sort(['Data class', 'Deprecated', 'Format'])
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/table/table.py", line 1851, in sort
indexes = self.argsort(keys)
File "/home/yfeng1/.local/lib/python2.7/site-packages/astropy/table/table.py", line 1813, in argsort
return data.argsort(**kwargs)
File "/home/yfeng1/.local/lib/python2.7/site-packages/numpy/core/_internal.py", line 307, in _parse_order
name, flag = name
ValueError: too many values to unpack
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.