Skip to content

Commit

Permalink
Merge branch 'release-040'
Browse files Browse the repository at this point in the history
  • Loading branch information
Gabriel-p committed May 3, 2021
2 parents 1e66cf8 + 278fc9b commit d710934
Show file tree
Hide file tree
Showing 123 changed files with 77,600 additions and 19,424 deletions.
67 changes: 60 additions & 7 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Change Log


## [[v0.4.0]][309] - 2021-05-03

### Changed

* Compensate cluster's mass for binaries masses? ([488][308])
* Estimate individual per-star masses ([484][307])
* Improve performance of synth cluster generation (3) ([506][306])
* Simplify isochrones download/handling ([497][305])
* Add CS 37 COLIBRI track + deprecate old versions 10 & 11 of PARSEC ([495][304])
* Optimal radius too large for some clusters ([510][303])
* Project equatorial coordinates before processing ([237][302])
* Add eccentricity parameter to KP fit? ([480][301])
* Finish working on enhanced King profile fitting ([456][300])
* Remove KDE_stds and mp_flag parameters ([500][299])
* Simplify input of structure parameters ([512][298])
* Deprecate all likelihoods except Tremmel ([507][297])
* Interpolate IMF masses into the isochrones, not the other way around ([503][296])
* Add minimum binary mass ratio to fundamental parameters? ([504][295])
* Deprecate Anderson-Darling test ([499][294])
* Deprecate "Read mode" ([498][293])
* Add IMF and PMF curves obtention ([96][292])
* Convert pixel coordinates to RA & DEC ([203][291])
* Add ZAMS to CMD final plot ([160][290])
* Add semi_input.dat checking to checker ([214][289])
* Add weighted spatial density map ([167][288])
* Generate output CMD-CCD plots for the mean+median+mode ([479][287])
* Exact circle area using geometry instead of Monte Carlo ([446][286])
* Use the maximum number of members in the optimal radius? ([494][285])
* Add 1-sigma region to King profile ([478][284])
* Turn off MP coloring in D2 plots for binned likelihoods ([473][283])


## [[v0.3.1]][282] - 2020-06-19

Only the `ptemcee` method is kept, all others are now deprecated.
Expand Down Expand Up @@ -812,10 +845,30 @@ ________________________________________________________________________________
[280]: https://github.com/asteca/ASteCA/commit/3ab2b30d3d107972734112e7f0bd8ce12709ebdc
[281]: https://github.com/asteca/ASteCA/issues/468
[282]: https://github.com/asteca/asteca/releases/tag/v0.3.1







[283]: https://github.com/asteca/ASteCA/issues/473
[284]: https://github.com/asteca/ASteCA/issues/478
[285]: https://github.com/asteca/ASteCA/issues/494
[286]: https://github.com/asteca/ASteCA/issues/446
[287]: https://github.com/asteca/ASteCA/issues/479
[288]: https://github.com/asteca/ASteCA/issues/167
[289]: https://github.com/asteca/ASteCA/issues/214
[290]: https://github.com/asteca/ASteCA/issues/160
[291]: https://github.com/asteca/ASteCA/issues/203
[292]: https://github.com/asteca/ASteCA/issues/96
[293]: https://github.com/asteca/ASteCA/issues/498
[294]: https://github.com/asteca/ASteCA/issues/499
[295]: https://github.com/asteca/ASteCA/issues/504
[296]: https://github.com/asteca/ASteCA/issues/503
[297]: https://github.com/asteca/ASteCA/issues/507
[298]: https://github.com/asteca/ASteCA/issues/512
[299]: https://github.com/asteca/ASteCA/issues/500
[300]: https://github.com/asteca/ASteCA/issues/456
[301]: https://github.com/asteca/ASteCA/issues/480
[302]: https://github.com/asteca/ASteCA/issues/237
[303]: https://github.com/asteca/ASteCA/issues/510
[304]: https://github.com/asteca/ASteCA/issues/495
[305]: https://github.com/asteca/ASteCA/issues/497
[306]: https://github.com/asteca/ASteCA/issues/506
[307]: https://github.com/asteca/ASteCA/issues/484
[308]: https://github.com/asteca/ASteCA/issues/488
[309]: https://github.com/asteca/asteca/releases/tag/v0.4.0
67 changes: 0 additions & 67 deletions packages/.asteca_map

This file was deleted.

2 changes: 1 addition & 1 deletion packages/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "v0.3.1"
__version__ = "v0.4.0"
11 changes: 9 additions & 2 deletions packages/asteca_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,25 @@ def main():
# files are read and stored here.
cl_files, pd = check_all(mypath, file_end)

