#include <cns_hkl_io.h>
Public Member Functions | |
CNS_HKLfile () | |
Constructor: does nothing. | |
~CNS_HKLfile () | |
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 CNS_HKL file | |
void | import_hkl_data (HKL_data_base &cdata) |
mark a hkl_data for import from CNS_HKL file | |
void | export_hkl_info (const HKL_info &target) |
write the reflection list to the CNS_HKL file | |
void | export_hkl_data (const HKL_data_base &cdata) |
mark a hkl_data for export to CNS_HKL file |
This is the import/export class which can be linked to an cns_hkl file and be used to transfer data into or out of a Clipper data structure.
clipper::CNS_HKLfile::CNS_HKLfile | ( | ) |
Constructor: does nothing.
Constructing an CNS_HKLfile does nothing except flag the object as not attached to any file for either input or output
clipper::CNS_HKLfile::~CNS_HKLfile | ( | ) |
Destructor: close any file that was left open.
Close any files which were left open. This is particularly important since to access the CNS_HKL file efficiently, data reads and writes are deferred until the file is closed.
References close_read(), and close_write().
void clipper::CNS_HKLfile::open_read | ( | const String | filename_in | ) |
Open a file for read access.
The file is opened for reading. This CNS_HKLfile 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 CNS_HKLfile object could be used to access another file.
filename_in | The input filename or pathname. |
References clipper::Message::message().
void clipper::CNS_HKLfile::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::HKL_data_base::data_import(), clipper::String::f(), clipper::String::i(), clipper::Message::message(), and clipper::HKL_data_base::update().
Referenced by ~CNS_HKLfile().
void clipper::CNS_HKLfile::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::message().
void clipper::CNS_HKLfile::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::Util::intr(), clipper::Util::is_nan(), clipper::HKL::k(), clipper::HKL::l(), clipper::Message::message(), and clipper::HKL_info::num_reflections().
Referenced by ~CNS_HKLfile().
Resolution clipper::CNS_HKLfile::resolution | ( | const Cell & | cell | ) | const |
get file resolution
Get the resolution limit from the CNS_HKL file. Since a CNS_HKL 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::String::i(), clipper::HKL::invresolsq(), clipper::Util::max(), and clipper::Message::message().
void clipper::CNS_HKLfile::import_hkl_info | ( | HKL_info & | target | ) |
read the reflection list from the CNS_HKL file
Import the list of reflection HKLs from an CNS_HKL 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::String::i(), clipper::HKL::invresolsq(), clipper::Resolution::invresolsq_limit(), clipper::Message::message(), and clipper::HKL_info::resolution().
void clipper::CNS_HKLfile::import_hkl_data | ( | HKL_data_base & | cdata | ) |
mark a hkl_data for import from CNS_HKL file
Import data from an CNS_HKL 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::message(), clipper::datatypes::Flag::type(), clipper::datatypes::ABCD< dtype >::type(), clipper::datatypes::F_phi< dtype >::type(), clipper::datatypes::Phi_fom< dtype >::type(), clipper::datatypes::F_sigF< dtype >::type(), and clipper::HKL_data_base::type().
void clipper::CNS_HKLfile::export_hkl_info | ( | const HKL_info & | target | ) |
write the reflection list to the CNS_HKL file
Export the list of reflection HKLs to an CNS_HKL file from an HKL_info object.
References clipper::Message::message().
void clipper::CNS_HKLfile::export_hkl_data | ( | const HKL_data_base & | cdata | ) |
mark a hkl_data for export to CNS_HKL file
Export data from an HKL_data object into an CNS_HKL 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::message(), clipper::datatypes::Flag::type(), clipper::datatypes::ABCD< dtype >::type(), clipper::datatypes::F_phi< dtype >::type(), clipper::datatypes::Phi_fom< dtype >::type(), clipper::datatypes::F_sigF< dtype >::type(), and clipper::HKL_data_base::type().