<commit_before>#!/usr/bin/env python
import argparse
import shutil

from icqsol.shapes.icqShapeManager import ShapeManager
from icqsol import util
import icqsol_utils
import numpy

# Parse Command Line.
parser = argparse.ArgumentParser()
parser.add_argument('--input', dest='input', help='Shape dataset selected from history')
parser.add_argument('--input_file_format_and_type', dest='input_file_format_and_type', help='Input file format and type')
parser.add_argument('--input_dataset_type', dest='input_dataset_type', help='Input dataset_type')
parser.add_argument('--rotation_angle_degrees', dest='rotation_angle_degrees', type=float, default=0.0, help='Rotation angle in degrees')
parser.add_argument('--rotation_axis_x', dest='rotation_axis_x', type=float, default=1.0, help='X coordinate of rotation axis')
parser.add_argument('--rotation_axis_y', dest='rotation_axis_y', type=float, default=0.0, help='Y coordinate of rotation axis')
parser.add_argument('--rotation_axis_z', dest='rotation_axis_z', type=float, default=0.0, help='Z coordinate of rotation axis')
parser.add_argument('--output', dest='output', help='Output file name')
parser.add_argument('--output_vtk_type', dest='output_vtk_type', default='ascii', help='Output VTK type')

args = parser.parse_args()

# Get the format of the input - either vtk or ply.
input_format, input_file_type = icqsol_utils.get_format_and_type(args.input_file_format_and_type)
tmp_dir = icqsol_utils.get_temp_dir()

# Get the format of the input - either vtk or ply.
file_format = util.getFileFormat(args.input)

# Instantiate a ShapeManager for loading the input.
if file_format == util.VTK_FORMAT:
    shape_mgr = ShapeManager(file_format=file_format, vtk_dataset_type=args.input_dataset_type)
else:
    shape_mgr = ShapeManager(file_format=file_format)

# Get the vtk polydata from the input dataset.
vtk_poly_data = shape_mgr.loadAsVtkPolyData(args.input)

# Only rotate if the axis has some non-zero coordinates.
axis = numpy.array((args.rotation_axis_x, args.rotation_axis_y, args.rotation_axis_z))

if axis.dot(axis) != 0.0:

    # Rotate (in place operation).
    shape_mgr.rotateVtkPolyData(vtk_poly_data, angleDeg=args.rotation_angle_degrees, axis=axis)<commit_msg> - replacing numpy dot product with a reduce op<commit_after>#!/usr/bin/env python
import argparse
import shutil
import operator

from icqsol.shapes.icqShapeManager import ShapeManager
from icqsol import util
import icqsol_utils

# Parse Command Line.
parser = argparse.ArgumentParser()
parser.add_argument('--input', dest='input', help='Shape dataset selected from history')
parser.add_argument('--input_file_format_and_type', dest='input_file_format_and_type', help='Input file format and type')
parser.add_argument('--input_dataset_type', dest='input_dataset_type', help='Input dataset_type')
parser.add_argument('--rotation_angle_degrees', dest='rotation_angle_degrees', type=float, default=0.0, help='Rotation angle in degrees')
parser.add_argument('--rotation_axis_x', dest='rotation_axis_x', type=float, default=1.0, help='X coordinate of rotation axis')
parser.add_argument('--rotation_axis_y', dest='rotation_axis_y', type=float, default=0.0, help='Y coordinate of rotation axis')
parser.add_argument('--rotation_axis_z', dest='rotation_axis_z', type=float, default=0.0, help='Z coordinate of rotation axis')
parser.add_argument('--output', dest='output', help='Output file name')
parser.add_argument('--output_vtk_type', dest='output_vtk_type', default='ascii', help='Output VTK type')

args = parser.parse_args()

# Get the format of the input - either vtk or ply.
input_format, input_file_type = icqsol_utils.get_format_and_type(args.input_file_format_and_type)
tmp_dir = icqsol_utils.get_temp_dir()

# Get the format of the input - either vtk or ply.
file_format = util.getFileFormat(args.input)

# Instantiate a ShapeManager for loading the input.
if file_format == util.VTK_FORMAT:
    shape_mgr = ShapeManager(file_format=file_format, vtk_dataset_type=args.input_dataset_type)
else:
    shape_mgr = ShapeManager(file_format=file_format)

# Get the vtk polydata from the input dataset.
vtk_poly_data = shape_mgr.loadAsVtkPolyData(args.input)

# Only rotate if the axis has some non-zero coordinates.
axis = (args.rotation_axis_x, args.rotation_axis_y, args.rotation_axis_z)

if reduce(operator.mul, axis) != 0.0:

    # Rotate (in place operation).
    shape_mgr.rotateVtkPolyData(vtk_poly_data, angleDeg=args.rotation_angle_degrees, axis=axis)
{'fraction_non_alphanumeric': 0.11490406068719322, 'fraction_numerical': 0.004462293618920125, 'mean_word_length': 6.991087344028521, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6639970', 'n_tokens_mistral': 1454, 'n_tokens_neox': 1434, 'n_words': 338}