qubicsoft / qubic Goto Github PK
View Code? Open in Web Editor NEWData analysis tools for the QUBIC experiment.
Home Page: http://qubic.in2p3.fr
Data analysis tools for the QUBIC experiment.
Home Page: http://qubic.in2p3.fr
The module insert_point_sources_in_sky.py
currently splits evenly the polarized flux between Q and U. Actually one can use the polarization angle information available in the catalog to calculate the Q and U intensities
The NaMaster package can not be installed automatically, its dependencies (such as numpy or required binary libraries) need to be installed beforehand. This package needs to be installed independently from qubic.
The issue relates to insert_point_source_in_sky.py
. Ideally it should work on a list of sources but as a matter of fact it adds only the last source in the list.
Should include FGBuster dependency.
The packages required to build qubicsoft should be specified in the pyproject.toml file.
The 2d cartesian communicator of the acquisition was used in some places to get the total number of detectors and samplings. The correct communicators are the instrument.detector and sampling communicators.
By default, the conda create in the README file should have the python version needed:
conda create --yes --name venv-qubic python==3.xx
Nosetests being discontinued, the tests need to be converted to pytests. They also need to be updated, since the change involving using dictionary as an argument to QubicInstrument, QubicAcquisition etc. broke them.
The default value for the compress
parameter to write_map
is True, meaning that the code will use one of the compression algorithms specified by the FITS standard. Since these algorithms are lossy when applied to maps containing floating-point values, the code will silently introduce an error in the data written to disk, as the following example shows:
import numpy
import qubic.io
FILE_NAME = '/tmp/compressed_map.fits'
INPUT_PIXELS = numpy.random.normal(size=12 * 64 * 64)
qubic.io.write_map(FILE_NAME, INPUT_PIXELS, dtype=numpy.float64)
OUTPUT_PIXELS = qubic.io.read_map(FILE_NAME)
DIFF = OUTPUT_PIXELS - INPUT_PIXELS
print('Stddev of the difference: {0:.3f}'
.format(numpy.std(DIFF)))
# Result:
# Stddev of the difference: 0.018
(Note that the code uses float64
instead of the default float32
type when calling write_map
.) Setting compress=False
in the above call to qubic.io.write_map
makes the difference between INPUT_PIXELS
and OUTPUT_PIXELS
to vanish.
Since this behaviour might be surprising for people not versed with the FITS standard, I am suggesting a couple of workarounds:
compress
default to False, and specify in the docstring for write_map
that using True
with floating-point maps will introduce an error in the pixel values (currently, the docstring does not mention the compress
parameter anywhere but in the declaration);compress
is True
and the datatype of the parameter map
is a floating-point value.The following code makes write_map
crash:
import numpy
import healpy
import qubic.io
INPUT_FILENAME = '/tmp/input.fits'
OUTPUT_FILENAME = '/tmp/output.fits'
healpy.write_map(INPUT_FILENAME, numpy.arange(12))
pixels = qubic.io.read_map(INPUT_FILENAME)
qubic.io.write_map(OUTPUT_FILENAME, pixels) # bang
The error is the following:
Traceback (most recent call last):
File "error.py", line 10, in <module>
qubic.io.write_map(OUTPUT_FILENAME, pixels) # bang
File "/home/tomasi/work/qubic/qubic/qubic/io/_io.py", line 177, in write_map
coord = map.header['coordsys'].upper()
TypeError: list indices must be integers, not str
The problem lies in the fact that when qubic.io.read_map
uses Healpy to read a map, it stores the header (in pixels.header
) as a list
instead of a astropy.io.header.Header
object. I'll shortly submit a PR to fix this small issue.
Healpy used to store map as float32 by default, but this behaviour was changed in 1.15.0 : it now use the original data type. Qubicsoft still has the old healpy behaviour and we should also move to the new one.
Conda on MacOS Ventura installs healpy with a version 0.0.0, which is rejected by the dependency specification.
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.