Skip to content

Commit

Permalink
Ignore negative redshifts while selecting highest crosscorr peak.
Browse files Browse the repository at this point in the history
Remove "Done!" box when finished
  • Loading branch information
daniel-muthukrishna committed Sep 14, 2018
1 parent 7228130 commit 5b363ff
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions astrodash/calculate_redshift.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ def cross_correlation(inputFlux, tempFlux, nw, tempMinMaxIndex):


def calc_redshift_from_crosscorr(crossCorr, nw, dwlog):
deltaPeak = np.argmax(crossCorr)
# Find max peak while ignoring peaks that lead to negative redshifts
deltaPeak = np.argmax(crossCorr[:int(nw/2)+1])

# z = np.exp(deltaPeak * dwlog) - 1 #equation 13 of Blondin)
zAxisIndex = np.concatenate((np.arange(-nw / 2, 0), np.arange(0, nw / 2)))
if deltaPeak < nw / 2:
if deltaPeak <= nw / 2:
z = (np.exp(abs(zAxisIndex) * dwlog) - 1)[deltaPeak]
else:
z = -(np.exp(abs(zAxisIndex) * dwlog) - 1)[deltaPeak]
Expand Down
2 changes: 1 addition & 1 deletion astrodash/gui_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def done_fit_thread_single_redshift(self):
self.set_plot_redshift(self.bestRedshift)
self.plot_cross_corr()
self.progressBar.setValue(100)
QtGui.QMessageBox.information(self, "Done!", "Finished Fitting Input Spectrum")
# QtGui.QMessageBox.information(self, "Done!", "Finished Fitting Input Spectrum")

def best_broad_type(self):
bestMatchList = []
Expand Down
2 changes: 1 addition & 1 deletion astrodash/read_from_catalog.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ def read_json(url):
if data.shape[0] == 3:
wave, flux, fluxerr = data
elif data.shape[0] == 2:
wave, flux, fluxerr = data
wave, flux = data
else:
raise Exception("Error reading the given OSC input: {}. Check data at {}".format(filename, urlSpectrum))

Expand Down

0 comments on commit 5b363ff

Please sign in to comment.