PEP 8 — Style Guide for Python Code

This document gives coding conventions for the Python code comprising the standard library in the main Python distribution.

This document and PEP 257 (Docstring Conventions) were adapted from Guido’s original Python Style Guide essay, with some additions from Barry’s style guide [2].

http://www.python.org/dev/peps/pep-0008

Is it easy to create an image log in Scorpion Vision?

Read more about Scorpion Image Logger Module

Read more about Scorpion Image Logger Module

Yes – it is very easy to create an Image Logger with Scorpion Vision Software Version X.

In Machine Vision keeping up to date Image Logs is vital. The integrated Scorpion Image Logger module provides support for all the following purposes:

  • Store all or only the error images
    • Can be use for offline improvement of the machine vision system
  • Store images by date and time – create a new folder pr week or every hour
  • Delete image files older than N = 10 days
  • Store images of all products image in a batch in a separate folder
  • Create a test image set for development and verification of the vision system
  • Create directory and files name reflecting the current dynamic state of the machine vision system
  • Turn on of the logging based on an external input defines by a master system – eg PLC or Robot.
  • Turn off image logging before the Disk is full
  • Stamp every image with serial #, batch # and inspection state for easy retrieval.

All the functionally is available without any programming or scripting in an easy to use graphical user interface.

Click to learn more about Scorpion Image Logging

Can Scorpion log data to files?

Scorpion Data Logging

Read more – Scorpion Data Logging

With the release of Scorpion Vision Version X we have added a very good and easy to use module to provide dynamic data logging of calculated values and values measured from other input devices.

All functions are provided without any programming or scripting.

Click to check the Scorpion Data Logger Status Panel

What to do when Scorpion throws an exception shutting down?

This is not very likely – but this will work in many cases. The root cause of this is due to a weakness when hosting .net 2.0 in an application like Scorpion Vision Software.

3. Hint – Exit Code Exception

If you receive unhandled exceptions on Scorpion exit add code to Central Stop to stop event solvers:

# manually call application domain shutdown
import clr
import System
tp = System.Type.GetType(‘Microsoft.Win32.SystemEvents, System, Version=2.0.0.0, Culture=neutral, PublicKyToken=b77a5c561934e089’)
mi = tp.GetMethod(‘Shutdown’, System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Static, None, [], [])
mi.Invoke(None, [])

Read more…

Note: This is only needed if you use .Net in your Scorpion Vision System

Why and when continous triggering?

The continuous triggering in Scorpion was designed to make it possible to captures 10 – 200 images/second. The initial and simple image aquisition model defined by this pattern:

  1. Issue the Grab command
  2. Wait for all ImageComplete events
  3. Issue the Inspect to process the aquired images
  4. Use the AfterInspection event to do IO
  5. Goto 1 or Stop the inspection cycle

Read the details explanation about the event-driven model in Scorpion – http://scorpion.tordivel.no/help/UsersGuide/Service/Actions/Default.htm

The simple model has a drawback when the camera is free-running or the system is hardware triggered if you want to run fast. The Grab command takes time and can be eliminated. This changes the basic models from:

  1. Issue the Grab command
  2. Wait for all ImageComplete events
  3. Goto 1

to the continous model

  1. Wait for all ImageComplete events
  2. Goto 1

The difference is the Grab command is implicit and not explicit in the continous model. The continous model is supported by most Scorpion Camera Drivers.

The implicit Grab command saves milliseconds which is important when running fast 20-100 images / second with a cycle time of 10 – 50 ms. It is more important the faster it goes.

The drawback with the continuous model is that Scorpion Vision might the pushed to hard – too many images might flow into the system and what we call “cpu-starvation” might occur. This may happen if images are pushed to hard into Scorpion or maybe the is noise on the hardware trigger input.

Important Rule of thumb:  The basic image capture model is the best if you do not need the speed of the continuous model.

Why is there a new SPBEditor in Scorpion 9.0?

The new editor supports the new binary spb format in Scorpion Vision Software 9.0. The new binary format is lot faster when working with larger spb-files.

New SpbEditor

The following is important when working with the SPBEditor:

  • XML tab converts the new binary format
  • In the XML you can edit, replace and change every aspect of the SPB
The tag Version is used to record the Scorpion version used to save the SPB.

Scorpion Vision Support Procedure and Checklist

