コード例 #1
0
def run():
    parser = argparse.ArgumentParser(description='Generate TOC for JShop')
    parser.add_argument('doi_file', help='Input DOI deposit file')
    parser.add_argument('pdf_file', help='Input PDF deposit file')
    parser.add_argument('-l',
                        '--level',
                        default=1,
                        help='TOC level to which to parse to')

    args = parser.parse_args()

    # Get a (simple) list of the chapters
    outline = Outline(path.abspath(args.pdf_file), args.level)
    chapters = outline.get_chapter_list()

    # Make a dictionary with chapters with DOI and related info
    # (author name(s), chapter title and PDF URL)
    doi_chapters = get_doi_chapters(path.abspath(args.doi_file))

    # Merge in data the information of the first list
    # and the dictionary
    data = []

    for chapter in chapters:
        for doi_chapter in doi_chapters:
            # Find (fuzzy) string matches
            if check_match(chapter, doi_chapter) > 90:
                data.append({doi_chapter: doi_chapters[doi_chapter]})
                break

        else:
            data.append(chapter)

    generate_toc(data)
コード例 #2
0
def submitJob(jobData):
    """Submit the job using the PyOutline API."""
    outline = Outline(jobData['name'],
                      shot=jobData['shot'],
                      show=jobData['show'],
                      user=jobData['username'])
    lastLayer = None
    for layerData in jobData['layers']:
        if layerData.layerType == JobTypes.JobTypes.MAYA:
            layer = buildMayaLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.SHELL:
            layer = buildShellLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.NUKE:
            layer = buildNukeLayer(layerData, lastLayer)
        elif layerData.layerType == JobTypes.JobTypes.BLENDER:
            layer = buildBlenderLayer(layerData, lastLayer)
        else:
            raise ValueError('unrecognized layer type %s' %
                             layerData.layerType)
        outline.add_layer(layer)
        lastLayer = layer

    if 'facility' in jobData:
        outline.set_facility(jobData['facility'])

    return cuerun.launch(outline, use_pycuerun=False)
コード例 #3
0
def squareWithHole() -> Outline:
    outline = Outline(None)
    outline.addLinesFromCoordinateList([[0, 0], [50, 0], [50, 50], [0, 50],
                                        [0, 0]])
    circle = a.Arc(Point(35, 25), Point(35, 25), c.CW, Point(25, 25))
    outline.addLineGroup(circle)
    return outline
コード例 #4
0
 def __init__(self):
     self._objectNumber = 0
     self.objects = list()
     self.catalog = Catalog(self)
     self.outline = Outline(self)
     self.pageTree = PageTree(self)
     self.catalog.outlinesNumber = self.outline.objectNumber
     self.catalog.pageTreeNumber = self.pageTree.objectNumber
コード例 #5
0
def rightGrip() -> Outline:
    outline = Outline(None)
    outline.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]])
    arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5),
                20)
    outline.addLineGroup(arc)
    outline.addLinesFromCoordinateList([[28.5, 6.5], [28.5, 0]])
    outline.addLineGroup(outline.mirror(c.X))
    return outline.translate(82.5, 9.5)
コード例 #6
0
def testSimpleDogBone() -> Outline:
    temp = Outline(None)
    temp.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5],
                                     [28.5, 6.5], [0, 6.5]])
    temp.addLineGroup(temp.mirror(c.Y))
    temp.addLineGroup(temp.mirror(c.X))
    temp = temp.translate(82.5, 9.5)
    temp.finishOutline()
    return temp
