numpy.degrees

Here are the examples of the python api numpy.degrees taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.

155 Examples 7

3 Source : metrics.py
with MIT License
from AvivNavon

def normal_error(x_pred, x_output):
    binary_mask = (torch.sum(x_output, dim=1) != 0)
    error = torch.acos(
        torch.clamp(torch.sum(x_pred * x_output, 1).masked_select(binary_mask), -1, 1)
    ).detach().cpu().numpy()
    error = np.degrees(error)
    return np.mean(error), np.median(error), np.mean(error   <   11.25), np.mean(error  <  22.5), np.mean(error  <  30)


def confusion_mat(pred, target, main_task=None, stl=False):

3 Source : field_vector.py
with GNU General Public License v3.0
from BraiNEdarwin

    def get_components(self, *names):
        """Get field components by name"""

        def convert_angle_to_degrees(name, value):
            # Convert all angles to degrees
            if name in ["theta", "phi"]:
                return np.degrees(value)
            else:
                return value

        components = [convert_angle_to_degrees(
            name, getattr(self, "_" + name)
        ) for name in names]

        return components

    def is_equal(self, other):

3 Source : solar_position.py
with Apache License 2.0
from chrisroadmap

def _geocentric_longitude(julian_date):
    result_radians = _term_sum(julian_date, HELIOCENTRIC_LONGITUDE_COEFFS)
    result_degrees = (180 + np.degrees(result_radians)) % 360
    return result_degrees


def _geocentric_latitude(julian_date):

3 Source : solar_position.py
with Apache License 2.0
from chrisroadmap

def _geocentric_latitude(julian_date):
    result_radians = _term_sum(julian_date, HELIOCENTRIC_LATITUDE_COEFFS)
    result_degrees = np.degrees(result_radians)
    return -result_degrees


def _earth_sun_distance(julian_date):

3 Source : navigator.py
with MIT License
from fuzailpalnak

    def _search_space(
        goal: GoalNode, start: StartNode, potential: Union[GoalNode, StartNode, Node]
    ):
        """

        :param goal:
        :param start:
        :param potential:
        :return:
        """
        angle = angle_between_vector(
            vector((start.x, start.y), (potential.x, potential.y)),
            vector((start.x, start.y), (goal.x, goal.y)),
        )

        return np.degrees(angle)

    @staticmethod

3 Source : texture.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def write_data(self, prefix):
        """
        write out the data in text format
        the prefix goes in front of the names
        name will be "  <  prefix>_hkl.txt"
        """
        for k in self.pfdata:
            fname = f"{prefix}_{k}.txt"
            angs = np.degrees(self.angs[k])
            intensities = np.atleast_2d(self.intensities[k]).T
            data = np.hstack((angs,intensities))
            np.savetxt(fname, data, delimiter="\t")

    @property

3 Source : utils.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def tth_to_pixel(self, tth):
        """
        convert two-theta value to pixel value (float) along two-theta axis
        """
        return np.degrees(tth - self.tth_min)/self.tth_pixel_size


class SphericalView(object):

3 Source : calibration_mockup.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def __init__(self, instr, plane_data, img_dict,
                 tth_tol=None, eta_tol=0.25,
                 pktype='pvoigt'):
        assert list(instr.detectors.keys()) == list(img_dict.keys()), \
            "instrument and image dict must have the same keys"
        self._instr = instr
        self._plane_data = plane_data
        self._img_dict = img_dict

        # for polar interpolation
        self._tth_tol = tth_tol or np.degrees(plane_data.tThWidth)
        self._eta_tol = eta_tol

        # for peak fitting
        # ??? fitting only, or do alternative peak detection?
        self._pktype = pktype

    @property

3 Source : polarview.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def tth_to_pixel(self, tth):
        """
        convert two-theta value to pixel value (float) along two-theta axis
        """
        return np.degrees(tth - self.tth_min) / self.tth_pixel_size

    @property

3 Source : polarview.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def eta_to_pixel(self, eta):
        """
        convert eta value to pixel value (float) along eta axis
        """
        return np.degrees(eta - self.eta_min) / self.eta_pixel_size

    @property