Scorpion Vision Software is a proven framework for creating machine vision solutions. Using Scorpion Vision Software normally reduces the deployment phase of a vision system. We are eager to support the difficult phase of deployment of Scorpion Vision Solutions. Customer with a valid service or software maintenance agreement have the right get priority and the attention from the Scorpion Vision Systems experts.

Use this form to request support or send an e-mail to support@tordivel.no

Information Required to process the request

To be able provide efficient help we need the following information:

  • Company – Name – e-mail address
  • Maintenance Contract # – optional
  • System Information
    • Operating System
    • Available disk space
    • Memory installed
    • Available memory after starting the Scorpion System
      • use task manager to measure the memory
  • Scorpion Information
    • Scorpion Version and build #
    • Scorpion Licence #
    • Camera driver with version and build # – optional

Support background information

Most support situation occur due to the following:

  • Resource consumption
    • Most likely
      • Disk space
      • System Memory
      • Other Windows resources
  • Scorpion Image Processing Error
    • Most error can be avoided by working in the toolbox
    • Advice try to isolate the error and reproduce in an offline Scorpion profile
      • This gives us at support a head start in finding a solution
  • Errors in Scorpion Plugins, ActiveX or other subsystems
    • Scorpion is an open framework and can be affected by other parts of the computer system.
  • Keep in mind that many error systems are just symptoms or a consequence of an error

Scorpion Vision Software is a development framework. It is the profile developer that is responsible for testing and verification of the Vision Solution. This requires a elaborate and step by step development and verification of the system so that errors are avoided and isolated. This process requires the skill and knowledge where the limitations and the good features of the computer, the operating system, the camera setup and Scorpion Vision Software is used in way that the systems become a stable and reliable system.

Support Checklist

The following checklist is very useful:

  • Description of the issue
  • System Information
    • Number of Inspections pr seconds
    • Number of cameras
  • System Memory Profile if applicable
    • Use task manager and curves in each Scorpion Profile
      • After 1 hour of operation and 6 hours of operation
        • Physical Memory ( MB )
          • Total
          • Available
          • Free
        • Scorpion
          • System.Memory usage
          • System.Virtual Memory
  • Error description if applicable
    • Description
    • Average stop rate
    • Number of stops pr week
  • Check System Log and console window for error messages
    • Report the following
      • No errors
      • Error description
    •  Note: Remember to activate Scorpion to display errors
  • Scorpion Profile demonstrating the error situation

Use Case # in subject in all mail communication

When a support request is registered a case with Case # is registered in our customer registration system. We use this Case # to track all correspondence.

It makes it a lot easier if all correspondence is sent to support@tordivel.no with the Case # in subject of the e-mail.

  • Case 20111 Glue Inspection stops once a week

Can Scorpion access SQL databases?

Using Python and Scorpion can access any SQL database from Microsoft, Oracle or the open source MySQL. We use a generic ODBC interface.

The following procedure is performed to test this using the free MS SQL Express 2008.

1. Install MS SQL Express 2008
2. Attach DB mdf file from Example_SQL_Express_DB.zip
  • See mssql_attatch_example.JPG to the right

    MS SQL Server Attach

3. Configure ODBC
4. Restore Example_Scorpion_profile.zip
The sample profile located in the SQL-Examples.zip should be restored.

5. Customize Test script
The user can modify the Test script 18th line. Located in the Scorpion tab Service/Advance/Central.
6. Execute Test script in the Scorpion (Service/Advance/Central)

Are there sample profiles for .Net and Scorpion?

There are numerous examples for using .Net with Scorpion in Scorpion Online Help

Information on how to convert a .Net 1.1 sample to .Net 2.0.

Can Scorpion process images offline?

One important offline verification feature is Scorpion is the HistoryList.  More information Scorpion Online Help. The history list is used to:

  • Keep the N latest image in memory

These images can be used for:

  • Verify toolbox configuration
  • Save select and large reference sets of images for system verification

Scorpion Vision can easily be set up to only keep the interesting images. For example the FAIL images only.

It is of course also possible to configure Scorpion to save selected images in bmp or jpg format. Jpg format if compression is a acceptable option. Experience with Scorpion Vision tends to favour using the history list to collect images for reference sets because saving images automatically tends to capture too many images.

System verification with hundreds or thousands of selected images is very important when doing system verification.