Skip to content

Commit

Permalink
merged selected patches from master
Browse files Browse the repository at this point in the history
  • Loading branch information
deanthedream committed Jun 22, 2018
1 parent 951b221 commit f79a025
Show file tree
Hide file tree
Showing 16 changed files with 13,854 additions and 4 deletions.
23 changes: 23 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
name: Bug report
about: Create a report to help us improve

---

**Describe the bug**
A clear and concise description of what the bug is.

**To Reproduce**
Steps to reproduce the behavior:

**Expected behavior**
A clear and concise description of what you expected to happen.

**JSON script:**
If applicable, add the script you are using.

**EXOSIMS version:**
- Release or github commit/branch

**Additional context**
Add any other context about the problem here.
14 changes: 14 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
name: Feature request
about: Suggest an idea for this project

---

**Is your feature request related to a problem? Please describe.**
A clear and concise description of what the problem is.

**Describe the solution you'd like**
A clear and concise description of what you want to happen.

**Additional context**
Add any other context or screenshots about the feature request here.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ EXOCATXLS.py*
ToyCat1.py*
de432s.bsp
fitting_parameters.h5
*.json
*.comp
*.so
*.acomp
Expand All @@ -94,3 +95,4 @@ statsFun_C
*.fits
*.csv
*.fZmax
*.starkfZ
7 changes: 7 additions & 0 deletions EXOSIMS/Prototypes/SurveySimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,11 @@ def observation_detection(self, sInd, intTime, mode):
self.vprint(log_FA)

#Schedule Target Revisit
<<<<<<< HEAD
self.scheduleRevisit(sInd,smin,det,pInds)
=======
self.scheduleRevisit(sInd, smin, det, pInds)
>>>>>>> master

return detected.astype(int), fZ, systemParams, SNR, FA

Expand All @@ -848,7 +852,10 @@ def scheduleRevisit(self,sInd,smin,det,pInds):
TK = self.TimeKeeping
TL = self.TargetList
SU = self.SimulatedUniverse
<<<<<<< HEAD