# Prepare tracks and other required data
if pd['best_fit_algor'] != 'n':
from packages.synth_clust import tracksPrep
pd = tracksPrep.main(pd)

# Import here to ensure the check has passed and all the necessary
# packages are installed.
from packages import func_caller

print("Full check done.\n\nNumber of clusters to analyze: {}".format(
len(cl_files)))
# Iterate through all cluster files.
for cl_file in cl_files:
try:
# Call module that calls all sub-modules sequentially.
func_caller.main(cl_file, pd)
except Exception:
print('\n!!! --> {}/{} '.format(cl_file[-2], cl_file[-1]) +
'could not be successfully processed <-- !!!\n')
print('\n!!! --> {}/{} '.format(cl_file[-2], cl_file[-1])
+ 'could not be successfully processed <-- !!!\n')
print(traceback.format_exc())

# End of run.
Expand Down
56 changes: 53 additions & 3 deletions packages/aux_funcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
from astropy.stats import sigma_clipped_stats


def flatten(l):
def flatten(lst):
"""
Source: https://stackoverflow.com/a/2158532/1391441
"""
for el in l:
for el in lst:
if isinstance(el, Iterable) and not\
isinstance(el, (str, bytes)):
for sub in flatten(el):
Expand Down Expand Up @@ -57,12 +57,14 @@ def kde1D(data, xmin=None, xmax=None, bw=None, xr_fr=.1):
return kde_x, kde


def circFrac(cent, rad, x0, x1, y0, y1, N_tot, rand_01_MC, cos_t, sin_t):
def circFrac(cent, rad, x0, x1, y0, y1, rand_01_MC, cos_t, sin_t):
"""
Use Monte Carlo to estimate the fraction of the area of a circle centered
in (cx, cy) with a radius of 'rad', that is located within the frame given
by the limits 'x0, x1, y0, y1'.
"""
N_tot = len(rand_01_MC)

cx, cy = cent
# Source: https://stackoverflow.com/a/50746409/1391441
# r = rad * np.sqrt(np.random.uniform(0., 1., N_tot))
Expand All @@ -77,3 +79,51 @@ def circFrac(cent, rad, x0, x1, y0, y1, N_tot, rand_01_MC, cos_t, sin_t):
# The area is the points within circle and frame over the points within
# circle.
return msk_xy.sum() / N_tot


def ellipFrac(
cent, a, theta, ecc, x0, x1, y0, y1, rand_01_MC, cos_t, sin_t):
"""
Use Monte Carlo to estimate the fraction of the area of an ellipse centered
in (cx, cy) and rotated an angle theta, with a semi-major axis 'a' and
eccentricity 'ecc', that is located within the frame given by the limits
'x0, x1, y0, y1'.
"""
N_tot = len(rand_01_MC)

cx, cy = cent
b = a * np.sqrt(1 - ecc**2)
cos_th = np.cos(theta)
sin_th = np.sin(theta)

# r = rad * np.sqrt(np.random.uniform(0., 1., N_tot))
# theta = np.random.uniform(0., 1., N_tot) * 2 * np.pi
rand_01_MC_a = rand_01_MC * a
rand_01_MC_b = rand_01_MC * b

# https://math.stackexchange.com/questions/2645689/what-is-the-parametric-equation-of-a-rotated-ellipse-given-the-angle-of-rotatio

xr = cx + rand_01_MC_a * cos_t * cos_th - rand_01_MC_b * sin_t * sin_th
yr = cy + rand_01_MC_a * cos_t * sin_th + rand_01_MC_b * sin_t * cos_th

# Points within the ellipse that are within the frame.
msk_xy = (xr > x0) & (xr < x1) & (yr > y0) & (yr < y1)

return msk_xy.sum() / N_tot


def monteCarloPars(N_MC=10000):
"""
Parameters for the Monte Carlo estimation of the fraction of circle/ellipse
area within a rectangle. Used by the circFrac(), ellipFrac() functions.
N_MC: number of Monte Carlo points to use when estimating circular areas.
"""

# Obtain these values here so they are not estimated every time the MC
# in circFrac() is called.
rand_01_MC = np.sqrt(np.random.uniform(0., 1., N_MC))
theta = np.random.uniform(0., 1., N_MC) * 2 * np.pi
cos_t, sin_t = np.cos(theta), np.sin(theta)

return rand_01_MC, cos_t, sin_t
Loading

0 comments on commit d710934

Please sign in to comment.