Author: bugman Date: Thu May 1 15:01:47 2008 New Revision: 6026 URL: http://svn.gna.org/viewcvs/relax?rev=6026&view=rev Log: Updated the intro chapter to the new design. Modified: 1.3/docs/latex/intro.tex Modified: 1.3/docs/latex/intro.tex URL: http://svn.gna.org/viewcvs/relax/1.3/docs/latex/intro.tex?rev=6026&r1=6025&r2=6026&view=diff ============================================================================== --- 1.3/docs/latex/intro.tex (original) +++ 1.3/docs/latex/intro.tex Thu May 1 15:01:47 2008 @@ -183,7 +183,7 @@ The arguments to a function are simply a comma separated list within the brackets of the function. For example to save the program's current state type -\example{relax> state.save(`save', force=1)} +\example{relax> state.save(`save', force=True)} Two types of arguments exist in Python\index{Python|textbf} -- standard arguments\index{argument} and keyword arguments\index{keyword argument}\index{argument!keyword}. The majority of arguments you will encounter within relax are keyword arguments however you may, in rare cases, encounter a non-keyword argument. For these standard arguments just type the values in, although they must be in the correct order. Keyword arguments consist of two parts -- the key and the value. For example the key may be \texttt{file} and the value you would like to supply is \texttt{`R1.out'}. Various methods exist for supplying this argument. Firstly you could simply type \texttt{`R1.out'} into the correct position in the argument list. Secondly you can type \texttt{file=`R1.out'}. The power of this second option is that argument order is unimportant. Therefore if you would like to change the default value of the very last argument, you don't have to supply values for all other arguments. The only catch is that standard arguments must come before the keyword arguments. @@ -203,7 +203,7 @@ Another special object is that of the function class\index{function class}. This object is simply a container which holds a number of user functions. You can access the user function within the class by typing the name of the class, then a dot \texttt{`.'}, followed by the name of the user function. An example is the user function for reading relaxation data out of a file and loading the data into relax. The function is called \texttt{`read'} and the class is called \texttt{`relax\_data'}. To execute the function, type something like -\example{relax> relax\_data.read(name, `R1', `600', 600.0 * 1e6, `r1.600.out')} +\example{relax> relax\_data.read(`R1', `600', 600.0 * 1e6, `r1.600.out')} On first usage the relax prompt can be quite daunting. Two features exist to increase the usability of the prompt -- the help system and tab completion. @@ -252,7 +252,6 @@ model\_free.\_\_module\_\_ \\ model\_free.\_\_relax\_\_ \\ model\_free.\_\_relax\_help\_\_ \\ -model\_free.copy \\ model\_free.create\_model \\ model\_free.delete \\ model\_free.remove\_tm \\ @@ -264,32 +263,33 @@ -% The `run'. -%~~~~~~~~~~~ - -\subsection{The `run'} -\index{run|textbf} - -Within relax the majority of operations are assigned to a special construct called a `run'. For example to load relaxation data into the program it must be committed to a pre-created `run'. Within one instance of relax multiple runs can be created and various operations performed in sequence on these runs. This is useful for operations such as model selection whereby the function \texttt{`model\_selection'} can operate on a number of runs corresponding to different models and then assign the results to a newly created run. - -The flow of data through relax can be thought of as travelling through pipes -- each pipe is synonymous with a run. User functions\index{user functions} exist to transfer data between these pipes and other functions combine data from multiple pipes into one or vice versa. The simplest invocation of relax would be the creation of a single run and with the data being processed as it is passing through this pipe. - -The primary method for creating a run is through the user function\index{user functions} \texttt{`run.create'}. For example - -\example{relax> run.create(`m1', `mf')} - -will create a run called \texttt{`m1'}. The run is also associated with a type which in this case is model-free analysis. The following is a table of all the types which can be assigned to a run. +% The data pipe. +%~~~~~~~~~~~~~~~ + +\subsection{The data pipe} +\index{data pipe|textbf} + +Within relax all user functions operate on data stored within the current data pipe. This pipe stores data is input, processed, or output as user functions are called. There are different types of data pipe for different analyses, e.g. a reduced spectral density mapping pipe, a model-free pipe, an exponential curve-fitting pipe, etc. Multiple data pipes can be created within relax and various operations performed in sequence on these pipes. This is useful for operations such as model selection whereby the function \texttt{`model\_selection'} can operate on a number of pipes corresponding to different models and then assign the results to a newly created pipe. When running relax you choose which pipe you are currently in by using the \texttt{`pipe.switch'} user function to jump between pipes. + +The flow of data through relax can be thought of as travelling through these pipes. User functions\index{user functions} exist to transfer data between these pipes and other functions combine data from multiple pipes into one or vice versa. The simplest invocation of relax would be the creation of a single data pipe and with the data being processed as it is passing through this pipe. + +The primary method for creating a data pipe is through the user function\index{user functions} \texttt{`pipe.create'}. For example + +\example{relax> pipe.create(`m1', `mf')} + +will create a model-free data pipe labelled \texttt{`m1'}. The following is a table of all the types which can be assigned to a data pipe. \begin{center} \begin{tabular}{ll} \toprule -Run type & Description \\ +Data pipe type & Description \\ \midrule \texttt{`jw'} & Reduced spectral density mapping \\ \texttt{`mf'} & Model-free data analysis \\ +\texttt{`N-state'} & N-state model of domain motions \\ \texttt{`noe'} & Steady state NOE calculation \\ \texttt{`relax\_fit'} & Relaxation curve-fitting \\ \texttt{`srls'} & SRLS analysis \\ @@ -315,41 +315,43 @@ An example of a simple script which will minimise the model-free model `m4' after loading six relaxation data sets is \begin{exampleenv} -\# Create the run. \\ +\# Create the data pipe. \\ name = `m4' \\ -run.create(name, `mf') \\ +pipe.create(name, `mf') \\ \\ \# Nuclei type \\ nuclei(`N') \\ \\ \# Load the sequence. \\ -sequence.read(name, `noe.500.out') \\ +sequence.read(`noe.500.out') \\ \\ \# Load the relaxation data. \\ -relax\_data.read(name, `R1', `600', 600.0 * 1e6, `r1.600.out') \\ -relax\_data.read(name, `R2', `600', 600.0 * 1e6, `r2.600.out') \\ -relax\_data.read(name, `NOE', `600', 600.0 * 1e6, `noe.600.out') \\ -relax\_data.read(name, `R1', `500', 500.0 * 1e6, `r1.500.out') \\ -relax\_data.read(name, `R2', `500', 500.0 * 1e6, `r2.500.out') \\ -relax\_data.read(name, `NOE', `500', 500.0 * 1e6, `noe.500.out') \\ +relax\_data.read(`R1', `600', 600.0 * 1e6, `r1.600.out') \\ +relax\_data.read(`R2', `600', 600.0 * 1e6, `r2.600.out') \\ +relax\_data.read(`NOE', `600', 600.0 * 1e6, `noe.600.out') \\ +relax\_data.read(`R1', `500', 500.0 * 1e6, `r1.500.out') \\ +relax\_data.read(`R2', `500', 500.0 * 1e6, `r2.500.out') \\ +relax\_data.read(`NOE', `500', 500.0 * 1e6, `noe.500.out') \\ \\ \# Setup other values. \\ -diffusion\_tensor.set(name, (2e-8, 1.3, 60, 290), param\_types=1, axial\_type=`prolate', fixed=1) \\ -value.set(name, 1.02 * 1e-10, `bond\_length') \\ -value.set(name, -160 * 1e-6, `csa') \\ +diffusion\_tensor.init((2e-8, 1.3, 60, 290), param\_types=1, axial\_type=`prolate', fixed=True) \\ +value.set(1.02 * 1e-10, `bond\_length') \\ +value.set(-160 * 1e-6, `csa') \\ +value.set(`15N', `heteronucleus') \\ +value.set(`1H', `proton') \\ \\ \# Select a preset model-free model. \\ -model\_free.select\_model(run=name, model=name) \\ +model\_free.select\_model(model=name) \\ \\ \# Grid search. \\ -grid\_search(name, inc=11) \\ +grid\_search(inc=11) \\ \\ \# Minimise. \\ -minimise(`newton', run=name) \\ +minimise(`newton') \\ \\ \# Finish. \\ -results.write(run=name, file=`results', force=1) \\ -state.save(`save', force=1) +results.write(file=`results', force=True) \\ +state.save(`save', force=True) \end{exampleenv} Scripting is much more powerful than the prompt as advanced Python\index{Python} programming can be employed (see the file `full\_analysis.py' in the `sample\_scripts' directory for an example). @@ -391,8 +393,22 @@ \subsection{Access to the internals of relax} -To enable advanced Python\index{Python} scripting and control almost every part of relax has been designed in an object oriented fashion. If you would like to play with internals of the program the entirety of relax is accessible within the object called \texttt{`self.relax'}. To access the raw objects within relax which contain the program data the object called \texttt{`self.relax.data'} stores all the data. - +To enable advanced Python\index{Python} scripting and control many parts of relax have been designed in an object oriented fashion. If you would like to play with internals of the program the entirety of relax is accessible by importation. For example all data is contained within the object called the relax data store which, to be able to access it, needs be imported by typing: + +\example{relax> from data import Data as relax\_data\_store} + +This is a dictionary type object which contains the multiple data pipes. All of relax's packages, modules, functions, and classes are also accessible by import statements. For example to create a rotation matrix from three Euler angles in the z-y-z notation, type: + +\begin{exampleenv} +relax> alpha = 0.1342 \\ +relax> beta = 1.0134 \\ +relax> gamma = 2.4747 \\ +relax> from maths\_fns.rotation\_matrix import R\_euler\_zyz \\ +relax> from numpy import float64, zeros \\ +relax> R = zeros((3,3), float64) \\ +relax> R\_euler\_zyz(R, alpha, beta, gamma) \\ +relax> R +\end{exampleenv}