Interpolates the celestial pole offset value of x in seconds of arc.

@return float|boolean Returns false on error.
514145
public function x()
    {
        // Load file
        $file = new \SplFileObject($this->storage('finals.all'));

        // Get instance MJD, and MJD at line 0
        $mjdQ = $this->mjd;
        $mjd0 = (int)substr($file->getCurrentLine(), 7, 8);

        // Check for requested MJD before first date
        if ($mjdQ < $mjd0) {
            return false;
        }

        // Determine nearest center pointer
        $p = $mjdQ - $mjd0 - 1;

        // Fix for values within |n| of lower bound
        if ($p < static::INTERP_C && $p > -static::INTERP_C) {
            $p = static::INTERP_C;
        }

        // Compile dataset
        $ds = [];
        for ($i = $p - static::INTERP_C; $i < $p + static::INTERP_C; $i++) {
            $file->seek($i);
            $line = $file->getCurrentLine();

            // Parse data from line
            $mjd = substr($line, 7, 8);
            $xf  = substr($line, 136, 9);
            $xp  = substr($line, 18, 9);

            // Use final value first, if not present use prediction
            $x = trim($xf) ? $xf : $xp;

            // Check if no dut1 data, error
            if (trim($x) == '') {
                return false;
            }

            // Add the data
            $ds[$i - $p + static::INTERP_C]['x'] = (float)$mjd;
            $ds[$i - $p + static::INTERP_C]['y'] = (float)$x;
        }

        // Interpolate pole x
        return $this->lagrangeInterp($mjdQ, $ds);
    }
1034602
public function getLongitude() : ?float 
    {
        if ( ! $this->hasLongitude()) {
            $this->setLongitude($this->getDefaultLongitude());
        }
        return $this->longitude;
    }
1259062
def _calc(cls, **kwargs):
        
        zenith = 90.833333 # offical value

        jd = kwargs.get("jd", None)
        lat = kwargs.get("lat", None)
        lon = kwargs.get("lon", None)
        stage = kwargs.get("stage", None)
        if jd is None or stage is None or lat is None or lon is None:
            raise ValueError("Must supply an 'jd', 'lat, 'lon', and 'stage' parameter")

        if stage != SunCycles.RISING and stage != SunCycles.SETTING:
            raise ValueError("'stage' parameter must be %s or %s" % (SunCycles.RISING, SunCycles.SETTING))

        longhr = lon / 15.
        if stage == SunCycles.RISING:
            apx = jd + ( (6 - longhr) / 24 )
        elif stage == SunCycles.SETTING:
            apx = jd + ( (18 - longhr) / 24 )

        sun_mean_anom = ( 0.9856 * apx ) - 3.289 # sun's mean anomaly
        #sun's longitude
        sun_lon = sun_mean_anom + (1.916 * np.sin( np.radians(sun_mean_anom) )) \
                + (0.02 * np.sin( np.radians(2 * sun_mean_anom) )) + 282.634

        if sun_lon > 360:
            sun_lon = sun_lon - 360
        elif sun_lon < 0:
            sun_lon = sun_lon + 360

        right_ascension = np.degrees(np.arctan( 0.91764 * np.tan( np.radians(sun_lon) ) )) # sun's right ascension

        if right_ascension > 360:
            right_ascension = right_ascension - 360
        elif right_ascension < 0:
            right_ascension = right_ascension + 360

        # put sun's right ascension value in the same quadrant as the sun's
        # true longitude
        lQuad = 90. * np.floor(sun_lon / 90.)
        raQuad = 90. * np.floor(right_ascension / 90.)
        right_ascension = right_ascension + ( lQuad - raQuad)
        right_ascension = right_ascension / 15. # Convert to hours

        # Sun's declination
        sinDecl = 0.39782 * np.sin( np.radians(sun_lon) )
        cosDecl = np.cos( np.arcsin( sinDecl ) )

        # Sun's local hour angle
        cosHr = (np.cos( np.radians(zenith) ) - ( sinDecl * np.sin(np.radians(lat)) )) \
                / ( cosDecl * np.cos( np.radians(lat) ) )

        if cosHr > 1: # Sun doesnt rise on this loc on this date
            return -1, -1
        elif cosHr < -1: # Sun doesnt set on this location on this date
            return -1, -1
        elif stage == SunCycles.RISING: # Sunrise
            hr = 360 - np.degrees(np.arccos(cosHr))
        elif stage == SunCycles.SETTING:  # Sunset
            hr = np.degrees(np.arccos(cosHr))

        hr = hr / 15. # Convert angle to hours

        localTime = hr + right_ascension - ( 0.06571 * apx ) - 6.622# local meantime of rise/set

        UTtime = localTime - longhr # adjust to UTC

        if UTtime < 0:
            UTtime = UTtime + 24
        elif UTtime > 24:
            UTtime = UTtime - 24

        hour = np.floor(UTtime)

        minute = (UTtime - hour) * 60
        if minute == 60:
            hour = hour + 1
            minute = 0

        return hour, minute
