Skip to content

Commit

Permalink
merging with master after fixing issue230
Browse files Browse the repository at this point in the history
  • Loading branch information
gjsoto committed Jun 9, 2019
2 parents 203fab5 + 14e5581 commit a998243
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 13 deletions.
15 changes: 9 additions & 6 deletions EXOSIMS/Prototypes/SurveySimulation.py
Original file line number Diff line number Diff line change
Expand Up @@ -568,7 +568,9 @@ def next_target(self, old_sInd, mode):
# allocate settling time + overhead time
tmpCurrentTimeAbs = TK.currentTimeAbs.copy() + Obs.settlingTime + mode['syst']['ohTime']
tmpCurrentTimeNorm = TK.currentTimeNorm.copy() + Obs.settlingTime + mode['syst']['ohTime']


#create appropriate koMap
koMap = self.koMaps[mode['syst']['name']]

# look for available targets
# 1. initialize arrays
Expand Down Expand Up @@ -597,10 +599,12 @@ def next_target(self, old_sInd, mode):

# 2.5 Filter stars not observable at startTimes
try:
koTimeInd = np.where(np.round(startTimes[0].value)-self.koTimes.value==0)[0][0] # find indice where koTime is startTime[0]
#wherever koMap is 1, the target is observable
koMap = self.koMaps[mode['syst']['name']]
sInds = sInds[np.where(np.transpose(koMap)[koTimeInd].astype(bool)[sInds])[0]]# filters inds by koMap #verified against v1.35
tmpIndsbool = list()
for i in np.arange(len(sInds)):
koTimeInd = np.where(np.round(startTimes[sInds[i]].value)-self.koTimes.value==0)[0][0] # find indice where koTime is startTime[0]
tmpIndsbool.append(koMap[sInds[i]][koTimeInd].astype(bool)) #Is star observable at time ind
sInds = sInds[tmpIndsbool]
del tmpIndsbool
except:#If there are no target stars to observe
sInds = np.asarray([],dtype=int)

Expand Down Expand Up @@ -631,7 +635,6 @@ def next_target(self, old_sInd, mode):
if len(sInds.tolist()) > 0 and Obs.checkKeepoutEnd:
try: # endTimes may exist past koTimes so we have an exception to hand this case
tmpIndsbool = list()
koMap = self.koMaps[mode['syst']['name']]
for i in np.arange(len(sInds)):
koTimeInd = np.where(np.round(endTimes[sInds[i]].value)-self.koTimes.value==0)[0][0] # find indice where koTime is endTime[0]
tmpIndsbool.append(koMap[sInds[i]][koTimeInd].astype(bool)) #Is star observable at time ind
Expand Down
26 changes: 19 additions & 7 deletions EXOSIMS/SurveySimulation/linearJScheduler.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,9 @@ def next_target(self, old_sInd, mode):
# create DRM
DRM = {}

#create appropriate koMap
koMap = self.koMaps[mode['syst']['name']]

# allocate settling time + overhead time
tmpCurrentTimeAbs = TK.currentTimeAbs.copy() + Obs.settlingTime + mode['syst']['ohTime']
tmpCurrentTimeNorm = TK.currentTimeNorm.copy() + Obs.settlingTime + mode['syst']['ohTime']
Expand Down Expand Up @@ -114,10 +117,14 @@ def next_target(self, old_sInd, mode):

# 2.5 Filter stars not observable at startTimes
try:
koTimeInd = np.where(np.round(startTimes[0].value)-self.koTimes.value==0)[0][0] # find indice where koTime is startTime[0]
#wherever koMap is 1, the target is observable
koMap = self.koMaps[mode['syst']['name']]
sInds = sInds[np.where(np.transpose(koMap)[koTimeInd].astype(bool)[sInds])[0]]# filters inds by koMap #verified against v1.35
tmpIndsbool = list()
for i in np.arange(len(sInds)):
koTimeInd = np.where(np.round(startTimes[sInds[i]].value)-self.koTimes.value==0)[0][0] # find indice where koTime is startTime[0]
tmpIndsbool.append(koMap[sInds[i]][koTimeInd].astype(bool)) #Is star observable at time ind
sInds = sInds[tmpIndsbool]
del tmpIndsbool
#DELETE koTimeInd = np.where(np.round(startTimes[0].value)-self.koTimes.value==0)[0][0] # find indice where koTime is startTime[0]
#DELETE sInds = sInds[np.where(np.transpose(self.koMap)[koTimeInd].astype(bool)[sInds])[0]]# filters inds by koMap #verified against v1.35
except:#If there are no target stars to observe
sInds = np.asarray([],dtype=int)

Expand Down Expand Up @@ -147,9 +154,14 @@ def next_target(self, old_sInd, mode):
# and filter out unavailable targets
if len(sInds.tolist()) > 0 and Obs.checkKeepoutEnd:
try: # endTimes may exist past koTimes so we have an exception to hand this case
koMap = self.koMaps[mode['syst']['name']]
koTimeInd = np.where(np.round(endTimes[0].value)-self.koTimes.value==0)[0][0]#koTimeInd[0][0] # find indice where koTime is endTime[0]
sInds = sInds[np.where(np.transpose(koMap)[koTimeInd].astype(bool)[sInds])[0]]# filters inds by koMap #verified against v1.35
tmpIndsbool = list()
for i in np.arange(len(sInds)):
koTimeInd = np.where(np.round(endTimes[sInds[i]].value)-self.koTimes.value==0)[0][0] # find indice where koTime is endTime[0]
tmpIndsbool.append(koMap[sInds[i]][koTimeInd].astype(bool)) #Is star observable at time ind
sInds = sInds[tmpIndsbool]
del tmpIndsbool
#DELETE koTimeInd = np.where(np.round(endTimes[0].value)-self.koTimes.value==0)[0][0]#koTimeInd[0][0] # find indice where koTime is endTime[0]
#DELETE sInds = sInds[np.where(np.transpose(self.koMap)[koTimeInd].astype(bool)[sInds])[0]]# filters inds by koMap #verified against v1.35
except:
sInds = np.asarray([],dtype=int)

Expand Down

0 comments on commit a998243

Please sign in to comment.