repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/camera.py | import math
import numpy as np
from collections import namedtuple
import pybullet as p
from pybullet_planning.utils import CLIENT
CameraInfo = namedtuple('CameraInfo', ['width', 'height', 'viewMatrix', 'projectionMatrix', 'cameraUp', 'cameraForward',
'horizontal', 'vertical', 'y... | 6,574 | 44.979021 | 121 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/pointcloud.py |
def read_pcd_file(path):
"""
Reads a *.pcd pointcloud file
:param path: path to the *.pcd pointcloud file
:return: list of points
"""
with open(path) as f:
data = f.readline().split()
num_points = 0
while data[0] != 'DATA':
if data[0] == 'POINTS':
... | 497 | 26.666667 | 83 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/polygon.py | import math
import numpy as np
import pybullet as p
from pybullet_planning.interfaces.env_manager.pose_transformation import Pose, Point, Euler
from pybullet_planning.interfaces.env_manager.pose_transformation import multiply, point_from_pose, \
get_length, invert, get_unit_vector, apply_affine
##################... | 4,871 | 38.609756 | 101 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/bounding_box.py | import numpy as np
from collections import namedtuple
from itertools import product
import pybullet as p
from pybullet_planning.utils import CLIENT, BASE_LINK, UNKNOWN_FILE, OBJ_MESH_CACHE
from pybullet_planning.utils import implies
#####################################
# Bounding box
AABB = namedtuple('AABB', ['lo... | 4,379 | 32.181818 | 143 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/__init__.py | """
********************************************************************************
interfaces.geometry
********************************************************************************
.. currentmodule:: pybullet_planning.interfaces.geometry
TODO: module description
Main Types
--------------
.. autosummary::
:... | 802 | 18.585366 | 80 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/geometry/mesh.py | import os
from collections import defaultdict, namedtuple, deque
from itertools import count
import numpy as np
from pybullet_planning.utils import TEMP_DIR, PI
from pybullet_planning.utils import ensure_dir, write, read, safe_zip
#####################################
# Mesh Files
Mesh = namedtuple('Mesh', ['vertice... | 9,299 | 34.769231 | 93 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/ladder_graph.py | from copy import deepcopy
import numpy as np
class LadderGraphEdge(object):
def __init__(self, idx=None, cost=-np.inf):
self.idx = idx # the id of the destination vert
self.cost = cost
# TODO: we ignore the timing constraint here
def __repr__(self):
return 'E idx{0}, cost{1}'.f... | 9,128 | 35.810484 | 123 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/utils.py | #!/usr/bin/env python3
import functools
from pybullet_planning.interfaces.robots.joint import get_joint_positions, get_joint_velocities, set_joint_positions_and_velocities
from pybullet_planning.interfaces.robots.body import get_pose, get_velocity, set_pose, set_velocity
def preserve_pos_and_vel(func):
@functools... | 1,640 | 40.025 | 131 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/cartesian_motion_planning.py | import os
import warnings
from itertools import tee
from copy import copy
from collections import namedtuple
import numpy as np
import pybullet as p
from pybullet_planning.interfaces.env_manager.pose_transformation import get_distance
from pybullet_planning.utils import MAX_DISTANCE, EPS
from pybullet_planning.interfa... | 10,207 | 40.665306 | 146 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/joint_motion_planning.py | import random
import numpy as np
from itertools import product
from pybullet_planning.utils import CIRCULAR_LIMITS, DEFAULT_RESOLUTION, MAX_DISTANCE
from pybullet_planning.interfaces.env_manager.pose_transformation import circular_difference, get_unit_vector
from pybullet_planning.interfaces.env_manager.user_io impor... | 16,911 | 45.589532 | 168 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/dag_search.py | import warnings
import numpy as np
from .ladder_graph import LadderGraph, EdgeBuilder
class SolutionRung(object):
def __init__(self):
self.distance = []
self.predecessor = []
def extract_min(self):
# min_dist = min(self.distance)
# min_id = self.distance.index(min_dist)
... | 3,561 | 33.582524 | 79 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/nonholonomic_motion_planning.py | import numpy as np
from pybullet_planning.utils import PI, MAX_DISTANCE
from pybullet_planning.motion_planners import birrt
from pybullet_planning.interfaces.robots.collision import get_collision_fn
from pybullet_planning.interfaces.planner_interface.joint_motion_planning import get_distance_fn, get_extend_fn, get_s... | 3,510 | 45.813333 | 145 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/__init__.py | """interfaces to the motion planners
"""
from .cartesian_motion_planning import *
from .joint_motion_planning import *
from .nonholonomic_motion_planning import *
from .SE2_pose_motion_planning import *
__all__ = [name for name in dir() if not name.startswith('_')]
| 269 | 23.545455 | 62 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/interfaces/planner_interface/SE2_pose_motion_planning.py | import numpy as np
from pybullet_planning.utils import MAX_DISTANCE, CIRCULAR_LIMITS
from pybullet_planning.motion_planners import birrt, direct_path
#####################################
# SE(2) pose motion planning
def get_base_difference_fn():
from pybullet_planning.interfaces.env_manager.pose_transformation ... | 2,377 | 36.746032 | 97 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/primitives/grasp_gen.py | import math
import random
import numpy as np
from pybullet_planning.interfaces import Pose, Point, Euler, unit_pose, point_from_pose, multiply, quat_from_euler, invert
from pybullet_planning.interfaces import approximate_as_prism, approximate_as_cylinder
def get_top_grasps(body, under=False):
raise NotImplemente... | 2,827 | 39.985507 | 123 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/primitives/__init__.py | """
********************************************************************************
primitives
********************************************************************************
These modules are transported from `kuka_primitives`, `pr2_primitives` and `pr2_utils` from
`ss-pybullet <https://github.com/caelan/ss-pybulle... | 1,434 | 28.285714 | 95 | py |
real-robot-challenge | real-robot-challenge-main/python/pybullet_planning/primitives/trajectory.py | from pybullet_planning.interfaces import get_relative_pose, get_link_subtree, clone_body, set_static, get_link_pose, \
set_pose, multiply, get_pose, invert
##############################################
class EndEffector(object):
"""a convenient class for creating and manipulating an end effector
Note: t... | 2,065 | 31.793651 | 118 | py |
real-robot-challenge | real-robot-challenge-main/scripts/run_local_episode.py | #!/usr/bin/env python3
"""Run a single episode with our controller.
This script expects the following arguments in the given order:
- Difficulty level (needed for reward computation)
- goal pose of the object (as JSON string) (optional)
"""
import sys
import json
from trifinger_simulation.tasks import move_cube
fro... | 1,782 | 27.758065 | 70 | py |
real-robot-challenge | real-robot-challenge-main/scripts/run_episode.py | #!/usr/bin/env python3
"""Run a single episode with our controller.
This script expects the following arguments in the given order:
- Difficulty level (needed for reward computation)
- goal pose of the object (as JSON string) (optional)
"""
import sys
import json
from trifinger_simulation.tasks import move_cube
fro... | 1,784 | 27.790323 | 70 | py |
real-robot-challenge | real-robot-challenge-main/log_manager/plot_scripts/finger_position.py | #!/usr/bin/env python3
"""Simply script to quickly plot data from a log file."""
import argparse
import pandas
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
import os
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("filename", type=str)
pars... | 1,215 | 29.4 | 77 | py |
real-robot-challenge | real-robot-challenge-main/log_manager/plot_scripts/plot.py | #!/usr/bin/env python3
"""Simply script to quickly plot data from a log file."""
import argparse
import pandas
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
def main():
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("filename", type=str)
parser.add_arg... | 1,036 | 27.805556 | 72 | py |
real-robot-challenge | real-robot-challenge-main/log_manager/replay_scripts/compute_reward.py | #!/usr/bin/env python3
import os
import argparse
import robot_fingers
import numpy as np
from trifinger_simulation.tasks import move_cube
import json
def compute_reward(logdir):
log = robot_fingers.TriFingerPlatformLog(os.path.join(logdir, "robot_data.dat"),
os.path.j... | 1,252 | 32.864865 | 85 | py |
real-robot-challenge | real-robot-challenge-main/log_manager/replay_scripts/replay.py | #!/usr/bin/env python3
import os
import shelve
import argparse
import robot_fingers
import trifinger_simulation
import pybullet as p
import numpy as np
from trifinger_simulation.tasks import move_cube
from trifinger_simulation import camera, visual_objects
import trifinger_object_tracking.py_tricamera_types as tricame... | 17,370 | 36.197002 | 112 | py |
pyparrot | pyparrot-master/setup.py | """
Setup for pyparrot based on the sample one found below:
A setuptools based setup module.
See:
https://packaging.python.org/en/latest/distributing.html
https://github.com/pypa/sampleproject
"""
# Always prefer setuptools over distutils
from setuptools import setup, find_packages
# To use a consistent encoding
from... | 8,264 | 39.514706 | 107 | py |
pyparrot | pyparrot-master/pyparrot/Bebop.py | """
Bebop class holds all of the methods needed to pilot the drone from python and to ask for sensor
data back from the drone
Author: Amy McGovern, dramymcgovern@gmail.com
"""
import time
from pyparrot.networking.wifiConnection import WifiConnection
from pyparrot.utils.colorPrint import color_print
from pyparrot.comma... | 35,230 | 38.989784 | 153 | py |
pyparrot | pyparrot-master/pyparrot/Minidrone.py | """
Mambo class holds all of the methods needed to pilot the drone from python and to ask for sensor
data back from the drone
Author: Amy McGovern, dramymcgovern@gmail.com
Author: Alexander Zach, https://github.com/alex-zach, groundcam support
Author: Valentin Benke, https://github.com/Vabe7, groundcam support
"""
imp... | 31,774 | 37.75 | 149 | py |
pyparrot | pyparrot-master/pyparrot/Anafi.py | """
Anafi class holds all of the methods needed to pilot the drone from python and to ask for sensor
data back from the drone
Author: Amy McGovern, dramymcgovern@gmail.com
"""
import time
from pyparrot.networking.wifiConnection import WifiConnection
from pyparrot.utils.colorPrint import color_print
from pyparrot.comma... | 35,228 | 38.987514 | 153 | py |
pyparrot | pyparrot-master/pyparrot/__init__.py | 0 | 0 | 0 | py | |
pyparrot | pyparrot-master/pyparrot/Model.py | from enum import Enum, auto
class Model(Enum):
BEBOP = auto()
MAMBO = auto()
ANAFI = auto() | 104 | 16.5 | 27 | py |
pyparrot | pyparrot-master/pyparrot/DroneVisionGUI.py | """
DroneVisionGUI is a new class that parallels DroneVision but with several important changes.
1) This module uses VLC instead of FFMPEG
2) This module opens a GUI window to show you the video in real-time (you could
watch it in real-time previously through the VisionServer)
3) Because GUI windows are different on d... | 18,130 | 36.930962 | 145 | py |
pyparrot | pyparrot-master/pyparrot/VisionServer.py | """
This is a simple web server to let the user see the vision that is being processed by ffmpeg. It
essentially replaces the role of VLC. Note that there are several user parameters that should be
set to run this program.
This does not replace the vision process! This is a separate process just to ... | 6,501 | 44.152778 | 115 | py |
pyparrot | pyparrot-master/pyparrot/DroneVision.py | """
DroneVision is separated from the main Mambo/Bebop class to enable the use of the drone without the FPV camera.
If you want to do vision processing, you will need to create a DroneVision object to capture the
video stream.
Note that this module relies on the opencv module and the ffmpeg program
Ffmpeg write the i... | 12,417 | 40.255814 | 132 | py |
pyparrot | pyparrot-master/pyparrot/networking/bleConnection.py | from bluepy.btle import Peripheral, UUID, DefaultDelegate, BTLEException
from pyparrot.utils.colorPrint import color_print
import struct
import time
from pyparrot.commandsandsensors.DroneSensorParser import get_data_format_and_size
from datetime import datetime
class MinidroneDelegate(DefaultDelegate):
"""
Han... | 27,745 | 44.861157 | 140 | py |
pyparrot | pyparrot-master/pyparrot/networking/wifiConnection.py | """
Holds all the data and commands needed to fly a Bebop or Anafi drone.
Author: Amy McGovern, dramymcgovern@gmail.com
"""
from zeroconf import ServiceBrowser, Zeroconf
from datetime import datetime
import time
import socket
import ipaddress
import json
from pyparrot.utils.colorPrint import color_print
import struct... | 29,931 | 39.448649 | 128 | py |
pyparrot | pyparrot-master/pyparrot/networking/__init__.py | 0 | 0 | 0 | py | |
pyparrot | pyparrot-master/pyparrot/scripts/__init__.py | 0 | 0 | 0 | py | |
pyparrot | pyparrot-master/pyparrot/scripts/findMinidrone.py | """
Find the BLE address for a mambo. To run this,
sudo python findMambo.py
Note that the sudo is necessary for BLE permissions on linux. It is only needed on
this program and nothing else.
Author: Amy McGovern
"""
try:
from bluepy.btle import Scanner, DefaultDelegate
BLEAvailable = True
except:
BLEAv... | 1,504 | 29.1 | 92 | py |
pyparrot | pyparrot-master/pyparrot/commandsandsensors/DroneSensorParser.py | """
Sensor parser class: handles the XML parsing and gets the values but the actual data is stored with the drone itself
since it knows what to do with it.
"""
import struct
import untangle
from pyparrot.utils.colorPrint import color_print
import os
from os.path import join
def get_data_format_and_size(data, data_typ... | 8,718 | 41.531707 | 117 | py |
pyparrot | pyparrot-master/pyparrot/commandsandsensors/DroneCommandParser.py | import untangle
import os
from os.path import join
class DroneCommandParser:
def __init__(self):
# store the commandsandsensors as they are called so you don't have to parse each time
self.command_tuple_cache = dict()
# parse the command files from XML (so we don't have to store ids and ca... | 4,452 | 39.481818 | 135 | py |
pyparrot | pyparrot-master/pyparrot/commandsandsensors/__init__.py | 0 | 0 | 0 | py | |
pyparrot | pyparrot-master/pyparrot/utils/colorPrint.py | """Print messages in color"""
def color_print(print_str, type="NONE"):
# Null cases
if not print_str:
print_str = ""
colours = {
"ERROR": "38;5;196m",
"WARN": "38;5;202m",
"SUCCESS": "38;5;22m",
"INFO": "38;5;33m",
}
colour = colours.get(type, "0m")
pri... | 361 | 20.294118 | 47 | py |
pyparrot | pyparrot-master/pyparrot/utils/__init__.py | 0 | 0 | 0 | py | |
pyparrot | pyparrot-master/pyparrot/utils/NonBlockingStreamReader.py | """
A non-blocking stream reader (used to solve the process communciation with ffmpeg)
This code is almost directly from:
http://eyalarubas.com/python-subproc-nonblock.html
Amy McGovern (dramymcgovern@gmail.com) modified to allow the thread to end nicely
and also to not throw an error if the stream ends, since our c... | 1,643 | 27.344828 | 88 | py |
pyparrot | pyparrot-master/pyparrot/utils/vlc.py | #! /usr/bin/python
# -*- coding: utf-8 -*-
# Python ctypes bindings for VLC
#
# Copyright (C) 2009-2017 the VideoLAN team
# $Id: $
#
# Authors: Olivier Aubert <contact at olivieraubert.net>
# Jean Brouwers <MrJean1 at gmail.com>
# Geoff Salmon <geoff.salmon at gmail.com>
#
# This library is free soft... | 359,434 | 41.556832 | 639 | py |
pyparrot | pyparrot-master/examples/demoMamboVisionGUITwoWindows.py | """
Demo of the Mambo vision using DroneVisionGUI that relies on libVLC and shows how to make a
second window using opencv to draw on the processed window. It is a different
multi-threaded approach than DroneVision
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
from pyparrot.DroneVisionGUI import Drone... | 3,268 | 28.990826 | 110 | py |
pyparrot | pyparrot-master/examples/demoMamboVision.py | """
Demo of the ffmpeg based mambo vision code (basically flies around and saves out photos as it flies)
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
from pyparrot.DroneVision import DroneVision
from pyparrot.Model import Model
import threading
import cv2
import time
# set this to true if you want t... | 2,914 | 30.010638 | 102 | py |
pyparrot | pyparrot-master/examples/demoMamboVisionGUI.py | """
Demo of the Bebop vision using DroneVisionGUI that relies on libVLC. It is a different
multi-threaded approach than DroneVision
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
from pyparrot.DroneVisionGUI import DroneVisionGUI
from pyparrot.Model import Model
import cv2
# set this to true if you w... | 3,068 | 30 | 107 | py |
pyparrot | pyparrot-master/examples/demoMamboClaw.py | """
Demo the claw for the python interface
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
# you will need to change this to the address of YOUR mambo
mamboAddr = "e0:14:d0:63:3d:d0"
# make my mambo object
# remember you can't use the claw with the camera installed so this must be BLE connected to wor... | 970 | 21.068182 | 97 | py |
pyparrot | pyparrot-master/examples/demoBebopIndoors.py | """
Demo the Bebop indoors (sets small speeds and then flies just a small amount)
Note, the bebop will hurt your furniture if it hits it. Even though this is a very small
amount of flying, be sure you are doing this in an open area and are prepared to catch!
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
... | 1,176 | 24.586957 | 108 | py |
pyparrot | pyparrot-master/examples/demoMamboTricks.py | """
Demo the trick flying for the python interface
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
# If you are using BLE: you will need to change this to the address of YOUR mambo
# if you are using Wifi, this can be ignored
mamboAddr = "e0:14:d0:63:3d:d0"
# make my mambo object
# remember to set Tru... | 2,055 | 29.686567 | 102 | py |
pyparrot | pyparrot-master/examples/demoBebopVision.py | """
Demo of the Bebop ffmpeg based vision code (basically flies around and saves out photos as it flies)
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
from pyparrot.DroneVision import DroneVision
from pyparrot.Model import Model
import threading
import cv2
import time
isAlive = False
class UserVision:
... | 1,815 | 26.938462 | 100 | py |
pyparrot | pyparrot-master/examples/demoBebopVisionGUI.py | """
Demo of the Bebop vision using DroneVisionGUI (relies on libVLC). It is a different
multi-threaded approach than DroneVision
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
from pyparrot.DroneVisionGUI import DroneVisionGUI
from pyparrot.Model import Model
import threading
import cv2
import time
from Py... | 3,051 | 28.631068 | 117 | py |
pyparrot | pyparrot-master/examples/demoMamboDirectFlight.py | """
Demo the direct flying for the python interface
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
# you will need to change this to the address of YOUR mambo
mamboAddr = "e0:14:d0:63:3d:d0"
# make my mambo object
# remember to set True/False for the wifi depending on if you are using the wifi or the... | 1,773 | 28.566667 | 103 | py |
pyparrot | pyparrot-master/examples/demoBebopTricks.py | """
Demos the tricks on the bebop. Make sure you have enough room to perform them!
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
bebop = Bebop()
print("connecting")
success = bebop.connect(10)
print(success)
print("sleeping")
bebop.smart_sleep(5)
bebop.ask_for_state_update()
bebop.safe_takeoff(10)
p... | 1,121 | 21.44 | 78 | py |
pyparrot | pyparrot-master/examples/demoSwingDirectFlight.py | """
Demo the direct flying for the python interface
Author: Victor804
"""
from pyparrot.Minidrone import Swing
# you will need to change this to the address of YOUR swing
swingAddr = "e0:14:04:a7:3d:cb"
# make my swing object
swing = Swing(swingAddr)
print("trying to connect")
success = swing.connect(num_retries=3... | 843 | 18.627907 | 59 | py |
pyparrot | pyparrot-master/examples/demoAnafiVisionGUI.py | from pyparrot.Anafi import Anafi
from pyparrot.DroneVisionGUI import DroneVisionGUI
from pyparrot.Model import Model
import cv2
WRITE_IMAGES = False
class UserVision:
def __init__(self, vision):
self.index = 0
self.vision = vision
def save_pictures(self, args):
img = self.vision.get... | 1,678 | 22.985714 | 70 | py |
pyparrot | pyparrot-master/examples/demoSwingJoystick.py | import pygame
import sys
from pyparrot.Minidrone import Swing
def joystick_init():
"""
Initializes the controller, allows the choice of the controller.
If no controller is detected returns an error.
:param:
:return joystick:
"""
pygame.init()
pygame.joystick.init()
joystick_count ... | 5,502 | 30.626437 | 221 | py |
pyparrot | pyparrot-master/examples/demoMamboGroundcam.py | """
Demo of the groundcam
Mambo takes off, takes a picture and shows a RANDOM frame, not the last one
Author: Valentin Benke, https://github.com/Vabe7
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
import cv2
mambo = Mambo(None, use_wifi=True) #address is None since it only works with WiFi anyway
print... | 1,160 | 26.642857 | 115 | py |
pyparrot | pyparrot-master/examples/demoMamboGun.py | """
Demo the gun for the python interface
Author: Amy McGovern
"""
from pyparrot.Minidrone import Mambo
# you will need to change this to the address of YOUR mambo
mamboAddr = "e0:14:d0:63:3d:d0"
# make my mambo object
# remember you can't use the gun with the camera installed so this must be BLE connected to work
... | 721 | 20.235294 | 96 | py |
pyparrot | pyparrot-master/examples/demoAnafiVision.py | """FFmpeg based vision demo for Parrot Anafi"""
import threading
import time
import cv2
from pyparrot.Anafi import Anafi
from pyparrot.DroneVision import DroneVision
from pyparrot.Model import Model
# Set to True to output images
WRITE_IMAGES = False
class UserVision:
def __init__(self, vision):
self.in... | 1,644 | 25.967213 | 77 | py |
pyparrot | pyparrot-master/examples/demoBebopDirectFlight.py | """
Flies the bebop in a fairly wide arc. You want to be sure you have room for this. (it is commented
out but even what is here is still going to require a large space)
Author: Amy McGovern
"""
from pyparrot.Bebop import Bebop
import math
bebop = Bebop()
print("connecting")
success = bebop.connect(10)
print(succes... | 1,466 | 28.938776 | 119 | py |
pyparrot | pyparrot-master/examples/demoAnafi.py | from pyparrot.Anafi import Anafi
anafi = Anafi(drone_type="Anafi", ip_address="192.168.42.1")
print("connecting")
success = anafi.connect(10)
print(success)
print("sleeping")
anafi.smart_sleep(5)
print("taking off")
anafi.safe_takeoff(5)
anafi.smart_sleep(1)
print("moving")
anafi.move_relative(dx=1,dy=0,dz=0,dradians=0... | 407 | 23 | 60 | py |
pyparrot | pyparrot-master/coursework/ai_class/droneMapGUI.py | """
GUI for AI class using drones. Allows you to quickly create a map of
a room with obstacles for navigation and search.
Amy McGovern dramymcgovern@gmail.com
"""
from tkinter import *
import numpy as np
from tkinter import filedialog
import os
import pickle
class DroneGUI:
def __init__(self):
self.root... | 11,480 | 34.544892 | 124 | py |
pyparrot | pyparrot-master/docs/conf.py | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# pyparrot documentation build configuration file, created by
# sphinx-quickstart on Tue May 29 13:55:14 2018.
#
# This file is execfile()d with the current directory set to its
# containing dir.
#
# Note that not all possible configuration values are present in this
# a... | 5,536 | 29.761111 | 92 | py |
COSINE100_analysis | COSINE100_analysis-master/bayesian_bg.py |
# this code calculates evidence for background only hypothesis
import numpy as np
from scipy import optimize , stats
import os
import dynesty
import time
from dynesty import NestedSampler
from multiprocessing import Pool
from contextlib import closing
#f=os.path.expanduser("~")+"/Desktop/COSINE100/data/c2_data.... | 2,873 | 30.933333 | 151 | py |
COSINE100_analysis | COSINE100_analysis-master/bayesian_wfree.py |
# this code calculates Bayesian evidence for background + signal model
import numpy as np
from scipy import optimize , stats
import os
import dynesty
from dynesty import NestedSampler
from dynesty import DynamicNestedSampler
import nestle
import time
import matplotlib.pyplot as plt
from multiprocessing import Pool
f... | 3,677 | 30.982609 | 193 | py |
COSINE100_analysis | COSINE100_analysis-master/analysis_wfixed.py | # TIME PERIOD FIXED
# MODEL COMPARISON : Frequentist , AIC , BIC
import numpy as np
from scipy import optimize , stats
import matplotlib.pyplot as plt
plt.style.use('ggplot')
#f=input('enter path to data file : ')
data1 = np.loadtxt('crystal2.txt',delimiter=',')
#g=input('enter path to data fi... | 10,365 | 37.82397 | 225 | py |
COSINE100_analysis | COSINE100_analysis-master/bayesian_wfixed.py | # this code calculates Bayesian evidence for signal+ background (with w fixed)
# =============================================================
#
print(' w FIXED \n')
import numpy as np
from scipy import optimize , stats
import os
import dynesty
import time
from dynesty import NestedSampler
from multiprocessing imp... | 3,476 | 34.479592 | 207 | py |
COSINE100_analysis | COSINE100_analysis-master/analysis_wfree.py | # ALL PARAMETERS FREE
# MODEL COMPARISON : Frequentist , AIC , BIC
import numpy as np
from scipy import optimize , stats
import matplotlib.pyplot as plt
plt.style.use('ggplot')
#f=input('enter path to data file : ')
data1 = np.loadtxt('crystal2.txt',delimiter=',')
#g=input('enter path to data fi... | 10,514 | 37.800738 | 244 | py |
picsar-development | picsar-development/examples/example_scripts_python/test_drifted_plasmas_3d.py | # ______________________________________________________________________________
#
# Execution test: Drifted plasmas
# We advice to not delete or modify this script, else make a copy
#
# In this script, electron-positron beams (drifted plasmas) are sent in each
# direction of the domain: x,y,z.
#
# This script enables... | 26,234 | 38.992378 | 204 | py |
picsar-development | picsar-development/examples/example_scripts_python/test.py | from mpi4py import MPI
import sys
import os
from picsar_python import picsarpy as pxrpy
import numpy as np
home=os.getenv('HOME')
#currentdir=os.getcwd()
#sys.path.append(currentdir+'/python_bin/')
#print(currentdir+'/python_bin/')
pxr=pxrpy.picsar
#### Input parameters (replace input file)
pxr.default_init()
pxr.to... | 4,920 | 24.365979 | 112 | py |
picsar-development | picsar-development/examples/example_scripts_python/ion_acceleration_2d.py | # ______________________________________________________________________________
#
# Test script of laser-thin foil interaction for ion acceleration
#
# ______________________________________________________________________________
from warp import *
from warp.field_solvers.em3dsolverPXR import *
import os
from warp.da... | 21,064 | 35.194158 | 121 | py |
picsar-development | picsar-development/examples/example_scripts_python/homogeneous_plasma.py | from warp import *
from warp.field_solvers.em3dsolverPXR import *
import os
from warp.data_dumping.openpmd_diag import FieldDiagnostic, ParticleDiagnostic
from mpi4py import MPI
EnableAll()
home=os.getenv('HOME')
l_pxr=1
# --- flags turning off unnecessary diagnostics (ignore for now)
top.ifzmmnt = 0
top.itmomnts = 0... | 16,580 | 34.353945 | 121 | py |
picsar-development | picsar-development/examples/example_scripts_python/testwwarp.py | from mpi4py import MPI
import sys
import os
currentdir=os.getcwd()
sys.path.append(currentdir+'/python_bin/')
print(currentdir+'/python_bin/')
from picsar_python import picsarpy as pxrpy
import numpy as np
import warp as wp
pxr = pxrpy.picsar
#### Input parameters (replace input file)
pxr.default_init()
##Simulation ... | 3,136 | 20.784722 | 99 | py |
picsar-development | picsar-development/examples/example_scripts_python/test_Langmuir_wave_3d.py | # ______________________________________________________________________________
#
# Execution test: Langmuir wave
# We advice to not delete or modify this script, else make a copy
# ______________________________________________________________________________
from warp import *
from warp.field_solvers.em3dsolverPXR i... | 22,927 | 37.14975 | 197 | py |
picsar-development | picsar-development/examples/example_scripts_python/HHG_ROM.py | from warp import *
from warp.field_solvers.em3dsolverPXR import *
from warp.data_dumping.openpmd_diag import FieldDiagnostic, ParticleDiagnostic
from mpi4py import MPI
l_pxr=1
# --- flags turning off unnecessary diagnostics (ignore for now)
top.ifzmmnt = 0
top.itmomnts = 0
top.itplps = 0
top.itplfreq = 0
top.zzmomnts... | 20,141 | 33.908146 | 121 | py |
picsar-development | picsar-development/examples/example_scripts_python/HHG_ROM_CORI.py | from warp import *
from warp.field_solvers.em3dsolverPXR import *
from warp.data_dumping.openpmd_diag import FieldDiagnostic, ParticleDiagnostic
from mpi4py import MPI
l_pxr=1
# --- flags turning off unnecessary diagnostics (ignore for now)
top.ifzmmnt = 0
top.itmomnts = 0
top.itplps = 0
top.itplfreq = 0
top.zzmomnts... | 19,427 | 34.195652 | 121 | py |
picsar-development | picsar-development/examples/example_scripts_python/test_laser.py | """
Launches laser at z=-2.5 microns.
"""
from mpi4py import MPI
from warp import *
from warp.field_solvers.em3dsolverPXR import *
EnableAll()
l_2d = 0
l_test = 1 # --- open window on screen if true, save on disk in cgm file otherwise
ncells = 16*2 # --- nb cells in x
nzfact = 10 # --- multiplication factor for n... | 6,587 | 32.441624 | 106 | py |
picsar-development | picsar-development/examples/example_scripts_python/test_load_balancing.py | from warp import *
from warp.field_solvers.em3dsolverPXR import *
import os
from warp.data_dumping.openpmd_diag import FieldDiagnostic, ParticleDiagnostic
from mpi4py import MPI
home=os.getenv('HOME')
l_pxr=1
# --- flags turning off unnecessary diagnostics (ignore for now)
top.ifzmmnt = 0
top.itmomnts = 0
top.itplps ... | 19,825 | 34.466905 | 121 | py |
picsar-development | picsar-development/Acceptance_testing/Python_tests/test_Langmuir_wave/test_Langmuir_wave_3d.py | # ______________________________________________________________________________
#
# Execution test: Langmuir wave
# We advice to not delete or modify this script, else make a copy
# ______________________________________________________________________________
from warp import *
from warp.field_solvers.em3dsolverPXR ... | 23,080 | 37.087459 | 197 | py |
picsar-development | picsar-development/Acceptance_testing/Python_tests/test_radiation_reaction/test_rr_synchrotron_LL.py | # --- Input script to test for RR losses
# --- in a case of 'synchrotron radiation'
# --- Import needed python modules (WARP, PXR, etc.)
from warp import *
from warp.field_solvers.em3dsolverPXR import *
import os
from warp.data_dumping.openpmd_diag import FieldDiagnostic, ParticleDiagnostic, \
ParticleAccumulato... | 14,054 | 28.527311 | 115 | py |
picsar-development | picsar-development/Acceptance_testing/Python_tests/test_drifted_plasmas/test_drifted_plasmas.py | # ______________________________________________________________________________
#
# Execution test: Drifted plasmas
# We advice to not delete or modify this script, else make a copy
#
# In this script, electron-positron beams (drifted plasmas) are sent in each
# direction of the domain: x,y,z.
#
# This script enables... | 26,274 | 38.931611 | 204 | py |
picsar-development | picsar-development/Acceptance_testing/Python_tests/test/test.py | from mpi4py import MPI
import sys
import os
from picsar_python import picsarpy as pxrpy
import numpy as np
home=os.getenv('HOME')
#currentdir=os.getcwd()
#sys.path.append(currentdir+'/python_bin/')
#print(currentdir+'/python_bin/')
pxr=pxrpy.picsar
#### Input parameters (replace input file)
pxr.default_init()
pxr.to... | 4,944 | 24.489691 | 112 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_Langmuir_wave/conftest.py | # conftest.py file to setup pytest
import pytest
# Command line arguments
def pytest_addoption(parser):
parser.addoption("--trun", action="store", default="1",help="--trun: 0/1")
parser.addoption("--ttest", action="store", default="1",help="--ttest: 0/1")
parser.addoption("--tshow", action="store", default... | 875 | 35.5 | 102 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_Langmuir_wave/test_langmuir_wave.py | #! /usr/bin/python
"""
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject... | 9,951 | 29.716049 | 144 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_plasma_drift/conftest.py | # conftest.py file to setup pytest
import pytest
# Command line arguments
def pytest_addoption(parser):
parser.addoption("--trun", action="store", default="1",help="--trun: 0/1")
parser.addoption("--ttest", action="store", default="1",help="--ttest: 0/1")
parser.addoption("--tshow", action="store", default... | 875 | 35.5 | 102 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_plasma_drift/test_plasma_drift.py | #! /usr/bin/python
"""
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject... | 8,751 | 28.667797 | 144 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_homogeneous_plasma/test_homogeneous_plasma.py | #! /usr/bin/python
"""
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject... | 8,414 | 29.053571 | 144 | py |
picsar-development | picsar-development/Acceptance_testing/Fortran_tests/test_homogeneous_plasma/conftest.py | # conftest.py file to setup pytest
import pytest
# Command line arguments
def pytest_addoption(parser):
parser.addoption("--trun", action="store", default="1",help="--trun: 0/1")
parser.addoption("--ttest", action="store", default="1",help="--ttest: 0/1")
parser.addoption("--tshow", action="store", default... | 875 | 35.5 | 102 | py |
picsar-development | picsar-development/python_module/setup.py | from setuptools import setup, find_packages
setup(
name='picsar_python',
version='0.0.1',
description='Python wrapper for high-performance PIC library',
maintainer='Henri Vincenti',
maintainer_email='henri.vincenti@cea.fr',
license='BSD-3-Clause-LBNL',
packages=find_packages('./'),
incl... | 389 | 25 | 66 | py |
picsar-development | picsar-development/python_module/picsar_python/__init__.py | import picsarpy
| 16 | 7.5 | 15 | py |
picsar-development | picsar-development/utils/generate_miniapp.py | import os, sys
import shutil
from datetime import datetime
# From the picsar root directory:
# python utils/generate_miniapp.py \
# --pusher boris --depos direct --solver fdtd --optimization off \
# --charge off --laser off --geom 3d --order 1 --diags off --errchk off
# Then:
# pushd PICSARlite
# Go into src/submain.F... | 94,891 | 41.062057 | 91 | py |
picsar-development | picsar-development/utils/viewer2d.py | from numpy import *
import matplotlib.pyplot as plt
import numpy as np
import glob
import os
import sys,getopt
import sys
#from PyLoadArrayPicsar import LoadBinNumPyArray3D
from Field import *
# ______________________________________________________________________________
# RCparams
mpl.rcParams['font.size'] = 14
m... | 1,290 | 22.053571 | 83 | py |
picsar-development | picsar-development/utils/postprocessing/plot_field_picsar.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any r... | 3,619 | 27.28125 | 84 | py |
picsar-development | picsar-development/utils/postprocessing/check_divE=rho.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any r... | 2,583 | 29.4 | 80 | py |
picsar-development | picsar-development/utils/postprocessing/PyLoadArrayPicsar.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any r... | 2,634 | 27.031915 | 94 | py |
picsar-development | picsar-development/utils/postprocessing/Field.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any requ... | 5,349 | 31.035928 | 80 | py |
picsar-development | picsar-development/utils/fortran_parsers/use_module_only.py | """
This script replaces the syntax
USE some_module
with the syntax
USE some_module, ONLY: some_variable1, some_variable2
The variables are automatically detected.
Usage
-----
python use_module_only.py
"""
# First of all: check that this python 3 is being used
import sys
if sys.version_info.major < 3:
raise Ru... | 15,684 | 42.209366 | 116 | py |
picsar-development | picsar-development/utils/fortran_parsers/justify_file.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any req... | 10,928 | 41.196911 | 94 | py |
picsar-development | picsar-development/utils/fortran_parsers/indent_file.py | """
_______________________________________________________________________________
*** Copyright Notice ***
"Particle In Cell Scalable Application Resource (PICSAR) v2", Copyright (c)
2016, The Regents of the University of California, through Lawrence Berkeley
National Laboratory (subject to receipt of any req... | 7,120 | 45.848684 | 100 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.