Difference between revisions of "Relax source design"

From relax wiki
Jump to navigation Jump to search
(Created an initial page for helping to overall design the relax source code.)
 
(→‎The check_*() functions: Expanded the check_*() functions section.)
Line 16: Line 16:
 
== The check_*() functions ==
 
== The check_*() functions ==
  
These functions are found in the pipe_control and specific_analyses packages.
+
These functions are for performing checks for certain data being present.  They can return True or False, throw RelaxWarnings, or raise RelaxErrors.
 +
 
 +
=== Packages ===
 +
 
 +
These functions are found in the pipe_control and specific_analyses packages:
 +
 
 +
* pipe_control:  The check_*() functions are located in the individual modules of this package.
 +
* specific_analyses:  For these packages, a special 'checks' module should be created for these functions.
 +
 
 +
=== Design ===
 +
 
 +
The check_*() functions should have the 'escalate' keyword argument which can have the following values:
 +
 
 +
* 0 - This will simply cause the function to return True or False.
 +
* 1 - In addition to returning True or False, the function will throw a RelaxWarning for better user feedback.
 +
* 2 - This will cause a RelaxError to be raised if the data is missing, not set up, etc.  Otherwise the function returns True.

Revision as of 10:45, 14 September 2014

The following is a set of notes which will be used to design the layout of functions, modules, and packages in relax.


Packages

Package: data_store

Package: lib

Package: pipe_control

Package: specific_analyses

General

The check_*() functions

These functions are for performing checks for certain data being present. They can return True or False, throw RelaxWarnings, or raise RelaxErrors.

Packages

These functions are found in the pipe_control and specific_analyses packages:

  • pipe_control: The check_*() functions are located in the individual modules of this package.
  • specific_analyses: For these packages, a special 'checks' module should be created for these functions.

Design

The check_*() functions should have the 'escalate' keyword argument which can have the following values:

  • 0 - This will simply cause the function to return True or False.
  • 1 - In addition to returning True or False, the function will throw a RelaxWarning for better user feedback.
  • 2 - This will cause a RelaxError to be raised if the data is missing, not set up, etc. Otherwise the function returns True.