3 Source : polar_plot.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def draw_polar(self):
        """show polar view of rings"""
        self.pv = PolarView(self.instr)
        self.pv.warp_all_images()

        '''
        tth_min = HexrdConfig().polar_res_tth_min
        tth_max = HexrdConfig().polar_res_tth_max
        eta_min = HexrdConfig().polar_res_eta_min
        eta_max = HexrdConfig().polar_res_eta_max

        self._extent = [tth_min, tth_max, eta_max, eta_min]  # l, r, b, t
        '''
        self._extent = np.degrees(self.pv.extent)  # l, r, b, t

    def update_overlay_data(self):

3 Source : calibration_crystal_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def orientation(self, v):
        # This automatically converts to Euler angle conventions
        if HexrdConfig().euler_angle_convention is not None:
            v = copy.deepcopy(v)
            convention = HexrdConfig().euler_angle_convention
            self.convert_angle_convention(v, None, convention)
            v = np.degrees(v)

        for i, w in enumerate(self.orientation_widgets):
            blocker = QSignalBlocker(w)  # noqa: F841
            w.setValue(v[i])

    @property

3 Source : ome_maps_viewer_dialog.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def update_extent(self):
        etas = np.degrees(self.data.etas)
        omes = np.degrees(self.data.omegas)
        self.extent = (etas[0], etas[-1], omes[-1], omes[0])

    def update_cmap_bounds(self):

3 Source : spot_montage.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

def create_labels(det_key, tth_crd, eta_crd, peak_id, hkl):
    tth_crd = np.degrees(tth_crd)
    eta_crd = np.degrees(eta_crd)

    hkl_str = ' '.join([f'{int(x):^3}' for x in hkl])
    labels = {}
    labels['title'] = f"Spot {peak_id}, detector '{det_key}' ({hkl_str})"
    labels['xlabel'] = rf'$2\theta\in({tth_crd[0]:.3f}, {tth_crd[-1]:.3f})$'
    labels['ylabel'] = rf'$\eta\in({eta_crd[0]:.3f}, {eta_crd[-1]:.3f})$'
    return labels


def extract_hkls_from_spots_data(all_spots, grain_id=None, detector_key=None):

3 Source : laue_overlay_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def sample_rmat(self, v):
        # Convert from rotation matrix
        xyz = angles_from_rmat_xyz(v)
        old_convention = {
            'axes_order': 'xyz',
            'extrinsic': True,
        }
        new_convention = HexrdConfig().euler_angle_convention
        angles = convert_angle_convention(xyz, old_convention, new_convention)
        if new_convention is not None:
            angles = np.degrees(angles)

        for w, v in zip(self.sample_orientation_widgets, angles):
            w.setValue(v)

    @property

3 Source : powder_overlay_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def tth_width_gui(self, v):
        enable_width = v is not None
        self.ui.enable_width.setChecked(enable_width)
        if enable_width:
            self.ui.tth_width.setValue(np.degrees(v))

    @property

3 Source : refinements_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

def to_convention(v):
    convention = HexrdConfig().euler_angle_convention
    if convention is not None:
        v = convert_angle_convention(v, None, convention)
        v = np.degrees(v)

    return v

3 Source : rotation_series_overlay_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def tth_width(self, v):
        if v is None:
            return

        self.ui.tth_width.setValue(np.degrees(v))

    @property

3 Source : rotation_series_overlay_editor.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

    def eta_width(self, v):
        if v is None:
            return

        self.ui.eta_width.setValue(np.degrees(v))

    @property

3 Source : conversions.py
with BSD 3-Clause "New" or "Revised" License
from HEXRD

def cart_to_angles(xys, panel, eta_period, tvec_s=None, tvec_c=None,
                   apply_distortion=True):
    kwargs = {
        'tvec_s': tvec_s,
        'tvec_c': tvec_c,
        'apply_distortion': apply_distortion,
    }
    ang_crds, _ = panel.cart_to_angles(xys, **kwargs)
    ang_crds = np.degrees(ang_crds)
    ang_crds[:, 1] = mapAngle(ang_crds[:, 1], eta_period, units='degrees')
    return ang_crds


