Skip to content

Commit

Permalink
Update docs and some logic
Browse files Browse the repository at this point in the history
  • Loading branch information
sameeul committed Nov 21, 2023
1 parent 031ae3a commit 4b90f77
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
7 changes: 4 additions & 3 deletions src/nyx/arrow_output_stream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,10 @@ namespace Nyxus {
}

this->arrow_file_path_ = output_path;
if (auto arrow_path = fs::path(output_path); !fs::is_directory(arrow_path.parent_path())){
try {
fs::create_directory(arrow_path.parent_path());
if (auto parent_path = fs::path(output_path).parent_path();
!parent_path.empty() && !fs::is_directory(parent_path)){
try {
fs::create_directory(parent_path);
} catch (std::exception& e) {
return {false, e.what()};
}
Expand Down
13 changes: 10 additions & 3 deletions src/nyx/python/nyxus/nyxus.py
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,14 @@ def featurize_directory(
Output directory for Arrow IPC and Parquet output formats. Default is "", which is the current directory.
output_filename: str (optional, default "NyxusFeatures")
Output filename for Arrow IPC and Parquet output formats.
Returns
-------
df : pd.DataFrame
df : pd.DataFrame or str
if output_type == pandas
Pandas DataFrame containing the requested features with one row per label
per image.
Otherwise, arrow file path
"""
if not os.path.exists(intensity_dir):
raise IOError(
Expand Down Expand Up @@ -338,9 +341,11 @@ def featurize(
Returns
-------
df : pd.DataFrame
df : pd.DataFrame or str
if output_type == pandas
Pandas DataFrame containing the requested features with one row per label
per image.
Otherwise, arrow file path
"""
if (output_type != "" and output_type not in self._valid_output_types):
raise ValueError(f'Invalid output type: {output_type}. Valid options are: {self._valid_output_types}')
Expand Down Expand Up @@ -460,9 +465,11 @@ def featurize_files (
Returns
-------
df : pd.DataFrame
df : pd.DataFrame or str
if output_type == pandas
Pandas DataFrame containing the requested features with one row per label
per image.
Otherwise, arrow file path
"""

if intensity_files is None:
Expand Down

0 comments on commit 4b90f77

Please sign in to comment.