ASCAT make two scans one to the left and one to the right of the
    sub-satellite track.
352903
def ascat(scan_nb, scan_points=None):
    

    if scan_points is None:
        scan_len = 42  # samples per scan
        scan_points = np.arange(42)
    else:
        scan_len = len(scan_points)

    scan_angle_inner = -25.0  # swath, degrees
    scan_angle_outer = -53.0  # swath, degrees
    scan_rate = 3.74747474747  # single scan, seconds
    if scan_len < 2:
        raise ValueError("Need at least two scan points!")

    sampling_interval = scan_rate / float(np.max(scan_points) + 1)

    # build the Metop/ascat instrument scan line angles
    scanline_angles_one = np.linspace(-np.deg2rad(scan_angle_outer),
                                      -np.deg2rad(scan_angle_inner), 21)
    scanline_angles_two = np.linspace(np.deg2rad(scan_angle_inner),
                                      np.deg2rad(scan_angle_outer), 21)

    scan_angles = np.concatenate(
        [scanline_angles_one, scanline_angles_two])[scan_points]

    inst = np.vstack((scan_angles, np.zeros(scan_len * 1,)))
    inst = np.tile(inst[:, np.newaxis, :], [1, np.int(scan_nb), 1])

    # building the corresponding times array
    offset = np.arange(scan_nb) * scan_rate

    times = (np.tile(scan_points * sampling_interval,
                     [np.int(scan_nb), 1]) + np.expand_dims(offset, 1))

    return ScanGeometry(inst, times)
873137
def _randomize_direction(base_heading, sigma) -> int:
        
        val = MissionWeather._gauss(base_heading, sigma)
        val = MissionWeather._normalize_direction(val)
        return val
831664
def gps_bearing(lat1, lon1, lat2, lon2):
    ''''''
    lat1 = math.radians(lat1)
    lat2 = math.radians(lat2)
    lon1 = math.radians(lon1)
    lon2 = math.radians(lon2)
    dLat = lat2 - lat1
    dLon = lon2 - lon1
    y = math.sin(dLon) * math.cos(lat2)
    x = math.cos(lat1)*math.sin(lat2) - math.sin(lat1)*math.cos(lat2)*math.cos(dLon)
    bearing = math.degrees(math.atan2(y, x))
    if bearing < 0:
        bearing += 360.0
    return bearing
245812
function detectIntersection(a, b) {
  if (a instanceof Sphere) {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return sphereCollisionDetection.sphereVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return sphereCollisionDetection.sphereVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return sphereCollisionDetection.sphereVsObb(a, b);
    } else {
      return sphereCollisionDetection.sphereVsPoint(a, b);
    }
  } else if (a instanceof Aabb) {
    if (b instanceof Sphere) {
      return aabbCollisionDetection.aabbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return aabbCollisionDetection.aabbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return aabbCollisionDetection.aabbVsObb(a, b);
    } else {
      return aabbCollisionDetection.aabbVsPoint(a, b);
    }
  } else if (a instanceof Capsule) {
    if (b instanceof Sphere) {
      return capsuleCollisionDetection.capsuleVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return capsuleCollisionDetection.capsuleVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return capsuleCollisionDetection.capsuleVsObb(a, b);
    } else {
      return capsuleCollisionDetection.capsuleVsPoint(a, b);
    }
  } else if (a instanceof Obb) {
    if (b instanceof Sphere) {
      return obbCollisionDetection.obbVsSphere(a, b);
    } else if (b instanceof Aabb) {
      return obbCollisionDetection.obbVsAabb(a, b);
    } else if (b instanceof Capsule) {
      return obbCollisionDetection.obbVsCapsule(a, b);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsObb(a, b);
    } else {
      return obbCollisionDetection.obbVsPoint(a, b);
    }
  } else {
    if (b instanceof Sphere) {
      return sphereCollisionDetection.sphereVsPoint(b, a);
    } else if (b instanceof Aabb) {
      return aabbCollisionDetection.aabbVsPoint(b, a);
    } else if (b instanceof Capsule) {
      return capsuleCollisionDetection.capsuleVsPoint(b, a);
    } else if (b instanceof Obb) {
      return obbCollisionDetection.obbVsPoint(b, a);
    } else {
      return false;
    }
  }
}
198068
private void cancelScan() {
        if (rescanIncompleteTask != null) {
            rescanIncompleteTask.cancel(true);
            rescanIncompleteTask = null;
        }
        if (rescanUndeployTask != null) {
            rescanUndeployTask.cancel(true);
            rescanUndeployTask = null;
        }
        if (scanTask != null) {
            scanTask.cancel(true);
            scanTask = null;
        }
    }
883061
function Satcat( options ) {

  if( !(this instanceof Satcat) )
    return new Satcat( options )

  options = options || {}
  options.encoding = null
  options.readableObjectMode = true

  this._stringBuffer = ''

  Stream.Transform.call( this, options )

}
315089
public void seekBySpan(String direction, String seekAmount, String span) {
    if(span.startsWith(SEEK_PREFIX)) span = span.substring(3);
    int seekAmountInt = Integer.parseInt(seekAmount);
    assert(direction.equals(DIR_LEFT) || direction.equals(DIR_RIGHT));
    assert(span.equals(DAY) || span.equals(WEEK) || span.equals(MONTH) || 
        span.equals(YEAR) || span.equals(HOUR) || span.equals(MINUTE) || 
        span.equals(SECOND));
    
    boolean isDateSeek = span.equals(DAY) || span.equals(WEEK) || 
      span.equals(MONTH) || span.equals(YEAR);

    if(isDateSeek) {
      markDateInvocation();
    }
    else {
      markTimeInvocation(null);
    }
    
    int sign = direction.equals(DIR_RIGHT) ? 1 : -1;
    int field = 
      span.equals(DAY) ? Calendar.DAY_OF_YEAR : 
      span.equals(WEEK) ? Calendar.WEEK_OF_YEAR :
      span.equals(MONTH) ? Calendar.MONTH :
      span.equals(YEAR) ? Calendar.YEAR : 
      span.equals(HOUR) ? Calendar.HOUR: 
      span.equals(MINUTE) ? Calendar.MINUTE: 
      span.equals(SECOND) ? Calendar.SECOND:
      null;
    if(field > 0) _calendar.add(field, seekAmountInt * sign);
  }