コード例 #7
0
def main(input_path, fps, crf, chunk, output_path):
    """
    Sends a job to opencue that will compress an image sequence to
    an H.264 file using multiple render nodes in parallel
    :input_path: str - path to the first frame of the image sequence
    :fps: float - framerate of the desired encoded file
    :crf: int - quality of the desired encoded file

    """
    input_path = os.path.abspath(input_path)
    shot_name = os.path.basename(input_path)
    job_name = "dpx_to_mov"
    show_name = "testing"
    user = getpass.getuser()
    outline = Outline(job_name, shot=shot_name, show=show_name, user=user)

    # Create the MakeMov Layer
    layer_name = "seq_to_mov"
    threads = 1.0
    threadable = False
    frame_start, frame_end = get_imgseq_framerange(input_path)
    range_len = int(frame_end) - int(frame_start)
    frame_range = frame_start + "-" + frame_end
    input_path_ffmpeg = translate_imgseq_ffmpeg(input_path)
    output_chunk_path_template = create_chunk_path_template(input_path)

    seqtomov_layer = SeqToMov(layer_name,
                              chunk=chunk,
                              threads=threads,
                              range=frame_range,
                              threadable=threadable,
                              crf=crf,
                              fps=fps)
    seqtomov_layer.add_input("main", input_path_ffmpeg)
    seqtomov_layer.add_output("main", output_chunk_path_template)

    outline.add_layer(seqtomov_layer)

    # Create the ConcatMov Layer
    layer_name = "concat_mov"
    concatmov_layer = ConcatMov(layer_name,
                                chunk=1,
                                threads=threads,
                                range=1,
                                threadable=threadable)
    chunk_paths = get_chunk_paths(output_chunk_path_template, chunk,
                                  frame_start, frame_end)
    for chunk_path in enumerate(chunk_paths):
        concatmov_layer.add_input("", chunk_path)
    concatmov_layer.add_output("main", output_path)
    concatmov_layer.depend_all(seqtomov_layer)

    outline.add_layer(concatmov_layer)

    # Submit job
    cuerun.launch(outline, use_pycuerun=False)
コード例 #8
0
def rectangle(lowerLeftX: float, lowerLeftY: float, X_width: float,
              Y_height: float) -> Outline:
    rect = [Point(lowerLeftX, lowerLeftY)]
    rect.append(Point(lowerLeftX + X_width, lowerLeftY))
    rect.append(Point(lowerLeftX + X_width, lowerLeftY + Y_height))
    rect.append(Point(lowerLeftX, lowerLeftY + Y_height))
    rectLG = Outline(None)
    rectLG.addLinesFromPoints(rect)
    rectLG.closeShape()
    return rectLG
コード例 #9
0
def regularDogBone() -> Outline:
    dogBone = Outline(None)
    dogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5], [49.642, 9.5]])
    arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5),
                20)
    dogBone.addLineGroup(arc)
    dogBone.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]])
    dogBone.addLineGroup(dogBone.mirror(c.Y))
    dogBone.addLineGroup(dogBone.mirror(c.X))
    dogBone = dogBone.translate(82.5, 9.5)
    dogBone.finishOutline()
    dogBone._name = 'regularDogBone'
    return dogBone
コード例 #10
0
def polygon(centerX: float, centerY: float, radius: float,
            numCorners: int) -> Outline:
    angle = 1.5 * math.pi
    points = []
    incAngle = 2 * math.pi / numCorners
    for i in range(numCorners):
        x = math.cos(angle + incAngle * i) * radius + centerX
        y = math.sin(angle + incAngle * i) * radius + centerY
        points.append(Point(x, y))
    poly = Outline(None)
    poly.addLinesFromPoints(points)
    poly.closeShape()
    poly = poly.rotate(incAngle / 2.0, Point(centerX, centerY))
    return poly
コード例 #11
0
def wideDogBone(gageWidth: float) -> Outline:
    halfWidth = gageWidth / 2.0
    wideDogBone = Outline(None)
    wideDogBone.addLinesFromCoordinateList([[82.5, 0], [82.5, 9.5 + halfWidth],
                                            [49.642, 9.5 + halfWidth]])
    wideArc = a.Arc(Point(49.642, 9.5 + halfWidth),
                    Point(28.5, 6.5 + halfWidth), c.CW,
                    Point(28.5, 82.5 + halfWidth), 20)
    wideDogBone.addLineGroup(wideArc)
    wideDogBone.addLinesFromCoordinateList([[28.5, 6.5 + halfWidth],
                                            [0, 6.5 + halfWidth]])
    wideDogBone.addLineGroup(wideDogBone.mirror(c.Y))
    wideDogBone.addLineGroup(wideDogBone.mirror(c.X))
    return wideDogBone.translate(82.5, 9.5 + halfWidth)
