STILTS-TCUBE(1)

๐Ÿ’– STILTS-TCUBE โ€” Calculates N-dimensional histograms ๐Ÿ’–

okay bestie, welcome to stilts-tcube ๐Ÿ’… this page lives in the Stilts commands manual (yes, the whole Stilts fam shares one manual name, that's just how we roll), and today's vibe is โœจN-dimensional histogramsโœจ. grab a snack, hydrate, let's go ๐Ÿ“


๐ŸŒˆ SYNOPSIS

stilts tcube [cols=<expr> ... ...] [ifmt=<in-format>]
             [istream=true|false] [in=<table>] [icmd=<cmds>]
             [bounds=[<lo>]:[<hi>] ...] [binsizes=<size> ...]
             [nbins=<num> ...] [combine=sum|sum-per-unit|count|count-per-unit|mean|median|Q1|Q3|min|max|stdev|stdev_pop|hit]
             [out=<out-file>] [otype=byte|short|int|long|float|double]
             [scale=<expr>]

๐Ÿฆ‹ DESCRIPTION ๐Ÿฆ‹

so tcube builds an N-dimensional histogram, aka a density map, out of N columns of an input table, and then writes it out as an N-dimensional data cube. iconic. ๐ŸŒˆ

the parameters you give it decide which N numeric columns of the input table you're using, what the dimensions of the output grid are (bounds and pixel sizes), any weighting that gets applied to each point, and how all the weighted stuff landing in one single bin gets aggregated together. lowkey a lot of choices, but every one of them is yours ๐Ÿ’…

then, every single table row defines a point in N-dimensional space. the program walks through each row, and if that point falls inside the bounds of the output grid you defined, it associates the weight value with the relevant pixel in the output grid. โœจ when all the input values have been processed, the weights in each pixel get aggregated using whatever combination method you asked for. no cap. ๐Ÿซถ

that resulting N-dimensional array โ€” where pixel values are an aggregation of the rows that landed in that region of N-dimensional space โ€” gets written out as a FITS file. in one dimension you get a normal histogram of a variable. in two dimensions it's typically what you'd use to plot the density (or weighted density) on the sky of objects from a catalogue. ๐ŸŒŒ

and just like some of the other generic table commands, you can do extensive pre-processing on the input table using the icmd parameter before the actual cube counts get calculated. main character pre-processing energy. ๐Ÿ‘‘

also peep tgridmap โ€” it does a similar job to this command, but writes the output in table format instead. besties but different ๐ŸŽ€

โœจ OPTIONS โœจ

  • cols=<expr> ... ... โ€” the columns to use for this task. you give one or more <expr> elements, separated by spaces. each one is a numeric value from the table, handed over as a column name or an algebraic expression. ๐Ÿงฎ

the number of columns you list in this parameter defines the dimensionality of the output data cube. so yeah, this one is kind of the whole point. ๐Ÿ’…

  • ifmt=<in-format> โ€” tells it the format of the input table specified by parameter in. the known formats are all listed in SUN/256. this flag is what you use when you already know what format your table is in. if it has the special value (auto) โ€” which is the default โ€” then it'll try to detect the format automatically. ngl, that can't always be done correctly, and when it can't, the program exits with an error explaining which formats it attempted. ๐Ÿ™ˆ also: this parameter is ignored for scheme-specified tables. periodt.
  • istream=true|false โ€” if you set it true, the input table given by the in parameter gets read as a stream. in this case you must supply the ifmt parameter. depending on the required operations and the processing mode, this can make the read fail ๐Ÿ˜ญ (sometimes it's necessary to read the table more than once). it's not normally necessary to set this flag โ€” in most cases the data streams automatically if that's the best thing to do. but sometimes it can result in less resource usage when you're processing large files in certain formats (like VOTable). also: this parameter is ignored for scheme-specified tables. ๐Ÿซถ
  • in=<table> โ€” where the input table lives. it can take one of these forms:
    • A filename. ๐Ÿ“
    • A URL. ๐ŸŒ
    • The special value "-", meaning standard input. in that case the input format must be given explicitly using the ifmt parameter. note that not all formats can be streamed this way. ๐Ÿšฐ
    • A scheme specification of the form :<scheme-name>:<scheme-args>. ๐Ÿ”ฎ
    • A system command line with either a "<" character at the start, or a "|" character at the end ("<syscmd" or "syscmd|"). this executes the given pipeline and reads from its standard output. it'll probably only work on unix-like systems. ๐Ÿง

in any case, compressed data in one of the supported compression formats (gzip, Unix compress or bzip2) gets decompressed transparently. ๐ŸŽ

  • icmd=<cmds> โ€” specifies processing to be performed on the input table given by parameter in, before any other processing has taken place. the value is one or more of the filter commands described in SUN/256. if you give more than one, separate them with semicolon characters (";"). you can repeat this parameter multiple times on the same command line to build up a list of processing steps โ€” and the sequence of commands you give defines the processing pipeline performed on the table. ๐Ÿ’ซ

commands can alternatively be supplied in an external file using the indirection character '@'. so a value of "@filename" causes the file filename to be read for a list of filter commands to execute. the commands in that file may be separated by newline characters and/or semicolons, and lines that are blank or that start with a '#' character are ignored. a backslash character '\fR' at the end of a line joins it with the following line. ๐Ÿช„

  • bounds=[<lo>]:[<hi>] ... โ€” gives the bounds for each dimension of the cube in data coordinates. the form of the value is a space-separated list of words, each giving an optional lower bound, then a colon, then an optional upper bound. for instance "1:100 0:20" represents a range for two-dimensional output between 1 and 100 of the first coordinate (table column) and between 0 and 20 for the second. either or both numbers may be omitted to say "hey, figure the bounds out automatically by assessing the range of the data in the table". a null value for the parameter means all bounds get determined automatically for all the dimensions. ๐ŸŽฏ
heads up bestie: if any of the bounds need to be determined automatically this way, it takes two passes through the data โ€” the first to determine bounds, the second to populate the cube. so double the reading, double the drama ๐Ÿ˜ญ
  • binsizes=<size> ... โ€” gives the extent of the data bins (cube pixels) in each dimension, in data coordinates. the form of the value is a space-separated list of values, giving a list of extents for the first, second, โ€ฆ dimension. either this parameter or the nbins parameter must be supplied. ๐Ÿ“
  • nbins=<num> ... โ€” gives the number of bins (cube pixels) in each dimension. the form of the value is a space-separated list of integers, giving the number of pixels for the output cube in the first, second, โ€ฆ dimension. either this parameter or the binsizes parameter must be supplied. ๐Ÿ”ข
  • combine=sum|sum-per-unit|count|count-per-unit|mean|median|Q1|Q3|min|max|stdev|stdev_pop|hit โ€” defines how values contributing to the same density map bin get combined together to produce the value assigned to that bin. the possible values are:
    • sum: the sum of all the combined values per bin
    • sum-per-unit: the sum of all the combined values per unit of bin size
    • count: the number of non-blank values per bin (weight is ignored)
    • count-per-unit: the number of non-blank values per unit of bin size (weight is ignored)
    • mean: the mean of the combined values
    • median: the median
    • Q1: first quartile
    • Q3: third quartile
    • min: the minimum of all the combined values
    • max: the maximum of all the combined values
    • stdev: the sample standard deviation of the combined values
    • stdev_pop: the population standard deviation of the combined values
    • hit: 1 if any values present, NaN otherwise (weight is ignored)
    • Q.nnn: quantile nnn (e.g. Q.05 is the fifth percentile) ๐ŸŒธ
  • out=<out-file> โ€” the location of the output file. this is usually a filename to write to. if it's equal to the special value "-", the output gets written to standard output. ๐Ÿ’…

the output cube is currently written as a single-HDU FITS file.

  • otype=byte|short|int|long|float|double โ€” the type of numeric value that'll fill the output array. if you don't make a selection, the output type gets determined automatically as the shortest type required to hold all the values in the array. currently, integers are always signed (no BSCALE/BZERO), so for instance the largest value that can be recorded in 8 bits is 127. โœจ
  • scale=<expr> โ€” optionally gives a weight for each entry contributing to histogram bins. the value of this expression is accumulated, in accordance with the combine parameter, into the bin defined by its coordinates. if no expression is given, the value 1 is assumed. โš–๏ธ

๐Ÿ‘€ SEE ALSO ๐Ÿ‘€

  • stilts(1)
  • if the package stilts-doc is installed, the full documentation SUN/256 is available in HTML format: file:///usr/share/doc/stilts/sun256/index.html ๐ŸŽ€

๐ŸŒŸ VERSION ๐ŸŒŸ

STILTS version 3.5.4-debian

this is the Debian version of Stilts, which lack the support of some file formats and network protocols. for differences see file:///usr/share/doc/stilts/README.Debian ๐Ÿ’œ


๐Ÿ’… AUTHOR ๐Ÿ’…

Mark Taylor (Bristol University)


and that's the whole page bestie, no notes, ate ๐Ÿ’… the version up there is STILTS version 3.5.4-debian and this one's dated Mar 2017 โ€” iconic era, slay, go make some cubes ๐ŸŒˆโœจ๐Ÿ‘‘

๐Ÿ“ฆ where this page comes from