| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
This bug causes wrong ellipse generation, which is the main reason to
the strange and wrong SNRs shapes.
|
| |
|
| |
|
|
|
|
|
|
| |
md5(): Calculate the MD5 checksum of the file.
Credit: https://stackoverflow.com/a/3431838/4856091
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Since some modules (e.g., healpix.py) under "utils" involves Numba JIT
optimization, which significantly slows the start-up speed, even some
consumers (e.g., bin/fg21sim-webui) do not need them at all.
Fix various import statements of other modules.
NOTE: not test at the moment!
|
| |
|
|
|
|
| |
Investigate whether the vectorization will improve the speed.
|
|
|
|
| |
Also update the docstring and one comment.
|
|
|
|
|
|
|
| |
* Fix the wrong output shape: wrongly swap the row and column
* Fix the area mapping method, which may give zero values when the index
of the input is integer, which cause problem to calculate the
overlapping areas.
|
|
|
|
| |
NOTE that the original optional paramter "rotation" is now required.
|
|
|
|
| |
Also remove the dependence on "scipy".
|
|
|
|
|
|
|
|
|
| |
The "rotate_center()" function rotates a gray-scale image by a given
angle about its center, using the area mapping method or simple nearest
neighbor.
This function is `numba` JIT-optimized, and can replace the
`scipy.ndimage.rotate()` function.
|
| |
|
|
|
|
|
|
|
|
|
|
| |
NOTE: However, there are two significant problems:
* Cannot figure out why ``nb.optional(nb.types.UniTuple(nb.int64, 2))``
does NOT work. Therefore, make ``shape`` as mandatory parameter
instead of optional.
* Cannot figure out multi-dispatch that allows both int and float types
for ``r``, ``c``, ``r_radius`` and ``c_radius``. Thus only support
the int type for the moment.
|
| |
|
|
|
|
|
| |
Remove the original "make_coordinate_grid()" function, and rename the
"make_coordinate_grid_fast()" to override the former one.
|
|
|
|
|
| |
Change the parameters of "make_coordinate_grid_fast()", make it share
the same parameter list as "make_coordinate_grid()".
|
|
|
|
|
| |
There are some limitations with the numba JIT, which are commented in
the code.
|
|
|
|
| |
Also fix a wrong notation in "random.py"
|
|
|
|
|
|
|
|
|
|
| |
To optimize "map_grid_to_healpix()" in `grid.py` which uses
"healpy.ang2pix()" using `numba.jit`, implement the latter's
functionality explicitly with `numba.jit` support.
The implementation simply mimic the corresponding functions
"ang2pix_ring_z_phi()" and "pix2ang_ring_z_phi()" in HEALPix's
"src/C/subs/chealpix.c". Thanks!
|
|
|
|
|
| |
Also place "_calc_hpx_row_idx()" before "_calc_hpx_indicies()", which is
required by `numba`.
|
|
|
|
|
|
|
|
| |
Optimize "make_coordinate_grid()" using "numba.jit", which improves the
speed a bit, since the other two functions (i.e., "make_grid_ellipse()",
and "map_grid_to_healpix()") are much slow and time-consuming.
TODO: optimize "make_grid_ellipse()" and "map_grid_to_healpix()"
|
|
|
|
|
|
|
|
|
| |
* Optimize the "Fnu_to_Tb()" and "Sb_to_Tb()" functions by explicitly
calculating the conversions, avoiding the slow `astropy.unit`
conversions (which is rather slow). The new fast functions are named
as "Fnu_to_Tb_fast()" and "Sb_to_Tb_fast()".
* Optimize the new functions using `numba.jit` further.
* Add `numba` to the dependencies.
|
|
|
|
|
| |
Currently implement "spherical_uniform()" to generate random points
uniformly distributed on the spherical surface.
|
|
|
|
|
|
|
|
| |
The necessary but missing functionalities to simulate the Galactic SNRs
emission maps are implemented, and this new emission component is ready
for testing.
Also fix a typo in "utils/grid.py".
|
|
|
|
|
|
|
|
| |
The "map_grid_to_healpix()" maps the generated coordinate grid to a
HEALPix map. Note that only effective HEALPix pixels are returned
instead of a full HEALPix map.
TODO: Try to avoid the explicit for loop to optimize the speed.
|
|
|
|
|
|
|
| |
* make_coordinate_grid(): Make a Cartesian coordinate grid according to
the specified center coordinate, size and grid resolution.
* make_grid_ellipse(): Also generate an (rotated) ellipse and place into
the coordinate grid.
|
| |
|
| |
|
| |
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
These functions will be used to draw the image of a SNR or a radio halo.
These functions are copied from the `scikit-image` project.
Thanks!
scikit-image: http://scikit-image.org/docs/dev/api/skimage.draw.html
|
|
|
|
|
|
|
|
| |
* healpix2hpx(), hpx2healpix(): Remove the "header" parameter, thus the
"data" parameter can only be either the filename or a HDU;
* healpix2hpx(): Remove the check on "ORDERING", since
"read_fits_healpix()" always return the HEALPix data in RING ordering;
* Small updates to the log messages and comments.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
| |
The missing pixels in the reprojected HEALPix map are filled with the
averages of their 8 neighboring pixels (excluding the NaN's if any).
Also add the "--inpaint" argument to the executable script.
|
|
|
|
| |
Also fix typos
|
|
|
|
|
|
|
| |
The mask array has values 0, 1, and 2, which indicate the different
statuses of the reprojected HEALPix pixels.
Also update the executable script to use the new return results.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The "zea2healpix()" function reprojects the maps in ZEA
(zenithal/azithumal equal area) projection to HEALPix data in Galactic
frame with RING ordering.
The other two helper functions "_image_to_healpix()" and "_convert_wcs()"
are almost copied from the "reproject" project [1]. Thanks!
TODO:
* Add some more logging
* Implement the "inpaint" argument to inpaint the HEALPix map if exists
missing pixels
[1] reproject: https://github.com/astrofrog/reproject
|
|
|
|
|
|
|
|
| |
* utils/fits.py: hack the dtype to ignore the byteorder (FITS data use
big endianness, e.g., dtype(">f4"))
* utils/healpix.py: explicit convert the dtype and log the dtype
* bin/healpix2hpx, bin/hpx2healpix: remove the --float argument
* other minor fixes/updates
|
|
|
|
| |
Also remove a unused variable in "galactic/synchrotron.py"
|
| |
|
|
|
|
|
|
| |
This function wraps on the `healpy.read_map()`, but reset the data array
to its original dtype in FITS file, as well as return the FITS header in
`astropy.io.fits.Header` object.
|
| |
|