コード例 #12
0
ファイル: Submission.py プロジェクト: xinobi/OpenCue
def submitJob(jobData):
    """Submit the job using the PyOutline API."""
    outline = Outline(jobData['name'],
                      shot=jobData['shot'],
                      show=jobData['show'],
                      user=jobData['username'])
    for layerData in jobData['layers']:
        if layerData.layerType == JobTypes.JobTypes.MAYA:
            layer = buildMayaLayer(layerData)
        elif layerData.layerType == JobTypes.JobTypes.SHELL:
            layer = buildShellLayer(layerData)
        elif layerData.layerType == JobTypes.JobTypes.NUKE:
            layer = buildNukeLayer(layerData)
        outline.add_layer(layer)
    return cuerun.launch(outline, use_pycuerun=False)
コード例 #13
0
ファイル: main.py プロジェクト: hoverdj/pyTalkManager
    def add_outline(self):
        """
        Adds the contents of the AddOtlineWindow to the database.
        """

        outline = Outline()

        outline_number = self.line_number.displayText()
        outline_title = self.line_title.displayText()

        submission = outline.add_outline(outline_number, outline_title)

        if submission[0] == "True":
            self.done(True)
        else:
            error = QtGui.QMessageBox.critical(self, 'Error', submission[1])
コード例 #14
0
ファイル: main.py プロジェクト: hoverdj/pyTalkManager
    def save_edit(self):
        """
        Save edits made by the user to the selected outline.
        """

        number = self.line_number.displayText()
        title = self.line_title.displayText()

        outline = Outline()
        submission = outline.edit_outline(self.edited_item[0][1],
                                          self.edited_item[0][2], number,
                                          title, self.edited_item[0][0])

        if submission[0] == 'True':
            self.done(True)
        else:
            error = QtGui.QMessageBox.critical(self, 'Error', submission[1])
コード例 #15
0
def regularDogBoneFillet(scale: float) -> Outline:
    dogBoneF = Outline(None)
    dogBoneF.addLinesFromCoordinateList([[82.5, 0], [82.5, 4.5]])
    arc = a.Arc(Point(82.5, 4.5), Point(77.5, 9.5), c.CCW, Point(77.5, 4.5),
                6)  #5mm fillet
    dogBoneF.addLineGroup(arc)
    dogBoneF.addLinesFromCoordinateList([[77.5, 9.5], [49.642, 9.5]])
    arc = a.Arc(Point(49.642, 9.5), Point(28.5, 6.5), c.CW, Point(28.5, 82.5),
                20)
    dogBoneF.addLineGroup(arc)
    dogBoneF.addLinesFromCoordinateList([[28.5, 6.5], [0, 6.5]])
    dogBoneF.addLineGroup(dogBoneF.mirror(c.Y))
    dogBoneF.addLineGroup(dogBoneF.mirror(c.X))
    dogBoneF = dogBoneF.translate(82.5, 9.5)
    dogBoneF.finishOutline()
    dogBoneF = dogBoneF.scale(scale)
    dogBoneF._name = 'regularDogBoneFillet'
    return dogBoneF
コード例 #16
0
def typeVDogBone(scale: float) -> Outline:
    typeV = Outline(None)
    typeV.addLinesFromCoordinateList([[31.75, 0], [31.75, 3.77]])
    arc = a.Arc(Point(31.75, 3.77), Point(30.75, 4.77), c.CCW,
                Point(30.75, 3.77), 5)  #1mm fillet
    typeV.addLineGroup(arc)
    typeV.addLinesFromCoordinateList([[30.75, 4.77], [13.17, 4.77]])
    arc = a.Arc(Point(13.17, 4.77), Point(4.77, 1.59), c.CW,
                Point(4.77, 14.29))
    typeV.addLineGroup(arc)
    typeV.addLinesFromCoordinateList([[4.77, 1.59], [0, 1.59]])
    typeV.addLineGroup(typeV.mirror(c.Y))
    typeV.addLineGroup(typeV.mirror(c.X))
    typeV = typeV.translate(31.75, 4.77)
    typeV.finishOutline()
    typeV = typeV.scale(scale)
    typeV._name = 'typeVDogBone'
    return typeV
