def temp_monthly(): prev_year = dt.date(2017, 8, 23) - dt.timedelta(days=365) results = session.query(Measurement.tobs).\ filter(Measurement.station == 'USC00519281').\ filter(Measurement.date >= prev_year).all() temps = list(np.unravel(results)) return jsonify(temps=temps)
def stations: session = Session(engine) q = session.query(Station.name) session.close() stations = list(np.unravel(q)) return jsonify(stations)
def two_profile_fitting(self, img, peaks, n1, n2): xy1 = self.peaks.peaks[n1].getDetxy() xy2 = self.peaks.peaks[n2].getDetxy() dxy = np.subtract(xy1, xy2) sub0 = self.getZoomIm(xy1, n1, n2) sub1 = self.getZoomIm(xy2, n1, n2) j1 = np.argmax(sub0) j2 = np.argmax(sub1) j1ind = np.unravel_index(j1, self.imArray.shape) j2ind = np.unravel_index(j2, self.imArray.shape) xy1 = xy1 + j1ind - [2, 2] xy2 = xy2 + j2ind - [2, 2] # recenter one more time sub0 = self.getZoomIm(xy1, n1, n2) sub1 = self.getZoomIm(xy2, n1, n2) j1 = np.argmax(sub0) j2 = np.argmax(sub1) j1ind = np.unravel(j1, self.imArray.shape) j2ind = np.unravel(j2, self.imArray.shape) xy1 = xy1 + j1ind - [2, 2] xy2 = xy2 + j2ind - [2, 2] self.peaks.peaks[n1].setDetxy(xy1) self.peaks.peaks[n2].setDetxy(xy2) dx2 = np.subtract(xy1, xy2) middle = (xy1 + xy2) / 2. d = xy1 - middle d = sqrt(d[0]**2 + d[1]**2) xr1 = xy1 - middle xr2 = xy2 - middle pic = self.getZoomIm(middle, [d, d]) #### #### # needs testing.... # and then deployment aaa = self.two2DGaussians(pic, xr1, xr2)