=======
>>>>>>> master
# in both cases (detection or false alarm), schedule a revisit
# based on minimum separation
Ms = TL.MsTrue[sInd]
Expand Down
17 changes: 14 additions & 3 deletions EXOSIMS/Prototypes/TargetList.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,20 @@ def __init__(self, missionStart=60634, staticStars=True,
assert isinstance(keepStarCatalog, bool), "keepStarCatalog must be a boolean."
assert isinstance(fillPhotometry, bool), "fillPhotometry must be a boolean."
assert isinstance(explainFiltering, bool), "explainFiltering must be a boolean."
assert isinstance(filterBinaries, bool), "filterBinaries must be a boolean."
self.staticStars = bool(staticStars)
self.keepStarCatalog = bool(keepStarCatalog)
self.fillPhotometry = bool(fillPhotometry)
self.explainFiltering = bool(explainFiltering)
self.filterBinaries = bool(filterBinaries)

# check if KnownRVPlanetsTargetList is using KnownRVPlanets
if specs['modules']['TargetList'] == 'KnownRVPlanetsTargetList':
assert specs['modules']['PlanetPopulation'] == 'KnownRVPlanets', \
'KnownRVPlanetsTargetList must use KnownRVPlanets'
else:
assert specs['modules']['PlanetPopulation'] != 'KnownRVPlanets', \
'This TargetList cannot use KnownRVPlanets'

# check if KnownRVPlanetsTargetList is using KnownRVPlanets
if specs['modules']['TargetList'] == 'KnownRVPlanetsTargetList':
Expand Down Expand Up @@ -346,9 +356,10 @@ def filter_target_list(self, **specs):
"""

# filter out binary stars
self.binary_filter()
if self.explainFiltering:
print("%d targets remain after binary filter."%self.nStars)
if self.filterBinaries:
self.binary_filter()
if self.explainFiltering:
print("%d targets remain after binary filter."%self.nStars)

# filter out systems with planets within the IWA
self.outside_IWA_filter()
Expand Down
84 changes: 83 additions & 1 deletion EXOSIMS/SurveySimulation/linearJScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
import astropy.units as u
import numpy as np
import itertools
import astropy.constants as const


class linearJScheduler(SurveySimulation):
"""linearJScheduler
Expand All @@ -18,7 +20,7 @@ class linearJScheduler(SurveySimulation):
"""

def __init__(self, coeffs=[1,1,2,1], **specs):
def __init__(self, coeffs=[1,1,2,1], revisit_wait=91.25*u.d, **specs):

SurveySimulation.__init__(self, **specs)

Expand All @@ -32,6 +34,9 @@ def __init__(self, coeffs=[1,1,2,1], **specs):

self.coeffs = coeffs

self.revisit_wait = revisit_wait
self.no_dets = np.ones(self.TargetList.nStars, dtype=bool)

def choose_next_target(self, old_sInd, sInds, slewTimes, intTimes):
"""Choose next target based on truncated depth first search
of linear cost function.
Expand Down Expand Up @@ -114,3 +119,80 @@ def choose_next_target(self, old_sInd, sInds, slewTimes, intTimes):
sInd = sInds[int(np.floor(tmp/float(nStars)))]

return sInd, None

def revisitFilter(self, sInds, tmpCurrentTimeNorm):
"""Helper method for Overloading Revisit Filtering
Args:
sInds - indices of stars still in observation list
tmpCurrentTimeNorm (MJD) - the simulation time after overhead was added in MJD form
Returns:
sInds - indices of stars still in observation list
"""
tovisit = np.zeros(self.TargetList.nStars, dtype=bool)#tovisit is a boolean array containing the
if len(sInds) > 0:#so long as there is at least 1 star left in sInds
tovisit[sInds] = ((self.starVisits[sInds] == min(self.starVisits[sInds])) \
& (self.starVisits[sInds] < self.nVisitsMax))# Checks that no star has exceeded the number of revisits
if self.starRevisit.size != 0:#There is at least one revisit planned in starRevisit
dt_rev = self.starRevisit[:,1]*u.day - tmpCurrentTimeNorm#absolute temporal spacing between revisit and now.

#return indices of all revisits within a threshold dt_max of revisit day and indices of all revisits with no detections past the revisit time
ind_rev = [int(x) for x in self.starRevisit[np.abs(dt_rev) < self.dt_max, 0] if (x in sInds and self.no_dets[int(x)] == False)]
ind_rev2 = [int(x) for x in self.starRevisit[dt_rev < 0*u.d, 0] if (x in sInds and self.no_dets[int(x)] == True)]
tovisit[ind_rev] = (self.starVisits[ind_rev] < self.nVisitsMax)#IF duplicates exist in ind_rev, the second occurence takes priority
tovisit[ind_rev2] = (self.starVisits[ind_rev2] < self.nVisitsMax)
sInds = np.where(tovisit)[0]

return sInds

def scheduleRevisit(self, sInd, smin, det, pInds):
"""A Helper Method for scheduling revisits after observation detection
Args:
sInd - sInd of the star just detected
smin - minimum separation of the planet to star of planet just detected
det -
pInds - Indices of planets around target star
Return:
updates self.starRevisit attribute
"""
TK = self.TimeKeeping
TL = self.TargetList
SU = self.SimulatedUniverse
# in both cases (detection or false alarm), schedule a revisit
# based on minimum separation
Ms = TL.MsTrue[sInd]
if smin is not None and smin is not np.nan: #smin is None if no planet was detected
sp = smin
if np.any(det):
pInd_smin = pInds[det][np.argmin(SU.s[pInds[det]])]
Mp = SU.Mp[pInd_smin]
else:
Mp = SU.Mp.mean()
mu = const.G*(Mp + Ms)
T = 2.*np.pi*np.sqrt(sp**3/mu)
t_rev = TK.currentTimeNorm + T/2.
# otherwise, revisit based on average of population semi-major axis and mass
else:
sp = SU.s.mean()
Mp = SU.Mp.mean()
mu = const.G*(Mp + Ms)
T = 2.*np.pi*np.sqrt(sp**3/mu)
t_rev = TK.currentTimeNorm + 0.75*T
# if no detections then schedule revisit based off of revisit_weight
if not np.any(det):
t_rev = TK.currentTimeNorm + self.revisit_wait
self.no_dets[sInd] = True
else:
self.no_dets[sInd] = False

# finally, populate the revisit list (NOTE: sInd becomes a float)
revisit = np.array([sInd, t_rev.to('day').value])
if self.starRevisit.size == 0:#If starRevisit has nothing in it
self.starRevisit = np.array([revisit])#initialize sterRevisit
else:
revInd = np.where(self.starRevisit[:,0] == sInd)[0]#indices of the first column of the starRevisit list containing sInd
if revInd.size == 0:
self.starRevisit = np.vstack((self.starRevisit, revisit))
else:
self.starRevisit[revInd,1] = revisit[1]#over

Loading

0 comments on commit f79a025

Please sign in to comment.