コード例 #17
0
    def _doDispatch(self, rootBatch):

        # Construct an object to track everything we need
        # to generate the job. I have a suspicion that at
        # some point we'll want a Dispatcher::Job base class
        # which _doDispatch() must return, in which case this
        # might just be member data for a subclass of one of those.
        dispatchData = {}
        dispatchData["scriptNode"] = rootBatch.preTasks()[0].node().scriptNode(
        )
        dispatchData["scriptFile"] = Gaffer.Context.current(
        )["dispatcher:scriptFileName"]
        dispatchData["batchesToLayers"] = {}

        # Create an OpenCue outline and set its basic properties.

        context = Gaffer.Context.current()

        outline = Outline(
            context.substitute(self["jobName"].getValue()) or "untitled",
            show=context.substitute(self["showName"].getValue()) or "show",
            shot=context.substitute(self["shotName"].getValue()) or "shot",
            user=context.substitute(self["userName"].getValue()) or "user",
        )

        # Populate the job with tasks from the batch tree
        # that was prepared by our base class.

        for upstreamBatch in rootBatch.preTasks():
            self.__buildOutlineWalk(outline, upstreamBatch, dispatchData)

        # Signal anyone who might want to make just-in-time
        # modifications to the job.

        self.preSpoolSignal()(self, outline)

        # Finally, we can spool the job.

        cuerun.launch(outline, use_pycuerun=False)
コード例 #18
0
    def __init__(self,
                 trimOutline,
                 pathWidth,
                 angleDegrees,
                 shiftX=0,
                 shiftY=0,
                 design=None,
                 designType=c.PARTIAL_ROW):
        LineGroup.__init__(self, None)
        self.shiftX = shiftX
        self.shiftY = shiftY
        self.designType = designType
        self.trimOutline = Outline(trimOutline)
        self.angleRad = (angleDegrees / 360.0 * 2 * np.pi)
        self.pathWidth = pathWidth
        lowerLeft = Point(self.trimOutline.minX, self.trimOutline.minY)
        upperRight = Point(self.trimOutline.maxX, self.trimOutline.maxY)

        self.trimDiagonal = (lowerLeft - upperRight) * 1.1
        self.operations = (self.extendDesign, self.createField,
                           self.centerAndRotateField, self.trimField)

        try:
            self.design = design(
                space=self.pathWidth,
                length=self.trimDiagonal,
                height=self.trimDiagonal,
            )
            self.designType = c.FULL_FIELD
        except Exception:
            self.design = LineGroup(design)

#        print('\nInfill times:')
        for i in range(self.designType, c.TRIMMED_FIELD):
            startTime = time.time()
            self.operations[i]()
コード例 #19
0
        return cv.divide(gray, 255 - blur, scale=256)


# Open the image
img = Image.open(filename)

# Get the image after applying the Drawing class to it
# This will create the image as a lighter pencil sketch, with background noise nor major edge detection applied
drawing = Drawing(filename).drawing()
cv.imwrite("drawing.png", drawing)

# Apply background noise to image (see background_noise.py for process)
background = BackgroundNoise(img.size, levels=6).background_noise()

# Apply outline to image (see outline.py for process)
outline = Outline(filename).outline()

# Set the mask as the third matrix created by the outline function
mask = outline[3]

# Combine the outline (major edges) with the light pencil sketch to accentuate the major edges
drawing = cv.bitwise_and(drawing, outline, outline)

# Threshold is set to each pixel in the drawing. If the pixel value is set below the threshold (240) assigned 0. 255 is the max which is assigned to pixel values
# exceeding the threshold. THRESH_BINARY applies a simple piece-wise function to apply the threshold:
# dst(x,y) = {maxval    if src(x,y) > threshold}
#            {0         otherwise}
(threshold, drawing) = cv.threshold(drawing, 240, 255, cv.THRESH_BINARY)

