ism3d.utils.utils¶
General-purpose utility Functions used by other modules
Functions
backup file / dirwectiory to be overwrite |
|
translated from IDL/gal_flat.pro im in (nz,ny,nx) cen is (xc,yc) |
|
get the size of a file or directory |
|
print out the parameter dict |
|
fill. |
|
linechan / contchan: tuple with [fmin,fmax] in each element |
|
validate the input parameters, will do the follows step by step |
|
parsing the slicing syntax in STRING |
|
convert quatity to values in default internal units |
|
past a small array into a larger array with shifting works for high dimension or off-edge cases wall/block requires in the same dimension number loc: the index of left-bottom pixel of block in wall. |
|
make slice for the overlapping region |
|
A modified pprint.pprint without sorting dictionary keys |
|
read parameter quantity / values (in default units) from a parameter dictionary this function can handle literal slicing and attribute syntax e.g.: par_str[ind_str]@section_name par_str.attrubute@section_name |
|
modifiy the parameter exploring bounrdary according to the info from opt section a: absolute |
|
Similiar to the built-in repr(), but can handle Quantity / SkyCoord used for writing input files |
|
rotate points in a 2D coordinate system angle: rotate points by angle in CCW ref: rotate_xy.pro rot_3d.pro performance consideration: https://gist.github.com/LyleScott/e36e08bfb23b1f87af68c9051f985302 https://stackoverflow.com/questions/33004551/why-is-b-numpy-dota-x-so-much-slower-looping-through-doing-bi-numpy https://en.wikipedia.org/wiki/Rotation_matrix |
|
this is loosely based on my sample_grid.pro in IDL with improvement on defining x-/y-range angle in rad ratio=major/minor |
|
some underline alrgoithm library can use OMP turn on OMP is beneficial for iteration optimizwer but not for parallele optimizer this function can turn on / turn off OMP in modelling alrothjm |
|
write parameter values |