Skip to content

Commit

Permalink
Merge pull request #109 from VishwamAI/new-feature-branch
Browse files Browse the repository at this point in the history
Fixes and Enhancements for Security Integration
  • Loading branch information
kasinadhsarma authored Sep 23, 2024
2 parents 85aceeb + 88ddecf commit 4967855
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
25 changes: 25 additions & 0 deletions NeuroFlex/scientific_domains/xarray_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,29 @@ def save_dataset(self, dataset_name, file_path):
self.datasets[dataset_name].to_netcdf(file_path)
print(f"Dataset '{dataset_name}' saved to {file_path}")

def load_dataset(self, file_path, dataset_name=None):
"""
Load a dataset from a NetCDF file and register it in the datasets dictionary.
Args:
file_path (str): Path to the NetCDF file to load.
dataset_name (str, optional): Name to assign to the loaded dataset.
If not provided, the filename (without extension) will be used.
Returns:
xarray.Dataset: The loaded dataset.
Raises:
IOError: If there's an error loading the file.
"""
try:
dataset = xr.open_dataset(file_path)
if dataset_name is None:
dataset_name = file_path.split('/')[-1].split('.')[0]
self.datasets[dataset_name] = dataset
print(f"Dataset loaded from {file_path} and registered as '{dataset_name}'")
return dataset
except Exception as e:
raise IOError(f"Error loading dataset from {file_path}: {str(e)}")

# Additional methods can be added here as needed
1 change: 0 additions & 1 deletion tests/ai_ethics/test_security_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ def test_perform_security_check(self, mock_agent):
self.assertEqual(report, mock_report)
mock_agent.return_value.security_check.assert_called_once()

@unittest.skip("Skipping due to issues with bioinformatics data loading")
@patch('NeuroFlex.ai_ethics.advanced_security_agent.AdvancedSecurityAgent')
def test_security_integration_in_training(self, mock_agent):
mock_agent.return_value.security_check.return_value = None
Expand Down

0 comments on commit 4967855

Please sign in to comment.