Python Time-Profiling, on Windows
(Installing RunSnakeRun to view cProfile Python output on Windows)
First word on profiling: understanding of technique is essential!
I've gone through several dawning realisations about application profiling, having never been taught it. First I timed things ad-hoc (as many people do): end time minus start time, on single areas of interest. Then, when I first had to seriously optimise a (Python) program, I used an annotation technique I found somewhere that gave inaccurate (but helpful for a start) timing information on a per-function basis. But that's all too invasive! Python makes full-on profiling much quicker and easier than that. cProfile adds a whack of timing overhead to a program run, recording a load of useful timing and call count data. (Note: "sampling" to locate slow section...). cProfile can be called externally and run the program, or just put it around the main area you want to assess.
#Profiling --
import cProfile
cProfile.run('mainFunction()', 'profile_data_filename') #outputs profiling to file 'profile_data_filename'
#In normal operation --
# mainFunction()
Checking that data afterwards is easier with a GUI tool. RunSnakeRun looks like the main contender in this field, and it looks good. Assuming you're using Python 2.7.*...
- You will need WxPython. Grab wxPython2.8-win32-unicode-py27 (unicode version, and whatever-bit your OS is). Just install.
- You need easy_install - part of setuptools. Install setuptools by downloading and running setuptools-0.6c11.win32-py2.7.exe (or equivalent) from the Python Package Index.
- That will give you
C:\Python27\Scripts\easy_install.exe. You can add the scripts dir to your path if desired, or just run easy_install explicitly this one time. - Run (for example) C:\python27\scripts\easy_install SquareMap RunSnakeRun
Done! You can read your profile data by invoking: C:\Python27\Scripts\runsnake.exe profile_data_filename
Tutorials and Reference Articles
Photoshop/GIMP/Inkscape/Blender Tutorials, Java Tutorials, C/C++ Tutorials, General Game Design tutorials...this section is largely incomplete as its content is still being collated and indexed.
For now, here are some quick reference how-to's I have put together for common (ish) tasks I've had to repeat enough times to desire a reference for.
Digital painting to print
A brief reminder note (to myself mostly) summarising what to remember when producing digital images for print:- Find out the correct paper sizes using this excellent, useful reference showing millimetre paper dimensions.
- 300dpi -- expected minimum resolution. Size accordingly.
- Use CMYK colour - this will match correctly when printed out. GIMP foolishly doesn't support CMYK colour, so no images produced in GIMP can be printed correctly without some external processing and colour adjustments.
- Gamma/“linear workflow” -- remember your monitor is gamma 2.2, and get your head around what that means for brightness level!
How To Install GIMP Plugins: High Pass Filter
The GIMP should come with the High Pass filter, but doesn't because that would be useful, convenient, and easy.
The High Pass Filter I found to be of use comes from the GIMP Plugin Registry, a singularly unhelpful and poorly laid out web page that catalogues thousands of plugins with a minimal of access to this cataloguing, and actually contains no information at all about how anyone might make use of any of these plugins.
This is a consistent interaction experience with other GIMP support websites encountered, all of which are remarkably unhelpful in their perspective.
Technical Fluff
Which you shouldn't need to know, but do anyway because it's not automatic:
- GIMP uses Plugins and Scripts and Filters and stuff. I have no idea why there are so many different flavoured thingies, but as a user it's pointless detail. Except…
- The High Pass
Filter “plugin” is a scm file. This means it's not a plugin, but a script.
This means it must go in your script folder, not your plugin folder, or
it won't appear in your menus. Find out what your script path is by going
to Edit > Preferences. For me, on Ubuntu, this is
/usr/share/gimp/2.0/scripts/. The plugin path was completely different,/usr/lib/gimp/2.0/plug-ins/. On Windows, expectC:\Program Files\GIMP\pluginsor possibly some guff inYour Documents and Settings. - Once placed in the script folder, the .scm for High Pass should make the filter available in Filter > Generic > High Pass.
So what's a plugin?
Blender: Easy Renderfarm
- Set up your blend file to output the correct frames format, use composite nodes, etc.
- In the Render Output Panel, make sure ‘threads’ is set to Auto, and switch on Touch and No Overwrite. Touch creates a blank file for the frame about to be rendered. No Overwrite makes the Blender instance skip any existing files in the destination folder, only rendering free ones.
Combined, these options mean you don’t have to manually delegate frame ranges to separate machines, you can just get them all to render frames to the same output folder (eg a SAMBA folder). - Save the blend file with these options set into it.
Example run command:
blender –b ./shots/scene1.blend –x 1 –o ./renders/scene1/frame####.exr –F EXR –s 1 –e 1015 –a
TurboCAD / Blender Workflow Tips
Summarising steps in producing 3D house renders from 2D drawings:- Exporting SVG would be ace except the importer bails out in French, and SVG is not the friend of TC's pattern renderings (*big files*). Use VRML (*.wrl) export.
- Export only works on Drawing or Selection of whatever is in the Model Space. We typically have different Paper Space tabs with roof plan, ground floor plan, sections, etc. These must be cut and paste onto Model Space tab or the export will create blank files.
- Without question, use VRML 1.0 in the export configuration in TurboCAD. These will be created as meshes, not curves, and deal much better with TCAD's brick/tile patterning. Import to Blender 2.49 with the top option in Import, not the later 'X3D & VRML 97'.
- Depending on speed (VRML 1.0 helps greatly!) it might be necessary to separately export each set of plans as selection to a separate file.
- Standard external renders: use photo texture of common elements. Preset a blend file with grass, slate, roughcast, facing brick...
- Would be nice if: standard interior models could be made for baths, fittings, etc. Also, this would be a killer app to try using that GPU photoreal renderer that Brecht is going to work at... for arresting results. Look into this.
- WRL (VRML) Export Tips!