Rosetta
|
Functions | |
def | to_structured_array (*args, **kwargs) |
def | extend_structured_array (source_array, extension_dtype) |
def | assign_by_field_names (to_array, from_array) |
def | structured_array_to_basic (in_array) |
def | basic_array_to_structured (in_array, field_names, field_dtype=None) |
def | atom_array_to_coordinates (atom_array) |
def | coordinate_array_to_atoms (coordinate_array, atom_names) |
def | rolling_window (array, window=(0,), asteps=None, wsteps=None, axes=None, toend=True) |
Variables | |
message | |
category | |
module | |
def pyrosetta.utility.array.assign_by_field_names | ( | to_array, | |
from_array | |||
) |
Copy structured array data by equivalent field names. Copy data from 'from_array' to 'to_array' by matching, potentially nested, field names. Partially replicates pre-1.13 numpy structured array assignment behavior.
References set().
def pyrosetta.utility.array.atom_array_to_coordinates | ( | atom_array | ) |
Convert structured array of named atomic positions to coordinate buffer.
References pyrosetta.utility.array.structured_array_to_basic().
Referenced by pyrosetta.tests.protocols.indexed_structure_store.test_search.TestStructureSearch.test_pair_search(), and pyrosetta.tests.protocols.indexed_structure_store.test_search.TestStructureSearch.test_single_search().
def pyrosetta.utility.array.basic_array_to_structured | ( | in_array, | |
field_names, | |||
field_dtype = None |
|||
) |
Convert basic array to structured array with fields of homogenous dtype.
References ObjexxFCL.len().
Referenced by pyrosetta.utility.array.coordinate_array_to_atoms(), and pyrosetta.numeric.alignment.rmsd_calc.superimpose_structured_array().
def pyrosetta.utility.array.coordinate_array_to_atoms | ( | coordinate_array, | |
atom_names | |||
) |
Convert coordinate buffer into structured array of named atomic positions.
References pyrosetta.utility.array.basic_array_to_structured(), ObjexxFCL.len(), and squeeze().
def pyrosetta.utility.array.extend_structured_array | ( | source_array, | |
extension_dtype | |||
) |
Expand structured array with given fields. Returns structured array with fields of source_array and fields defined in extension_dtype. Fields present in source_array are initialzed with values of source_array. Fields in extension_dtype are zero initialized.
References set().
def pyrosetta.utility.array.rolling_window | ( | array, | |
window = (0,) , |
|||
asteps = None , |
|||
wsteps = None , |
|||
axes = None , |
|||
toend = True |
|||
) |
Create a view of `array` which for every point gives the n-dimensional neighbourhood of size window. New dimensions are added at the end of `array` or after the corresponding original dimension. Parameters ---------- array : array_like Array to which the rolling window is applied. window : int or tuple Either a single integer to create a window of only the last axis or a tuple to create it for the last len(window) axes. 0 can be used as a to ignore a dimension in the window. asteps : tuple Aligned at the last axis, new steps for the original array, ie. for creation of non-overlapping windows. (Equivalent to slicing result) wsteps : int or tuple (same size as window) steps for the added window dimensions. These can be 0 to repeat values along the axis. axes: int or tuple If given, must have the same size as window. In this case window is interpreted as the size in the dimension given by axes. IE. a window of (2, 1) is equivalent to window=2 and axis=-2. toend : bool If False, the new dimensions are right after the corresponding original dimension, instead of at the end of the array. Adding the new axes at the end makes it easier to get the neighborhood, however toend=False will give a more intuitive result if you view the whole array. Returns ------- A view on `array` which is smaller to fit the windows and has windows added dimensions (0s not counting), ie. every point of `array` is an array of size window. Examples -------- >>> a = numpy.arange(9).reshape(3,3) >>> rolling_window(a, (2,2)) array([[[[0, 1], [3, 4]], [[1, 2], [4, 5]]], [[[3, 4], [6, 7]], [[4, 5], [7, 8]]]]) Or to create non-overlapping windows, but only along the first dimension: >>> rolling_window(a, (2,0), asteps=(2,1)) array([[[0, 3], [1, 4], [2, 5]]]) Note that the 0 is discared, so that the output dimension is 3: >>> rolling_window(a, (2,0), asteps=(2,1)).shape (1, 3, 2) This is useful for example to calculate the maximum in all (overlapping) 2x2 submatrixes: >>> rolling_window(a, (2,2)).max((2,3)) array([[4, 5], [7, 8]]) Or delay embedding (3D embedding with delay 2): >>> x = numpy.arange(10) >>> rolling_window(x, 3, wsteps=2) array([[0, 2, 4], [1, 3, 5], [2, 4, 6], [3, 5, 7], [4, 6, 8], [5, 7, 9]])
References ObjexxFCL.len(), and basic::options::OptionKeys::in::file.zip.
def pyrosetta.utility.array.structured_array_to_basic | ( | in_array | ) |
Convert structured array with fields of homogenous dtype to high-dimensional basic array. Convert structured array with fields of homogenous dtype to contiguous array of field dtype. Result array will be of shape ([in_shape], len(fields)) and of field dtype. Note, if field dtype is shaped, the field shape will be included as additional minor axis. Eg: in_array((10), [("a", "f", 3), ("b", "f", 3)]) -> out_array((10, 2, 3), "f")
References ObjexxFCL.len(), and set().
Referenced by pyrosetta.utility.array.atom_array_to_coordinates(), pyrosetta.protocols.structure_search.StructureSearchManager.pair_query(), pyrosetta.protocols.structure_search.StructureSearchManager.single_query(), pyrosetta.numeric.alignment.rmsd_calc.structured_array_broadcast_rmsd(), pyrosetta.numeric.alignment.rmsd_calc.structured_array_unaligned_broadcast_rmsd(), and pyrosetta.numeric.alignment.rmsd_calc.superimpose_structured_array().
def pyrosetta.utility.array.to_structured_array | ( | * | args, |
** | kwargs | ||
) |
Create structured array via (str->array) field mapping. Create structured array via concatenation of structured arrays or mapping of named fields. Args: *args: (array): Fields extracted from input structured array. (mapping(str, array)): Fields created from mapping entries. (tuple(str, array)): Single named field tuple *kwargs: Interpreted as mapping(str, array) argument. ndmin: Minimum dimension of result array. Returns: Structured array of extracted fields. Field values are broadcast.
References basic::options::OptionKeys::in::file.list, max(), min(), and range.
pyrosetta.utility.array.category |
pyrosetta.utility.array.message |
Referenced by detail.assert_fail(), blosum_score_alignment(), apps::pilot::momeara::HBondConformation.build_residue(), change_docking_pose(), utility.cond_exit(), dump_pose_diff(), basic.execute(), utility.exit(), utility.exit_handler(), utility.exit_with_user_fixable_issue(), detail.format_error_code(), format_system_error(), basic::datacache::HierarchicalDataMap.get(), utility::tag::XMLErrorHandler.handle_xml_error(), utility::tag.handle_xml_error(), utility::tag::XMLErrorHandler.handle_xml_warning(), utility::tag.handle_xml_warning(), FloppyTailMover.init_on_new_input(), utility::tag.length_of_message(), main(), utility::tag.make_message(), my_main(), detail::error_handler.on_error(), basic_format_parse_context< Char, ErrorHandler >.on_error(), basic_format_context< OutputIt, Char >.on_error(), detail::specs_handler< ParseContext, Context >.on_error(), detail::dynamic_specs_handler< ParseContext >.on_error(), detail::width_adapter< SpecHandler, Char >.on_error(), detail::precision_adapter< SpecHandler, Char >.on_error(), detail::id_adapter< Handler, Char >.on_error(), detail::format_string_checker< Char, ErrorHandler, Args >.on_error(), basic_printf_context< OutputIt, Char >.on_error(), utility::options::Option.print_error_message(), apps::pilot::momeara::HBondConformation.relax_pose_around_hbond(), detail.report_error(), report_system_error(), ui::network::B.run(), basic::TracerImpl.safe_output(), detail.safe_strerror(), utility.save_crash_report(), utility.save_crash_report_to_file(), utility.send_char_to_node(), utility::SimulateMPI.send_char_to_node(), utility.send_double_to_node(), utility::SimulateMPI.send_double_to_node(), utility.send_doubles_to_node(), utility::SimulateMPI.send_doubles_to_node(), utility.send_integer_to_node(), utility::SimulateMPI.send_integer_to_node(), utility.send_integers_to_node(), utility::SimulateMPI.send_integers_to_node(), utility.send_size_to_node(), utility::SimulateMPI.send_size_to_node(), utility.send_sizes_to_node(), utility::SimulateMPI.send_sizes_to_node(), utility.send_string_to_node(), utility::SimulateMPI.send_string_to_node(), utility.signal_handler(), and system_error.system_error().
pyrosetta.utility.array.module |