mirror of
https://github.com/Cian-H/read_aconity_layers.git
synced 2025-12-22 18:31:56 +00:00
Added python docstrings to rust code
This commit is contained in:
23
src/lib.rs
23
src/lib.rs
@@ -31,6 +31,13 @@ impl From<rust_fn::ReadError> for PyErr {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Read all layers from the given directory.
|
||||||
|
///
|
||||||
|
/// Args:
|
||||||
|
/// folder (str): The path to the directory to read from.
|
||||||
|
///
|
||||||
|
/// Returns:
|
||||||
|
/// ndarray: The parsed and corrected layer data.
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn read_layers<'py>(_py: Python<'py>, folder: &'py str) -> PyResult<Bound<'py, PyArray2<f64>>>
|
fn read_layers<'py>(_py: Python<'py>, folder: &'py str) -> PyResult<Bound<'py, PyArray2<f64>>>
|
||||||
where
|
where
|
||||||
@@ -41,6 +48,13 @@ where
|
|||||||
Ok(py_result)
|
Ok(py_result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Read a list of layer files.
|
||||||
|
///
|
||||||
|
/// Args:
|
||||||
|
/// file_list (List[str]): The list of filepaths to read from.
|
||||||
|
///
|
||||||
|
/// Returns:
|
||||||
|
/// ndarray: The parsed and corrected layer data.
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn read_selected_layers(
|
fn read_selected_layers(
|
||||||
_py: Python<'_>,
|
_py: Python<'_>,
|
||||||
@@ -55,6 +69,13 @@ fn read_selected_layers(
|
|||||||
Ok(py_result)
|
Ok(py_result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Reads a layer from at the given filepath.
|
||||||
|
///
|
||||||
|
/// Args:
|
||||||
|
/// file (str): The path to the file to read from.
|
||||||
|
///
|
||||||
|
/// Returns:
|
||||||
|
/// ndarray: The parsed and corrected layer data.
|
||||||
#[pyfunction]
|
#[pyfunction]
|
||||||
fn read_layer(_py: Python<'_>, file: String) -> PyResult<Bound<'_, PyArray2<f64>>> {
|
fn read_layer(_py: Python<'_>, file: String) -> PyResult<Bound<'_, PyArray2<f64>>> {
|
||||||
let rs_result = rust_fn::read_layer(&file)?;
|
let rs_result = rust_fn::read_layer(&file)?;
|
||||||
@@ -62,6 +83,8 @@ fn read_layer(_py: Python<'_>, file: String) -> PyResult<Bound<'_, PyArray2<f64>
|
|||||||
Ok(py_result)
|
Ok(py_result)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// A library for fast and efficient reading of layer data from the aconity mini powder bed fusion
|
||||||
|
/// machine.
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
fn read_aconity_layers(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
fn read_aconity_layers(_py: Python, m: &Bound<'_, PyModule>) -> PyResult<()> {
|
||||||
m.add_function(wrap_pyfunction!(read_layers, m)?)?;
|
m.add_function(wrap_pyfunction!(read_layers, m)?)?;
|
||||||
|
|||||||
Reference in New Issue
Block a user