1253441
def calcdelay(self, ant1, ant2, skyfreq, pol):
        

        select = self.select[n.where( (self.skyfreq[self.select] == skyfreq) & (self.polarization[self.select] == pol) )[0]]

        ind1 = n.where(ant1 == self.antnum[select])
        ind2 = n.where(ant2 == self.antnum[select])
        d1 = self.delay[select][ind1]
        d2 = self.delay[select][ind2]
        if len(d1-d2) > 0:
            return d1-d2
        else:
            return n.array([0])
455560
static boolean left(int[] verts, int a, int b, int c) {
        return area2(verts, a, b, c) < 0;
    }
677898
def parseScan(self, scan):
        
        setupScan = True
        foundCharge = False
        foundMass = False
        foundTitle = False
        scanObj = ScanObject()
        scanObj.ms_level = 2
        for row in scan.split('\n'):
            if not row:
                continue
            entry = row.strip().split('=')
            if len(entry) >= 2:
                if entry[0] == 'PEPMASS':
                    scanObj.mass = float(entry[1])
                    foundMass = True
                elif entry[0] == 'CHARGE':
                    scanObj.charge = entry[1]
                    foundCharge = True
                elif entry[0] == 'TITLE':
#                    if self.titleMap:
#                        pos = entry[1].find(',')
#                        title = self.titleMap[int(entry[1][:entry[1].find(',')])]
#                    else:
                    title = '='.join(entry[1:])
                    foundTitle = True
                    scanObj.title = title
                    scanObj.id = title
                elif entry[0] == 'RTINSECONDS':
                    scanObj.rt = float(entry[1])
            else:
                mz,intensity = self.scanSplit.split(row.strip())
                scanObj.scans.append((float(mz),float(intensity)))
        if foundCharge and foundMass and foundTitle:
            return scanObj
        return None
1071743
public static <T1, T2> Pattern2<T1, T2> and(/* this */Observable<T1> left, Observable<T2> right) {
        if (left == null) {
            throw new NullPointerException("left");
        }
        if (right == null) {
            throw new NullPointerException("right");
        }
        return new Pattern2<T1, T2>(left, right);
    }
773420
private static double deltaLat(double deltaPixel, double lat, byte zoom, int tileSize) {
        long mapSize = MercatorProjection.getMapSize(zoom, tileSize);
        double pixelY = MercatorProjection.latitudeToPixelY(lat, mapSize);
        double lat2 = MercatorProjection.pixelYToLatitude(pixelY + deltaPixel, mapSize);

        return Math.abs(lat2 - lat);
    }
186859
def merge(ds, measurement, cardinality)

      m = ds.select {|k,v| k != :measurements and k != :errors and k != :warn }
      m = m.merge(measurement)
      m = m.merge ({ technology: "argos",
        type: type,
        cardinality: cardinality
        #file: "file://"+filename,
        #source: sha1
      })

      # if not ds[:errors].nil? and ds[:errors].any?
      #   m[:errors] = ds[:errors].clone
      # end
      #
      # if not ds[:warn].nil? and ds[:warn].any?
      #   m[:warn] = ds[:warn].clone
      # end
      #
      # if not m[:sensor_data].nil? and m[:sensor_data].size != ds[:sensors]
      #   if m[:warn].nil?
      #     m[:warn] = []
      #   end
      #   m[:warn] << "sensors-count-mismatch"
      # end

      # Create id as SHA1 hash of measurement minus stuff that may vary (like filename)
      #
      # Possible improvement for is to base id on a static list of keys
      # :program,
      # :platform,
      # :lines,
      # :sensors,
      # :satellite,
      # :lc,
      # :positioned,
      # :latitude,
      # :longitude,
      # :altitude,
      # :headers,
      # :measured,
      # :identical,
      # :sensor_data,
      # :technology,
      # :type,
      # :source

      idbase = m.clone
      idbase.delete :errors
      idbase.delete :file
      idbase.delete :warn

      id = Digest::SHA1.hexdigest(idbase.to_json)

      #m[:parser] = Argos.library_version
      m[:id] = id

      #m[:bundle] = bundle
      m
    end
967784
def move_right(self):
        """"""
        self.at(ardrone.at.pcmd, True, self.speed, 0, 0, 0)
197173
def backsub_both_sides(L, X, transpose='left'):
    
    if transpose == 'left':
        tmp, _ = dtrtrs(L, X, lower=1, trans=1)
        return dtrtrs(L, tmp.T, lower=1, trans=1)[0].T
    else:
        tmp, _ = dtrtrs(L, X, lower=1, trans=0)
        return dtrtrs(L, tmp.T, lower=1, trans=0)[0].T
123836
def toggle_scan(self, enable, filter_duplicates=False):
        """"""
        command = struct.pack(">BB", enable, filter_duplicates)
        self.bluez.hci_send_cmd(self.socket, OGF_LE_CTL, OCF_LE_SET_SCAN_ENABLE, command)
129721
def left(self, speed=1):
        
        self.right_motor.forward(speed)
        self.left_motor.backward(speed)