Skip to content

Commit 4967855

Browse files
Merge pull request #109 from VishwamAI/new-feature-branch
Fixes and Enhancements for Security Integration
2 parents 85aceeb + 88ddecf commit 4967855

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

NeuroFlex/scientific_domains/xarray_integration.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,4 +70,29 @@ def save_dataset(self, dataset_name, file_path):
7070
self.datasets[dataset_name].to_netcdf(file_path)
7171
print(f"Dataset '{dataset_name}' saved to {file_path}")
7272

73+
def load_dataset(self, file_path, dataset_name=None):
74+
"""
75+
Load a dataset from a NetCDF file and register it in the datasets dictionary.
76+
77+
Args:
78+
file_path (str): Path to the NetCDF file to load.
79+
dataset_name (str, optional): Name to assign to the loaded dataset.
80+
If not provided, the filename (without extension) will be used.
81+
82+
Returns:
83+
xarray.Dataset: The loaded dataset.
84+
85+
Raises:
86+
IOError: If there's an error loading the file.
87+
"""
88+
try:
89+
dataset = xr.open_dataset(file_path)
90+
if dataset_name is None:
91+
dataset_name = file_path.split('/')[-1].split('.')[0]
92+
self.datasets[dataset_name] = dataset
93+
print(f"Dataset loaded from {file_path} and registered as '{dataset_name}'")
94+
return dataset
95+
except Exception as e:
96+
raise IOError(f"Error loading dataset from {file_path}: {str(e)}")
97+
7398
# Additional methods can be added here as needed

tests/ai_ethics/test_security_integration.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ def test_perform_security_check(self, mock_agent):
9191
self.assertEqual(report, mock_report)
9292
mock_agent.return_value.security_check.assert_called_once()
9393

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

0 commit comments

Comments
 (0)