aboutsummaryrefslogtreecommitdiffstats
path: root/fg21sim/utils
Commit message (Collapse)AuthorAgeFilesLines
* utils/convert.py: Use 'utils.units' moduleAaron LI2017-06-231-6/+7
|
* utils/units.py: Add "rad2deg" and "k_B"Aaron LI2017-06-231-1/+5
|
* utils/cosmology: Add methods DL() and DA()Aaron LI2017-06-191-0/+14
|
* clusters: Move units.py and cosmology.py to utilsAaron LI2017-06-012-0/+287
|
* Add utils/wcs.py with function "make_wcs()"Aaron LI2017-05-221-0/+54
|
* utils/grid: Add function "make_ellipse()"Aaron LI2017-05-221-7/+47
|
* utils/draw.py: Merge "_ellipse_in_shape()" to "ellipse()"Aaron LI2016-12-132-85/+25
| | | | | * Fix the bug that "ellipse()" generate unexpected results. * Update the parameters of "ellipse()" also
* utils/draw.py: Fix a wrong brace in "_ellipse_in_shape()"Aaron LI2016-12-131-1/+1
| | | | | This bug causes wrong ellipse generation, which is the main reason to the strange and wrong SNRs shapes.
* utils: Add download.py with function "download_file()"Aaron LI2016-11-261-0/+112
|
* utils: Rename function "md5()" to "calc_md5()"Aaron LI2016-11-261-1/+1
|
* utils: Add "hashutil.py" with function "md5()"Aaron LI2016-11-211-0/+40
| | | | | | md5(): Calculate the MD5 checksum of the file. Credit: https://stackoverflow.com/a/3431838/4856091
* utils/draw.py: Remove the "Modified BSD" license; Update creditAaron LI2016-11-181-40/+4
|
* utils/healpix.py: Fix the import issueAaron LI2016-11-091-1/+1
|
* utils/__init__.py: Only import "setup_logging" from "logging.py"Aaron LI2016-10-291-3/+0
| | | | | | | | | | 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!
* utils/random.py: Add a note on conversion to (longitude, latitude)Aaron LI2016-10-281-0/+5
|
* utils/rotate.py: Add a new ref. which may help further vectorizationAaron LI2016-10-281-0/+2
| | | | Investigate whether the vectorization will improve the speed.
* utils/fits.py: Add parameter "checksum" for write_fits_healpix()Aaron LI2016-10-271-8/+13
| | | | Also update the docstring and one comment.
* utils/rotate.py: Fix two bugs which cause wrong resultsAaron LI2016-10-261-4/+13
| | | | | | | * 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.
* utils/grid.py: JIT optimize "make_grid_ellipse()"Aaron LI2016-10-261-10/+15
| | | | NOTE that the original optional paramter "rotation" is now required.
* utils/grid.py: Use own-implemented JIT-optimized "rotate_center()"Aaron LI2016-10-261-3/+3
| | | | Also remove the dependence on "scipy".
* Add utils/rotate.py: Implement basic image rotationAaron LI2016-10-261-0/+131
| | | | | | | | | 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.
* draw.py: Remove the unused "circle()" functionAaron LI2016-10-251-42/+0
|
* draw.py: Optimize "ellipse()" using numba JITAaron LI2016-10-251-17/+27
| | | | | | | | | | 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.
* draw.py: Optimize "_ellipse_in_shape()" using JITAaron LI2016-10-251-3/+20
|
* grid.py: Override "make_coordinate_grid()" using JIT-optimized versionAaron LI2016-10-251-46/+2
| | | | | Remove the original "make_coordinate_grid()" function, and rename the "make_coordinate_grid_fast()" to override the former one.
* grid.py: Change "make_coordinate_grid_fast()" parametersAaron LI2016-10-251-11/+16
| | | | | Change the parameters of "make_coordinate_grid_fast()", make it share the same parameter list as "make_coordinate_grid()".
* grid.py: Optimize "map_grid_to_healpix()" using "numba.jit"Aaron LI2016-10-251-11/+19
| | | | | There are some limitations with the numba JIT, which are commented in the code.
* healpix.py: Change all "indices" to "indexes"Aaron LI2016-10-252-19/+19
| | | | Also fix a wrong notation in "random.py"
* healpix.py: Implement "ang2pix_ring" and "pix2ang_ring" with JITAaron LI2016-10-251-0/+213
| | | | | | | | | | 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!
* healpix.py: Optimize "_calc_hpx_indicies()" and "_calc_hpx_row_idx()"_Aaron LI2016-10-251-60/+68
| | | | | Also place "_calc_hpx_row_idx()" before "_calc_hpx_indicies()", which is required by `numba`.
* utils/grid.py: Add optimized "make_coordinate_grid_fast()"Aaron LI2016-10-251-4/+56
| | | | | | | | 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()"
* convert.py: Optimize "Fnu_to_Tb()" and "Sb_to_Tb()"Aaron LI2016-10-241-0/+65
| | | | | | | | | * 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.
* Add utils/random.py: Custom random utilitiesAaron LI2016-10-221-0/+51
| | | | | Currently implement "spherical_uniform()" to generate random points uniformly distributed on the spherical surface.
* galactic/snr.py: Implemented missing but necessary functionalitiesAaron LI2016-10-171-1/+1
| | | | | | | | 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".
* utils/grid.py: Implement "map_grid_to_healpix()"Aaron LI2016-10-171-9/+29
| | | | | | | | 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.
* Add utils/grid.py: Make coordinate grids for SNRsAaron LI2016-10-171-0/+157
| | | | | | | * 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.
* Force "DEBUG" log level if env variable "DEBUG_FG21SIM" setAaron LI2016-10-171-0/+4
|
* utils/logging.py: Small updates to the docstrings and commentsAaron LI2016-10-171-14/+16
|
* utils/draw.py: List the functions taken from "scikit-image"Aaron LI2016-10-171-2/+8
|
* Fix the reStructuredText citation syntaxAaron LI2016-10-171-1/+1
|
* utils/draw.py: Add disclaimer about the license: Modified BSDAaron LI2016-10-151-4/+41
|
* Add utils/convert.py: Implement brightness temperature conversionAaron LI2016-10-151-0/+63
|
* Add utils/draw.py: draw circles and ellipsesAaron LI2016-10-151-0/+128
| | | | | | | | | 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
* utils: healpix2hpx & hpx2healpix: Remove "header" parameterAaron LI2016-10-111-35/+20
| | | | | | | | * 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.
* utils: Update documentations, also fix stylesAaron LI2016-10-112-35/+53
|
* utils/healpix.py: log that HPX indices calculation may take a while.Aaron LI2016-10-101-0/+1
|
* utils: zea2heapix(): Set value NaN for missing pixelsAaron LI2016-10-101-5/+9
|
* utils: zea2healpix(): Implement inpainting missing pixelsAaron LI2016-10-101-3/+51
| | | | | | | 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.
* utils: zea2healpix(): Average the duplicate pixelsAaron LI2016-10-101-2/+4
| | | | Also fix typos
* utils: zea2healpix() also return the mask arrayAaron LI2016-10-101-5/+13
| | | | | | | 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.