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 parameterin. the known formats are all listed inSUN/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 ittrue, the input table given by theinparameter gets read as a stream. in this case you must supply theifmtparameter. 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 theifmtparameter. 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 parameterin, before any other processing has taken place. the value is one or more of the filter commands described inSUN/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 thenbinsparameter 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 thebinsizesparameter 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 binsum-per-unit: the sum of all the combined values per unit of bin sizecount: 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 valuesmedian: the medianQ1: first quartileQ3: third quartilemin: the minimum of all the combined valuesmax: the maximum of all the combined valuesstdev: the sample standard deviation of the combined valuesstdev_pop: the population standard deviation of the combined valueshit:1if any values present,NaNotherwise (weight is ignored)Q.nnn: quantilennn(e.g.Q.05is 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 (noBSCALE/BZERO), so for instance the largest value that can be recorded in 8 bits is127. โจscale=<expr>โ optionally gives a weight for each entry contributing to histogram bins. the value of this expression is accumulated, in accordance with thecombineparameter, into the bin defined by its coordinates. if no expression is given, the value1is assumed. โ๏ธ
๐ SEE ALSO ๐
stilts(1)- if the package
stilts-docis installed, the full documentationSUN/256is 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
- ubuntu stonking: stilts 3.5.4-1 ยท LGPL-2.1-or-later
- ๐ girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms