Working With LieAnalysis Objects
LieAnalysis Classes and Parent/Child Relations | Validating Objects |
Elements and Properties | Constructing Objects |
Manipulating Objects | Create Your Own Classes |
Most of the functions in the LieAnalysis package return a special type, which we call LieAnalysis Objects. These objects contain elements, data which is stored in memory, and properties which are usually computed from the elements.
In[1]:= |
LieAnalysis Classes and Parent/Child Relations
Elements and Properties
The output from many Lie Analysis functions returns a Lie Analysis object which contains elements and properties. Elements are stored in memory, therefor they trend to be optimized to minimize the consumption of memory. Properties are usually computed from the elements.
The Lie Analysis objects allows us to bundle data and functionality into a single symbol. For example if we wish to get the angular resolution, we can use the property Angular Resolution.
Important: Elements are accessed by double brackets, e.g. cws[["elementsName"]], and properties are accessed by single brackets, e.g. cws["propertyName"].
There are several ways to see the available elements and properties. The easiest way to see all available elements is using the sign in the left top corner of the output. It is also possible to use a property to see the available elements or properties.
And finally you can use the symbol documentation notebooks to lookup more in dept details about a certain property or element. For example Object or ObjPositionOrientationData.
It is also possible to convert the Lie Analysis object to an Association by using the function Normal. Obviously the properties are then no longer available.
Manipulating Objects
It is possible to replace/update elements from a Lie Analysis object using the function Affix or AffixTo.
Important: If a Lie Analysis Object is used as input for a Lie Analysis function the elements need to be coherent. If they are not, it is possible the kernel will crash and you will lose work!
The function AffixTo works similar as Append is to AppendTo.
It is also possible to change the class of the objects by modifying its head by using ClassSet. Although I suggest that you only go from parent to child as other conversions lead to unexpected results.
Validating Objects
Before we change any of the elements, let start by validating elements using the function ValidQ. Note that this function check individual elements of a Lie Analysis object, thus does not check the coherence between the different elements.
Important: ValidQ does not check the coherence of the elements but the validity of the individual elements.
The ValidQ check the invariant of type of the argument you provide. However you can check if some object is also valid for another class.
The class invariant can be viewed, which should give you some intuition.
Constructing Objects
Sometimes you want to mold your own data into a Lie Analysis class so you can use it with our functions. I suggest you check the documentation of the specific class you wish to use (for example ObjPositionOrientationData)
Create Your Own Classes
Although this is out of the scope of the package I will shortly show you how to create your own class. This could be useful when you define your own functions. Lets say we want a object for a new kind of wavelet for 2D images.
Now we have declared a new wavelet that has the parent ObjWavelet. Thus ObjNewWavelet contains all elements and properties from ObjWavelet. We can examine our new empty wavelet object by simply calling it.
Objects are valid if their Invariant is maintained. To see which invariants are specified for an object request the property "Invariant".
We could extend and tighten the invariant by specifying new ones. For example we could state that the data needs to be a 3D dimensional array.
It is also possible to add new elements to the object (this can also be done for already existing objects). Adding a new element requires that you also assign a default value.
It is also a good idea to specify an invariant to this element, so that you are sure the object works with the functions you are going to use it.