141626
public function getX() : ?float 
    {
        if ( ! $this->hasX()) {
            $this->setX($this->getDefaultX());
        }
        return $this->x;
    }
1258590
function() {
		var yOffset = _panOffset.y - self.currItem.initialPosition.y; // difference between initial and current position
		return 1 -  Math.abs( yOffset / (_viewportSize.y / 2)  );
	}
152082
public function getAspectRatio(): float
    {
        $attrs = $this->getXmlAttrs();

        if (!isset($attrs->viewBox)) {
            return 0;
        }

        list(, , $width, $height) = explode(' ', $attrs->viewBox);

        return $width / $height;
    }
965192
public function getPosition()
    {
        if ($this->realPos === -1) {
            $this->realPos = ($this->outer->executable === null ? 0 : 1);
            for ($i = 0; $i < $this->position; $i++) {
                $arg = $this->outer->arguments[$i];
                $this->realPos += count($arg->getParts());
            }
        }

        return $this->realPos;
    }
180082
def interpolate(self):
        
        self.latitude = self._interp(self.lat_tiepoint)
        self.longitude = self._interp(self.lon_tiepoint)

        return self.latitude, self.longitude
1011170
public function initialBearing()
    {
        Ellipsoid::checkCoordinatesEllipsoid($this->from, $this->to);

        $latA = deg2rad($this->from->getLatitude());
        $latB = deg2rad($this->to->getLatitude());
        $dLng = deg2rad($this->to->getLongitude() - $this->from->getLongitude());

        $y = sin($dLng) * cos($latB);
        $x = cos($latA) * sin($latB) - sin($latA) * cos($latB) * cos($dLng);

        return (float) (rad2deg(atan2($y, $x)) + 360) % 360;
    }
649783
public function getOffsetFromGmt($hours = false)
    {
        return (float) $hours ? ($this->tz->getOffset($this) / 3600) : $this->tz->getOffset($this);
    }
420232
public function leapSec()
    {
        // Load data file
        $file = new \SplFileObject($this->storage('tai-utc.dat'));

        $taiUTC = 0;
        while ($file->valid()) {
            $line = $file->getCurrentLine();

            // Check for empty line
            if (trim($line) == '') {
                break;
            }

            // Get JD and leap seconds as of that JD
            $jd = (float)substr($line, 17, 9);

            // If the leap second JD exceeds or is = to this instance, break
            if ($jd > $this->jd) {
                break;
            }

            // Within range, use current leap seconds
            $taiUTC = (float)substr($line, 38, 10);
        }

        // Return leap seconds
        return $taiUTC;
    }
766261
def get_interp_val(m, theta, phi, nest=False, lonlat=False):
    
    lon, lat = _healpy_to_lonlat(theta, phi, lonlat=lonlat)
    return interpolate_bilinear_lonlat(lon, lat, m, order='nested' if nest else 'ring')
