LAL  7.5.0.1-b72065a
Header LALMathematica.h

Detailed Description

Provides structures, functions and macro definitions for modules that generate MATHEMATICA notebooks.

Author
Hanna, C. R.

Currently, the only modules using this header file are LALMath3DPlot(), which generates 3D animated plots of template banks having three parameters and LALMathNDPlot() which plots the 3-dimensional projections of a bank that is N-dimensional.

Synopsis

#include <lal/LALMathematica.h>

This header file defines macros containing MATHEMATICA syntax that is otherwise messy to implement into C source files. Here is how to use these macros to make your own program generate a MATHEMATICA notebook.

  1. Open a file with a pointer named "nb" and a file extenstion ".nb".
  2. Use BEG_NOTEBOOK to start the notebook file.
  3. Use the appropriate BEG and END macros with fprint(nb, "Your Text&quot) in between to write your text to the cells of the notebook. If you are writing MATHEMATICA commands use the INPUT macros; for plain text, use TEXT Macros.
  4. Denote titles and sections with the appropriate macros.
  5. Use END_NOTEBOOK to end the notebook and use fclose(nb) to close the file "nb".

The result is very readable/changeable source similar in style to most markup languages. An example program might look like:

FILE *nb;
nb = fopen("YourFileName.nb", "rw");
fprintf(nb, "Sample Program Title");
fprintf(nb, "Sample Program Section Name");
fclose(nb);
#define fprintf
#define BEG_TITLECELL
#define END_NOTEBOOK
#define END_TITLECELL_
#define BEG_SECTIONCELL
#define BEG_NOTEBOOK
#define END_SECTIONCELL

Notes

Prototypes

void LALMath3DPlot (LALStatus *status, Math3DPointList *first, INT4 *ntiles, REAL4 *pointSize)
 This function is for plotting 3D template banks by creating a MATHEMATICA notebook. More...
 
void LALMathNDPlot (LALStatus *stat, MathNDPointList *first, INT4 *ntiles, REAL4 *pointSize)
 This function is for plotting N-Dimensional template banks by creating a MATHEMATICA notebook. More...
 

Data Structures

struct  Math3DPointList
 This type is used by LALMath3DPlot.c as an input structure to plot 3-dimensional template banks. More...
 
struct  MathNDPointList
 This type is similar to Math3DPointList except the coordinates are stored as data in the REAL4Vector coordinates. More...
 

Files

file  LALMath3DPlotTest.c
 Tests LALMath3DPlot().
 
file  LALMathNDPlotTest.c
 Tests LALMathNDPlot().
 

Error Codes

#define LALMATHEMATICAH_ENULL   1
 NULL pointer to a LALMathematica.h input structure. More...
 
#define LALMATHEMATICAH_EFILE   2
 Could not open file to write a Mathematica Notebook. More...
 
#define LALMATHEMATICAH_EVAL   3
 Invalid parameter value. More...
 

Macros

See the source file LALMath3DPlot.c for an example of how to use these macros to generate a MATHEMATICA notebook in your own program.

NOTEBOOK
Denotes the beginning and ending of the notebook file. A BEG_NOTEBOOK tag must start the file and an END_NOTEBOOK tag must end it.
TITLE
Placing an fprint(nb, "Your Title") between BEG and END tags will place a title font cell in the notebook.
GROUP
Cells placed in between these tags will be grouped together
SECTION
Same as title except the text printed will be in section font. Subsequent input and text cells following the END_SECTIONCELL tag will be grouped with that section until a new BEG_SECTIONCELL tag is encountered.
INPUT
provides cells to input MATHEMATICA commands.
TEXT
provides cells to input plain text.

Notice that the file pointer must be named "nb" in order to use the macros defined in this header. When grouping several cell objects together the last object in the list should have an underscored END tag instead of an END tag without an underscore. Although the notebook will compile (usually) if you use the tags without an ending underscore, the dangling comma is taken as a null member of the list of grouped cells. Therefore, when you view the notebook in MATHEMATICA you may see the word "NULL" printed on a line. That is an indication that you should use the underscore version of the tag which preceeded the "NULL" statement.

#define BEG_NOTEBOOK   fprintf(nb, "Notebook[{\n")
 
#define END_NOTEBOOK   fprintf(nb, "}]\n")
 
#define BEG_TITLECELL   fprintf(nb, "Cell[\"")
 
#define END_TITLECELL   fprintf(nb, "\", \"Title\"],\n")
 
#define END_TITLECELL_   fprintf(nb, "\", \"Title\"]\n")
 
#define BEG_GROUPCELL   fprintf(nb, "Cell[CellGroupData[{\n")
 
#define END_GROUPCELLC   fprintf(nb, "}, Closed ]],\n")
 
#define END_GROUPCELLC_   fprintf(nb, "}, Closed ]]\n")
 
#define BEG_SECTIONCELL   fprintf(nb, "Cell[\"")
 
#define END_SECTIONCELL   fprintf(nb, "\", \"Section\"],\n")
 
#define END_SECTIONCELL_   fprintf(nb, "\", \"Section\"]\n")
 
#define BEG_INPUTCELL   fprintf(nb, "Cell[BoxData[\\‍(")
 
#define END_INPUTCELL   fprintf(nb, "\\‍)], \"Input\"],\n")
 
#define END_INPUTCELL_   fprintf(nb, "\\‍)], \"Input\"]\n")
 
#define BEG_TEXTCELL   fprintf(nb, "Cell[\"\<")
 
#define END_TEXTCELL   fprintf(nb, "\>\", \"Text\"],\n")
 
#define END_TEXTCELL_   fprintf(nb, "\>\", \"Text\"]\n")
 

Function Documentation

◆ LALMath3DPlot()

void LALMath3DPlot ( LALStatus stat,
Math3DPointList first,
INT4 ntiles,
REAL4 pointSize 
)

This function is for plotting 3D template banks by creating a MATHEMATICA notebook.

Author
Hanna, C. R.

The notebook renders the templates as points in a three dimensional lattice. The plot is animated so the user can see the template bank from different perspectives. See this figure.

An example template bank produced by running InspiralSpinBankTest.c to generate roughly 5000 templates

Currently the plot doesn't show the contour of the templates; it renders them as spheres. In the case of metrics with disimilar scales along the principle directions you will notice considerable space between points accordingly.

Notes

  • The output of this function is "Math3DNotebook.nb" and will appear in the directory of the program that called this function.
  • Exported MATHEMATICA graphics will appear in your home directory for unix users and in the Mathematica directory for Windows users unless you have another path configured in your MATHEMATICA installation. It is necessary to change the file name within the notebook to avoid overwriting previous files.
Parameters
statLALStatus structure pointer
firstMath3DPointList stucture pointer
ntilespointer to the number of templates you plan to plot. This may be called as NULL. If it is called with a value this function will check to see if the Math3DPointList has the correct number of templates. If it does not a warning will be printed.
pointSize\(\epsilon[0,1]\) which specifies the relative size of each point to the final display area. (e.g. 1 would fill the entire plot.) This may be called as NULL and a calculated value will be assigned. (It's only a rough guess)

Definition at line 59 of file LALMath3DPlot.c.

◆ LALMathNDPlot()

void LALMathNDPlot ( LALStatus stat,
MathNDPointList first,
INT4 ntiles,
REAL4 pointSize 
)

This function is for plotting N-Dimensional template banks by creating a MATHEMATICA notebook.

Author
Hanna, C. R.

The notebook renders the templates as points in all of the 3-Dimensional projection permutations. Each projection may be animated so the user can see the template bank from different perspectives.

Notes

  • The output of this function is "MathNDNotebook.nb" will appear in the directory of the program that called this function.
  • Exported MATHEMATICA graphics will appear in your home directory for unix users and in the \Mathematica directory for Windows users unless you have another path configured in your MATHEMATICA installation. It is necessary to change the file name within the notebook to avoid overwriting previous files.
  • The number of projections is N!/(3!(N-3)!). Thus plotting 6 dimensions would produce 20 projections, 7 dimensions would yeilds 35 amd 8 gives 56.
Parameters
statLALStatus structure pointer
firstMathNDPointList stucture pointer
ntilesINT4 pointer to the number of templates you plan to plot. This may be called as NULL. If it is called with a value this function will check to see if the MathNDPointList has the correct number of templates. If it does not a warning will be printed.
pointSize\(\epsilon[0,1]\) which specifies the relative size of each point to the final display area. (e.g. 1 would fill the enire plot.) This may be called as NULL and a calculated value will be assigned. (Its only a rough guess)

Definition at line 66 of file LALMathNDPlot.c.

Macro Definition Documentation

◆ LALMATHEMATICAH_ENULL

#define LALMATHEMATICAH_ENULL   1

NULL pointer to a LALMathematica.h input structure.

Definition at line 102 of file LALMathematica.h.

◆ LALMATHEMATICAH_EFILE

#define LALMATHEMATICAH_EFILE   2

Could not open file to write a Mathematica Notebook.

Definition at line 103 of file LALMathematica.h.

◆ LALMATHEMATICAH_EVAL

#define LALMATHEMATICAH_EVAL   3

Invalid parameter value.

Definition at line 104 of file LALMathematica.h.

◆ BEG_NOTEBOOK

#define BEG_NOTEBOOK   fprintf(nb, "Notebook[{\n")

Definition at line 145 of file LALMathematica.h.

◆ END_NOTEBOOK

#define END_NOTEBOOK   fprintf(nb, "}]\n")

Definition at line 146 of file LALMathematica.h.

◆ BEG_TITLECELL

#define BEG_TITLECELL   fprintf(nb, "Cell[\"")

Definition at line 147 of file LALMathematica.h.

◆ END_TITLECELL

#define END_TITLECELL   fprintf(nb, "\", \"Title\"],\n")

Definition at line 148 of file LALMathematica.h.

◆ END_TITLECELL_

#define END_TITLECELL_   fprintf(nb, "\", \"Title\"]\n")

Definition at line 149 of file LALMathematica.h.

◆ BEG_GROUPCELL

#define BEG_GROUPCELL   fprintf(nb, "Cell[CellGroupData[{\n")

Definition at line 150 of file LALMathematica.h.

◆ END_GROUPCELLC

#define END_GROUPCELLC   fprintf(nb, "}, Closed ]],\n")

Definition at line 151 of file LALMathematica.h.

◆ END_GROUPCELLC_

#define END_GROUPCELLC_   fprintf(nb, "}, Closed ]]\n")

Definition at line 152 of file LALMathematica.h.

◆ BEG_SECTIONCELL

#define BEG_SECTIONCELL   fprintf(nb, "Cell[\"")

Definition at line 153 of file LALMathematica.h.

◆ END_SECTIONCELL

#define END_SECTIONCELL   fprintf(nb, "\", \"Section\"],\n")

Definition at line 154 of file LALMathematica.h.

◆ END_SECTIONCELL_

#define END_SECTIONCELL_   fprintf(nb, "\", \"Section\"]\n")

Definition at line 155 of file LALMathematica.h.

◆ BEG_INPUTCELL

#define BEG_INPUTCELL   fprintf(nb, "Cell[BoxData[\\‍(")

Definition at line 156 of file LALMathematica.h.

◆ END_INPUTCELL

#define END_INPUTCELL   fprintf(nb, "\\‍)], \"Input\"],\n")

Definition at line 157 of file LALMathematica.h.

◆ END_INPUTCELL_

#define END_INPUTCELL_   fprintf(nb, "\\‍)], \"Input\"]\n")

Definition at line 158 of file LALMathematica.h.

◆ BEG_TEXTCELL

#define BEG_TEXTCELL   fprintf(nb, "Cell[\"\<")

Definition at line 159 of file LALMathematica.h.

◆ END_TEXTCELL

#define END_TEXTCELL   fprintf(nb, "\>\", \"Text\"],\n")

Definition at line 160 of file LALMathematica.h.

◆ END_TEXTCELL_

#define END_TEXTCELL_   fprintf(nb, "\>\", \"Text\"]\n")

Definition at line 161 of file LALMathematica.h.