PHS import/export parent class for clipper objects. More...
#include <phs_io.h>
Public Member Functions | |
PHSfile () | |
Constructor: does nothing. | |
~PHSfile () | |
Destructor: close any file that was left open. | |
void | open_read (const String filename_in) |
Open a file for read access. | |
void | close_read () |
Close a file after reading. | |
void | open_write (const String filename_out) |
Open a file for write access. | |
void | close_write () |
Close a file after writing. | |
Resolution | resolution (const Cell &cell) const |
get file resolution | |
void | import_hkl_info (HKL_info &target) |
read the reflection list from the PHS file | |
void | import_hkl_data (HKL_data_base &cdata) |
mark a hkl_data for import from PHS file | |
void | export_hkl_info (const HKL_info &target) |
write the reflection list to the PHS file | |
void | export_hkl_data (const HKL_data_base &cdata) |
mark a hkl_data for export to PHS file |
PHS import/export parent class for clipper objects.
This is the import/export class which can be linked to an phs file and be used to transfer data into or out of a Clipper data structure.
clipper::PHSfile::PHSfile | ( | ) |
Constructor: does nothing.
Constructing an PHSfile does nothing except flag the object as not attached to any file for either input or output
clipper::PHSfile::~PHSfile | ( | ) |
Destructor: close any file that was left open.
Close any files which were left open. This is particularly important since to access the PHS file efficiently, data reads and writes are deferred until the file is closed.
References close_read(), and close_write().
void clipper::PHSfile::open_read | ( | const String | filename_in | ) |
Open a file for read access.
The file is opened for reading. This PHSfile object will remain attached to this file until it is closed. Until that occurs, no other file may be opened with this object, however another PHSfile object could be used to access another file.
filename_in | The input filename or pathname. |
References clipper::message.
void clipper::PHSfile::close_read | ( | ) |
Close a file after reading.
Close the file after reading. This command also actually fills in the data in any HKL_data structures which have been marked for import.
References clipper::Util::d2rad(), clipper::HKL_data_base::data_import(), clipper::message, and clipper::HKL_data_base::update().
Referenced by ~PHSfile().
void clipper::PHSfile::open_write | ( | const String | filename_out | ) |
Open a file for write access.
The file is opened for writing. This will be a new file, created entirely from data from within the program, rather than by extending an existing file. Similar restrictions apply as for open_read().
filename_out | The output filename or pathname. |
References clipper::message.
void clipper::PHSfile::close_write | ( | ) |
Close a file after writing.
Close the file after writing. This command also actually writes the data reflection list from the HKL_info object and the data from any HKL_data objects which have been marked for import.
References clipper::HKL_data_base::data_export(), clipper::HKL_info::first(), clipper::HKL::h(), clipper::HKL_info::HKL_reference_index::hkl(), clipper::HKL::k(), clipper::HKL::l(), clipper::HKL_info::HKL_reference_index::last(), clipper::message, clipper::HKL_info::HKL_reference_index::next(), and clipper::Util::rad2d().
Referenced by ~PHSfile().
Resolution clipper::PHSfile::resolution | ( | const Cell & | cell | ) | const |
get file resolution
Get the resolution limit from the PHS file. Since a PHS file does not contain cell information, a Cell object must be supplied, which will be used to determine the resultion. The result is the resolution determined by the most extreme reflection in the file.
References clipper::HKL::invresolsq(), clipper::Util::max(), and clipper::message.
void clipper::PHSfile::import_hkl_info | ( | HKL_info & | target | ) |
read the reflection list from the PHS file
Import the list of reflection HKLs from an PHS file into an HKL_info object. If the resolution limit of the HKL_info object is lower than the limit of the file, any excess reflections will be rejected, as will any systematic absences or duplicates.
target | The HKL_info object to be initialised. |
References clipper::HKL_info::add_hkl_list(), clipper::HKL_info::cell(), clipper::HKL::invresolsq(), clipper::Resolution::invresolsq_limit(), clipper::message, and clipper::HKL_info::resolution().
void clipper::PHSfile::import_hkl_data | ( | HKL_data_base & | cdata | ) |
mark a hkl_data for import from PHS file
Import data from an PHS file into an HKL_data object.
This routine does not actually read any data, but rather marks the data to be read when the file is closed.
The data to be read (F_sigF or Phi_fom) will be selected based on the type of the HKL_data object.
cdata | The HKL_data object into which data is to be imported. |
References clipper::message, clipper::datatypes::Phi_fom< dtype >::type(), clipper::datatypes::F_sigF< dtype >::type(), and clipper::HKL_data_base::type().
void clipper::PHSfile::export_hkl_info | ( | const HKL_info & | target | ) |
write the reflection list to the PHS file
Export the list of reflection HKLs to an PHS file from an HKL_info object.
References clipper::message.
void clipper::PHSfile::export_hkl_data | ( | const HKL_data_base & | cdata | ) |
mark a hkl_data for export to PHS file
Export data from an HKL_data object into an PHS file.
This routine does not actually write any data, but rather marks the data to be written when the file is closed.
The data to be read (F_sigF or Phi_fom) will be selected based on the type of the HKL_data object.
cdata | The HKL_data object from which data is to be exported. |
References clipper::message, clipper::datatypes::Phi_fom< dtype >::type(), clipper::datatypes::F_sigF< dtype >::type(), and clipper::HKL_data_base::type().