def angles_to_cart(angles, panel, apply_distortion=True):

3 Source : TestController.py
with MIT License
from KochPJ

	def get_joints(self, type='deg'):
		if type=='deg':
			currentJoins = self.robotClient.GetCurrentJointPose()
			currentJoints = np.degrees(currentJoins)
		elif type=='rad':
			currentJoints = self.robotClient.GetCurrentJointPose()
		else:
			print('get_joints: wrong type')
			currentJoints = -1

		return currentJoints
						
	def move_robot_to_coord_origin(self, coord_system="kitting_box2"):

3 Source : util.py
with MIT License
from langnatalie

def RRMSE(R_pred, R_gt):
    R_pred_euler = npmat2euler_fullrange(R_pred.detach().cpu().numpy())
    R_gt_euler = npmat2euler_fullrange(R_gt.detach().cpu().numpy())
    return np.sqrt(np.mean((np.degrees(R_pred_euler) - np.degrees(R_gt_euler)) ** 2))


def rotationMatrixToEulerAngles(R):

3 Source : hfss_ffd.py
with MIT License
from linmingchih

def point_plane(theta, phi, point, wavelength):
    theta=radians(theta)
    phi=radians(phi)
    A=sin(theta)*cos(phi)
    B=sin(theta)*sin(phi)
    C=cos(theta)
    x1, y1, z1 = point
    distance=A*x1+B*y1+C*z1/(A*A+B*B+C*C)
    result=-degrees(2*pi*distance/wavelength)
    return result

class ffd():

3 Source : utils.py
with MIT License
from lorenmt

def normal_error(x_pred, x_output):
    binary_mask = (torch.sum(x_output, dim=1) != 0)
    error = torch.acos(torch.clamp(torch.sum(x_pred * x_output, 1).masked_select(binary_mask), -1, 1)).detach().cpu().numpy()
    error = np.degrees(error)
    return np.mean(error), np.median(error), np.mean(error   <   11.25), np.mean(error  <  22.5), np.mean(error  <  30)