364993
def interpolate(self, date, method=None, order=None):
        

        if not self.start <= date <= self.stop:
            raise ValueError("Date '%s' not in range" % date)

        prev_idx = 0
        ephem = self

        # Binary search of the orbit step just before the desired date
        while True:
            idx = len(ephem)
            if idx == 1:
                break
            k = idx // 2

            if date > ephem[k].date:
                prev_idx += k
                ephem = ephem[k:]
            else:
                ephem = ephem[:k]

        method = method if method is not None else self.method
        order = order if order is not None else self.order

        if method == self.LINEAR:

            y0 = self[prev_idx]
            y1 = self[prev_idx + 1]

            result = y0[:] + (y1[:] - y0[:]) * (date.mjd - y0.date.mjd) / (y1.date.mjd - y0.date.mjd)

        elif method == self.LAGRANGE:

            stop = prev_idx + 1 + order // 2 + order % 2
            start = prev_idx - order // 2 + 1
            if stop >= len(self):
                start -= stop - len(self)
            elif start < 0:
                stop -= start
                start = 0

            # selection of the subset of data, of length 'order' around the desired value
            subset = self[start:stop]
            date_subset = np.array([x.date.mjd for x in subset])

            result = np.zeros(6)

            # Everything is on wikipedia
            #        k
            # L(x) = Σ y_j * l_j(x)
            #        j=0
            #
            # l_j(x) = Π (x - x_m) / (x_j - x_m)
            #     0 <= m <= k
            #        m != j
            for j in range(order):
                # This mask is here to enforce the m != j in the lagrange polynomials
                mask = date_subset != date_subset[j]
                l_j = (date.mjd - date_subset[mask]) / (date_subset[j] - date_subset[mask])
                result = result + l_j.prod() * subset[j]

        else:
            raise ValueError("Unkown interpolation method", method)

        orb = ephem[0]

        return orb.__class__(date, result, orb.form, orb.frame, orb.propagator)
1277589
public function sec(int $scale = null): Decimal
    {
        $cos = $this->cos($scale + 2);
        if ($cos->isZero()) {
            throw new \DomainException(
                "The secant of this 'angle' is undefined."
            );
        }

        return DecimalConstants::one()->div($cos)->round($scale);
    }
1054374
public function interpolate( $tolerance )
	{
		$a	= $this->interval->getStart();
		$b	= $this->interval->getEnd();
		$c	= false;
		while( true )
		{
			$ya	= $this->formula->getValue( $a );
			$yb	= $this->formula->getValue( $b );

			if( $ya * $yb > 0 )
				throw new RuntimeException( 'Formula has no null in Interval['.$a.','.$b.'].' );

			$c	= ( $a + $b ) / 2;

			if( $b - $a <= $tolerance )
				return $c;
			$yc	= $this->formula->getValue( $c );

			if( $ya * $yc <=0 )
				$b	= $c;
			else
				$a	= $c;
		}
		return $c;
	}
509517
private static int interpolate(
        double y_minus, // = f(-1)
        double y_0, // = f(0)
        double y_plus, // = f(+1)
        double[] result // xe, ye, root1, root2
    ) {

        double a = 0.5 * (y_plus + y_minus) - y_0;
        double b = 0.5 * (y_plus - y_minus);

        double xe = -b / (2.0 * a);
        double ye = (a * xe + b) * xe + y_0;
        double dis = b * b - 4 * a * y_0;

        double root1 = Double.NaN;
        double root2 = Double.NaN;
        int count = 0;

        if (dis >= 0) {
            double dx = 0.5 * Math.sqrt(dis) / Math.abs(a);
            if (Math.abs(xe - dx) <= 1.0) {
                root1 = xe - dx;
                count++;
            }
            if (Math.abs(xe + dx) <= 1.0) {
                root2 = xe + dx;
                count++;
            }
        }

        result[0] = xe;
        result[1] = ye;
        result[2] = root1;
        result[3] = root2;

        return count;

    }
198019
double interpolateAngle(int index0, int index1, int index2, double offset) {
		double angle1 = Math.atan2(histogramY[index1],histogramX[index1]);
		double deltaAngle;
		if( offset < 0 ) {
			double angle0 = Math.atan2(histogramY[index0],histogramX[index0]);
			deltaAngle = UtilAngle.dist(angle0,angle1);

		} else {
			double angle2 = Math.atan2(histogramY[index2], histogramX[index2]);
			deltaAngle = UtilAngle.dist(angle2,angle1);
		}
		return UtilAngle.bound(angle1 + deltaAngle*offset);
	}