# The height and width are set to the current image dimensions
height, width = drawing.shape[:2]
コード例 #20
0
#!/bin/env python2.5

#  Copyright (c) 2018 Sony Pictures Imageworks Inc.
#
#  Licensed under the Apache License, Version 2.0 (the "License");
#  you may not use this file except in compliance with the License.
#  You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
#  Unless required by applicable law or agreed to in writing, software
#  distributed under the License is distributed on an "AS IS" BASIS,
#  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
#  See the License for the specific language governing permissions and
#  limitations under the License.



from outline import Outline, cuerun
from outline.modules.tutorial import HelloModule

ol = Outline("my_job")
ol.add_layer(HelloModule("my_layer"))

cuerun.launch(ol, range="1-10", pause=True)
コード例 #21
0
ファイル: multiregion.py プロジェクト: GokberkSERIN/deneme
secAngs = []
meshes = []

with open(path + paramFile, 'r') as fp:
    data = json.load(fp)

params = Parameters(data[0], data[1])

for fname, color, angle in zip(fnames, colors, angles):
    mesh = trimesh.load_mesh(path + fname)
    meshes.append(mesh)
    section = mesh.section(plane_origin=[0, 0, 0.01], plane_normal=[0, 0, 1])
    loops = section.discrete
    for loop in loops:
        outline = Outline()
        outline._name = fname
        outline.addCoordLoop(loop * 1000)  # 1000 to convert from meters to mm
        outline = outline.translate(-50, -12)
        secAngs.append(SecAng(Section(outline), angle))
        plt.plot(loop[:, 0] - 0.050, loop[:, 1] - 0.012, color)

params.outline = [tuple(secAngs)]
gCode = Gcode(params)

plt.show()


def run():
    startTime = time.time()
    print('\nGenerating code, please wait...')
コード例 #22
0
    'show':
    'inside_job',
    'username':
    user,
    'layers': [
        Layer.LayerData.buildFactory(**NUKE_RENDER_EXR),
        Layer.LayerData.buildFactory(**FFMPEG_LAYER),
        Layer.LayerData.buildFactory(**NUKE_POST_TO_DISCORD),
        Layer.LayerData.buildFactory(**NUKE_POST_TO_FTRACK),
        Layer.LayerData.buildFactory(**NUKE_UPDATE_EDIT),
    ]
}

# SUBMIT ############################################################
outline = Outline(jobData['name'],
                  shot=jobData['shot'],
                  show=jobData['show'],
                  user=jobData['username'])
layers = []
for layerData in jobData['layers']:
    layer = Shell(layerData.name,
                  command=layerData.cmd.split(),
                  chunk='1',
                  threads=float(layerData.cores),
                  range=str(layerData.layerRange),
                  threadable=True)
    layer.set_service(layerData.services[0])
    layers.append(layer)

layer_count = 0
for layer in layers:
    if layer_count > 0:
コード例 #23
0
def center() -> Outline:
    outline = Outline(None)
    outline.addLinesFromCoordinateList([[28.5, 6.5], [-28.5,
                                                      6.5], [-28.5, -6.5],
                                        [28.5, -6.5], [28.5, 6.5]])
    return outline.translate(82.5, 9.5)
コード例 #24
0
"""

import os
import sys
import getpass
import datetime
from modules.debug import DebugLayer
from outline import Outline, cuerun

# Create an outline for the job
job_name = "debug_job"
shot_name = "debug_shot"
show_name = "testing"
user = getpass.getuser()

outline = Outline(job_name, shot=shot_name, show=show_name, user=user)

# Create the debug Layer
layer_name = "debug_layer"
chunk_size = 1
threads = 1.0
threadable = False
frame_range = "1"

debug_layer = DebugLayer(layer_name,
                         input="input_path",
                         output="output_path",
                         chunk=chunk_size,
                         threads=threads,
                         range=frame_range,
                         threadable=threadable,
コード例 #25
0
def circle(centerX: float, centerY: float, radius: float) -> Outline:
    startPoint = Point(centerX + radius, centerY)
    center = Point(centerX, centerY)
    return Outline(a.Arc(startPoint, startPoint, c.CW, center, numPoints=40))