"""

3 Source : utils.py
with MIT License
from median-research-group

    def update_fun(self, pred, gt):
        # gt has been normalized on the NYUv2 dataset
        pred = pred / torch.norm(pred, p=2, dim=1, keepdim=True)
        binary_mask = (torch.sum(gt, dim=1) != 0)
        error = torch.acos(torch.clamp(torch.sum(pred*gt, 1).masked_select(binary_mask), -1, 1)).detach().cpu().numpy()
        error = np.degrees(error)
        self.record.append(error)

    def score_fun(self):

3 Source : test_binary_system_init.py
with GNU General Public License v2.0
from mikecokina

    def test_discretization_factor(self):
        expected_p = [5.,   6.,   5.96, 5.,   5.,   5.,   5.  ]
        expected_s = [12.,    6.67,  7.,   12.,    9.93,  8.63,  6.61]
        obtained_p, obtained_s = [], []
        for i, bs in enumerate(self.prepare_systems()):
            obtained_p.append(np.degrees(bs.primary.discretization_factor))
            obtained_s.append(np.degrees(bs.secondary.discretization_factor))

        assert_array_equal(np.round(obtained_p, 2), expected_p)
        assert_array_equal(np.round(obtained_s, 2), expected_s)


class ValidityTestCase(ElisaTestCase):

3 Source : laser.py
with Apache License 2.0
from mworion

    def updatePositions(self):
        """
        :return:
        """
        if not self.model:
            return False
        if not self.app.mount.obsSite.haJNow:
            return False

        _, _, _, PB, PD = self.app.mount.calcTransformationMatricesActual()
        PB *= 1000
        PB[2] += 1000
        radius, alt, az = functions.to_spherical(-PD)
        az = np.degrees(az)
        alt = np.degrees(alt)
        self.model['ref']['t'].setTranslation(QVector3D(PB[0], PB[1], PB[2]))
        self.model['az']['t'].setRotationZ(az + 90)
        self.model['alt']['t'].setRotationX(-alt)
        return True

3 Source : tools4pyqtgraph.py
with Apache License 2.0
from mworion

    def addEllipse(self, x, y, a, b, theta):
        """
        :return:
        """
        ellipse = pg.QtWidgets.QGraphicsEllipseItem(-a, -b, 2 * a, 2 * b)
        ellipse.setPos(x, y)
        tr = QTransform()
        tr.rotate(np.degrees(theta))
        ellipse.setTransform(tr)
        ellipse.setPen(self.pen)
        self.p[0].addItem(ellipse)
        return True

    def addValueAnnotation(self, x, y, value):

3 Source : rototranslation.py
with MIT License
from ndrplz

    def alpha_x(self):
        alpha_x = self.rotation.x
        if self.angle_unit == 'degrees':
            alpha_x = np.degrees(alpha_x)
        return alpha_x

    @property

3 Source : rototranslation.py
with MIT License
from ndrplz

    def alpha_y(self):
        alpha_y = self.rotation.y
        if self.angle_unit == 'degrees':
            alpha_y = np.degrees(alpha_y)
        return alpha_y

    @property

3 Source : rototranslation.py
with MIT License
from ndrplz

    def alpha_z(self):
        alpha_z = self.rotation.z
        if self.angle_unit == 'degrees':
            alpha_z = np.degrees(alpha_z)
        return alpha_z

    @property

3 Source : bvh2xaf_helpers.py
with MIT License
from OlafHaag

def mat2euler(rot_mat, axes='rzxz'):
    """Return rotation matrix as Euler angles in order of axes.
    
    
    """
    return np.degrees(t3d.euler.mat2euler(rot_mat, axes=axes))


def string2euler(xaf_string, axes='rzxz'):

3 Source : mbi_aero_coef_comp.py
with Apache License 2.0
from OpenMDAO

    def compute(self, inputs, outputs):
        self.inputs[:, 0] = inputs['M']
        self.inputs[:, 1] = np.degrees(inputs['alpha'])  # convert to deg
        self.inputs[:, 2] = inputs['h'] * 3.28e3   # convert km to ft
        self.inputs[:, 3] = np.degrees(inputs['eta'])  # convert to deg

        outputs['CL'][:] = self.options['mbi_CL'].evaluate(self.inputs)[:, 0]
        outputs['CD'][:] = self.options['mbi_CD'].evaluate(self.inputs)[:, 0] + 0.015
        outputs['CM'][:] = self.options['mbi_CM'].evaluate(self.inputs)[:, 0]

    def compute_partials(self, inputs, partials):

3 Source : mbi_aero_coef_comp.py
with Apache License 2.0
from OpenMDAO

    def compute_partials(self, inputs, partials):
        self.inputs[:, 0] = inputs['M']
        self.inputs[:, 1] = np.degrees(inputs['alpha'])  # convert to deg
        self.inputs[:, 2] = inputs['h'] * 3.28e3   # convert km to ft
        self.inputs[:, 3] = np.degrees(inputs['eta'])  # convert to deg

        for ind, name, mbi in self.mbi_tup:

            data = mbi.evaluate(self.inputs, 1, 0)[:, 0]
            partials[name, 'M'] = data

            data = np.degrees(mbi.evaluate(self.inputs, 2, 0)[:, 0])
            partials[name, 'alpha'] = data

            data = mbi.evaluate(self.inputs, 3, 0)[:, 0] * 3.28e3
            partials[name, 'h'] = data

            data = np.degrees(mbi.evaluate(self.inputs, 4, 0)[:, 0])
            partials[name, 'eta'] = data

3 Source : XRD.py
with MIT License
from qzhu2017

    def get_profile(self, method='gaussian', res=0.01, user_kwargs=None):
        """
        return the profile detail
        """

        return Profile(method, res, user_kwargs).get_profile(self.theta2, \
                self.xrd_intensity, np.degrees(self.min2theta), np.degrees(self.max2theta))


# ----------------------------- Profile functions ------------------------------

class Profile:

3 Source : dihedral_scan.py
with Apache License 2.0
from selimsami

    def plot_results(self, frag, md_energies, title, r_squared=None):
        angles_deg = np.degrees(frag.qm_angles)
        width, height = plt.figaspect(0.6)
        f = plt.figure(figsize=(width, height), dpi=300)
        sns.set(font_scale=1.3)
        plt.xlabel('Angle')
        plt.ylabel('Energy (kJ/mol)')
        plt.plot(angles_deg, frag.qm_energies, linewidth=4, label='QM')
        plt.plot(angles_deg, md_energies, linewidth=4, label='Q-Force')
        plt.xticks(np.arange(0, 361, 60))
        plt.legend(ncol=2, bbox_to_anchor=(1.03, 1.12), frameon=False)
        if r_squared:
            plt.title(f'R-squared = {round(r_squared, 3)}', loc='left')
        plt.tight_layout()
        f.savefig(f"{self.frag_dir}/{title}_data_{frag.id}.pdf", bbox_inches='tight')
        plt.close()

    def plot_fit(self, frag, diff, fit, r_squared):

3 Source : dihedral_scan.py
with Apache License 2.0
from selimsami

    def plot_fit(self, frag, diff, fit, r_squared):
        angles_deg = np.degrees(frag.qm_angles)
        width, height = plt.figaspect(0.6)
        f = plt.figure(figsize=(width, height), dpi=300)
        sns.set(font_scale=1.3)
        plt.xlabel('Angle')
        plt.ylabel('Energy (kJ/mol)')
        plt.plot(angles_deg, diff, linewidth=4, label='Diff')
        plt.plot(angles_deg, fit, linewidth=4, label='Fit')
        plt.xticks(np.arange(0, 361, 60))
        plt.tight_layout()
        plt.title(f'R-squared = {round(r_squared, 3)}', loc='left')
        plt.legend(ncol=2, bbox_to_anchor=(1.03, 1.12), frameon=False)
        f.savefig(f"{self.frag_dir}/fit_data_{frag.id}.pdf", bbox_inches='tight')
        plt.close()

    def _set_symmetrize(self):

3 Source : forcefield.py
with Apache License 2.0
from selimsami

    def add_restraints(self, restraints, directory, fc=1000):
        with open(f"{directory}/{self.mol_name}_qforce{self.polar_title}.itp", "a") as itp:
            itp.write("[ dihedral_restraints ]\n")
            itp.write(";  ai   aj   ak   al type       phi   dp   kfac\n")
            for restraint in restraints:
                a1, a2, a3, a4 = restraint[0]+1
                phi = np.degrees(restraint[1])
                itp.write(f'{a1:>5}{a2:>5}{a3:>5}{a4:>5}{1:>5} {phi:>10.4f}  0.0  {fc}\n')

    def set_charge(self, non_bonded):

3 Source : GPlatesReconstructionModel.py
with MIT License
from siwill22

    def plot(self, fig, scaling=500., style="V0.1c+e", pen="0.1p,black", color="black", **kwargs):
        """
        Plot velocity vectors to a pygmt figure
        """

        tmp = np.vstack((self.longitude, self.latitude,
                        np.degrees(self.velocity_azimuth),
                        np.array(self.velocity_magnitude)/scaling)).T

        fig.plot(data=tmp, style=style, pen=pen, color=color, **kwargs)




class SubductionConvergence(object):

3 Source : evaluator.py
with MIT License
from testingautomated-usi

def evaluate_misb(pred, true):
    diff = calc_angle_distance(pred, true)
    diff = np.abs(np.degrees(diff))
    ff = MISB_TSHD - diff
    return ff


# calculate the misclassification ff
def evaluate_ff2(eval1, eval2):

3 Source : evaluator.py
with MIT License
from testingautomated-usi

def is_misb(sample,prediction):
    diff = calc_angle_distance(prediction[0], sample.eye_angles_rad)
    diff = np.abs(np.degrees(diff))
    if MISB_TSHD - diff   <   0.0:
        return True
    else:
        return False


def eval_archive_dist(ind1, ind2):

3 Source : predictor.py
with MIT License
from testingautomated-usi

    def predict(img, head_pose, label):
        model = Predictor.model
        predictions = model.predict([img, head_pose])

        predictions1 = list()
        confidences = list()

        for i in range(len(predictions)):
            prediction1 = predictions[i]
            explabel = label[i]

            diff = calc_angle_distance(prediction1, explabel)
            diff = np.abs(np.degrees(diff))
            confidence = MISB_TSHD - diff

            predictions1.append(prediction1)
            confidences.append(confidence)

        return predictions1, confidences

3 Source : Mirfit.py
with MIT License
from wmpg

    def __init__(self, img, angle):

        self.angle = angle

        # Rotate image by the calculated angle
        #self.img_rot = scipy.misc.imrotate(img, np.degrees(self.angle))
        self.img_rot = scipy.ndimage.rotate(img, np.degrees(self.angle))

        # Save original image shape
        self.img_ht = img.shape[0]
        self.img_wid = img.shape[1]

        # Calculate image enlargement from rotation
        self.y_diff = (self.img_rot.shape[0] - self.img_ht)/2.0 - 1
        self.x_diff = (self.img_rot.shape[1] - self.img_wid)/2.0


    def rotatePoint(self, x, y):

3 Source : Plates.py
with MIT License
from wmpg

    def __repr__(self):


        return "text " + str(self.text) + " starcat " + str(self.starcat) + " sitename " + \
            str(self.sitename) + " site " + str(self.site) + " lat " + str(self.lat) + " lon " + \
            str(self.lon) + " elev " + str(self.elev) + " ts " + str(self.ts) + " tu " + str(self.tu) + \
            " th0 " + str(np.degrees(self.th0)) + " phi0 " + str(np.degrees(self.phi0)) + " wid " + str(self.wid) + " ht " + \
            str(self.ht) + " a " + str(self.a) + " da " + str(self.da) + " b " + str(self.b) + " db " + \
            str(self.db) + " c " + str(self.c) + " dc " + str(self.dc) + " d " + str(self.d) + " dd " + \
            str(self.dd) + " flags " + str(self.flags) + " rot {:.2f} deg".format(np.degrees(self.rot)) \
            + " FOV: {:.2f} x {:.2f} deg".format(np.degrees(self.fov), np.degrees(self.fov/self.asp))




def loadExact(dir_path, file_name):

3 Source : PlotMap.py
with MIT License
from wmpg

    def scatter(self, lat_list, lon_list, **kwargs):
        """ Perform a scatter plot on the initialized map. 
        
        Arguments:
            lon_list: [list] A list of longitudes (+E in radians) to plot.
            lat_list: [list] A list of latitudes (+N in radians) to plot.

        """

        # Convert coordinates to map coordinates
        x, y = self.m(np.degrees(lon_list), np.degrees(lat_list))

        scat_handle = self.m.scatter(x, y, zorder=3, **kwargs)

        return scat_handle



    def plot(self, lat_list, lon_list, **kwargs):

3 Source : ShowerAssociation.py
with MIT License
from wmpg

    def __repr__(self):

        out_str  = "Shower: {:d} {:s} {:s}\n".format(self.IAU_no, self.IAU_code, self.IAU_name)
        out_str += "    Sol: {:.6f} deg\n".format(np.degrees(self.la_sun))
        out_str += "    L_g: {:.6f} deg\n".format(np.degrees(self.L_g))
        out_str += "    B_g: {:.6f} deg\n".format(np.degrees(self.B_g))
        out_str += "    V_g: {:.3f} km/s\n".format(self.v_g/1000)


        return out_str


def loadJenniskensShowers(dir_path, file_name):

0 Source : experiment.py
with MIT License
from 95616ARG

def plot_polar(specLB, specUB, polytopes, image):
    origin_y, origin_x = image.plot_origin
    # Make a box around the region.
    container = [specLB.copy(), specLB.copy(), specUB.copy(), specUB.copy()]
    container[1][0] = specUB[0]
    container[3][0] = specLB[0]
    intruder_heading = np.degrees(reset(specLB)[2])
    box_y, box_x = image.polar_cartesian_box(reset(container)[:, :2])
    png_y_start, png_x_start = image.plot_to_png(box_y[0], box_x[0])
    png_y_end, png_x_end = image.plot_to_png(box_y[1], box_x[1])
    png_y_start, png_y_end = sorted((png_y_start, png_y_end))
    png_y_start = int(png_y_start)
    png_x_start = int(png_x_start)
    png_y_end = int(min(math.ceil(png_y_end), image.image.shape[0]))
    png_x_end = int(min(math.ceil(png_x_end), image.image.shape[1]))
    for label, polytope in polytopes:
        label_color = image.hex_to_int(color(label))
        A_ub, b_ub = polytope
        on_vertices = [np.all(np.matmul(A_ub, vertex)   <  = b_ub)
                       for vertex in container]
        if not any(on_vertices):
            continue
        if all(on_vertices):
            image.plot_polygons([np.array(reset(container))[:, :2]], [color(label)])
            add_planes(image, intruder_heading)
            return
        for png_y in range(png_y_start, png_y_end):
            for png_x in range(png_x_start, png_x_end):
                plot_y, plot_x = image.png_to_plot(png_y, png_x)
                rho = np.linalg.norm((plot_x, plot_y))
                theta = np.arctan2(plot_y, plot_x)
                rho, theta = process([rho, theta, 0.0, 0.0, 0.0])[:2]
                if not (specLB[0]  < = rho  < = specUB[0]):
                    continue
                if not (specLB[1]  < = theta  < = specUB[1]):
                    continue
                point = [rho, theta] + list(specLB[2:])
                if np.all(np.matmul(A_ub, point)  < = b_ub):
                    image.image[png_y, png_x, :] = label_color
    add_planes(image, intruder_heading)

output_file = open("%s/results.csv" % sys.argv[2], "w")

0 Source : tracking.py
with GNU General Public License v3.0
from AntSimi

    def get_azimuth(self, equatorward=False):
        """
        Return azimuth for each track.

        Azimuth is computed with first and last observations

        :param bool equatorward: If True, Poleward is positive and Equatorward negative
        :rtype: array
        """
        i0, nb = self.index_from_track, self.nb_obs_by_track
        i0 = i0[nb != 0]
        i1 = i0 - 1 + nb[nb != 0]
        lat0, lon0 = self.latitude[i0], self.longitude[i0]
        lat1, lon1 = self.latitude[i1], self.longitude[i1]
        lat0, lon0 = radians(lat0), radians(lon0)
        lat1, lon1 = radians(lat1), radians(lon1)
        dlon = lon1 - lon0
        x = cos(lat0) * sin(lat1) - sin(lat0) * cos(lat1) * cos(dlon)
        y = sin(dlon) * cos(lat1)
        azimuth = degrees(arctan2(y, x)) + 90
        if equatorward:
            south = lat0   <   0
            azimuth[south] *= -1
        return azimuth

    def get_mask_from_id(self, tracks):

0 Source : device.py
with GNU General Public License v3.0
from arcadelab

    def get_mesh_in_world(self, full=False):
        """Get the pyvista mesh for the C-arm, in its world-space orientation.

        Raises:
            RuntimeError: if pyvista is not available.

        """
        if self._static_mesh is None:
            self._static_mesh = self._make_mesh(full=full)

        mesh = self._static_mesh.copy()
        mesh.rotate_x(np.degrees(self.alpha))
        mesh.rotate_y(np.degrees(self.beta))
        mesh.translate(self.isocenter)
        mesh.transform(geo.get_data(self.world_from_device))

        # TODO: add operating window.

        return mesh

    def jitter(self):

0 Source : field_vector.py
with GNU General Public License v3.0
from BraiNEdarwin

    def theta(self):
        return np.degrees(self._theta)

    @property

See More Examples