glyph_factory 0.1 doc

A set of four tools can work together to create glyphs. They are:

Workflow Summary

You start with a data file in Comma Separated Value (CSV) form, such as this:

Think of a glyph to display all of these columns of data. Use antz to create a single glyph with any number of children. Modify all of its parts to their "minmum" configurations of size, location and/or color. Save it. Modify it agin so that all of its parts are in their "maximum" configuration. Save it again.


two copies of a glyph with minimum and maximum configurations

Feed the two antz csv files to glyph_diff which will produce a glyph differences file such as this:

(In all the tools here row zero is the header and row one is the first row of data; column one is the first column.) Take your original data file and feed it to data_stats to create a data statistics file like this:

Only the columns that change are listed.

Now you are ready to study these files and figure out which data columns will map onto which glyph rows and columns. This is the hardest part, since you must study the raw CSV files and compare them with the display to figure out which glyph parameters to use. (In the future I plan to create a way to use tags to speed this up.) Then you use an editor like notepad to create a mapping file, like this:

    format:
    
    glyh_row,glyh_col:data_col

From this point the process is "automagic," in that you run the glyph_factory program and it takes all of the above files and produces a final CVS file with one glyph per data row, with all parameters correctly mapped from ranges of min/max in the data to ranges of min/max in the glyph.


final glyphs with data mapped onto sizes/postions/colors

Technical Details

Programs are compatible with the latest version of antz as of March 2014.

Note that all the programs below simply read and write text files. Each of them could have been written any modern language. I chose what I thought was the best tool in each case.

The glyph_diff program is written in Python and its source code is at:

This prototype code is not self-documenting yet. It expects its inputs to be in files names "file1.txt" and "file2.txt" and takes one or two command line parameters: type and ignore. Type refers to an an antz row type, where 5 is the "pin" type used by all glyphs. If present this parameter means only look at rows of this type. Ignore refers to a column to ignore. Column 4 is the selection column, which is always only 0 or 1 and is not important for the glyph diff, so the program can be told to ignore that (or any other) single column. This is why the code is run this way:


python ./glyph_diff.py 5 4 > glyph_diff.txt

The data_stats program is written in R and its source code is at:

Note that there is no script.R file; I was struggling with getting batch jobs to run correcly and finally resorted to imbeding the R code in a Bash script, as you will see in the Test file.

The glyph_factory program is written in C and its source code is at:

It is partially self-documenting with the flags -u (usage) and -h (help) but needs more work. It assumes the data file is coming from standard input, and the other input files are named:

  • glyph_in.csv
  • data_stats.txt
  • mapper.txt
  • glyph_diff.txt

You can pass it either the minimum or maximum glyph; whichever you use will be the the default mapping for columns that do not change.

Expect improvements to these prototypes soon.

Last update by ABS Tue, Apr 15, 2014 2:28:20 PM