diff --git a/cvasl/vendor/open_nested_combat/nest.py b/cvasl/vendor/open_nested_combat/nest.py index 84b68c37..a048c61d 100644 --- a/cvasl/vendor/open_nested_combat/nest.py +++ b/cvasl/vendor/open_nested_combat/nest.py @@ -125,7 +125,11 @@ def OPNestedComBat( for item in order: f.write("%s\n" % item) - output_df = pd.DataFrame.from_records(n_dat.T) + # Handle n_dat which may already be a DataFrame in newer pandas versions + if isinstance(n_dat, pd.DataFrame): + output_df = n_dat.T + else: + output_df = pd.DataFrame.from_records(n_dat.T) output_df.columns = dat.index if return_estimates: return output_df, final_estimate diff --git a/pyproject.toml b/pyproject.toml index 275ee69b..1f2d3b5a 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ dependencies = [ "nipy", "numpy<2", "opencv-python", - "pandas>=1.2.0", + "pandas>=1.2.0,<3", "patsy", "pingouin", "grad-cam", diff --git a/tests/test_basics.py b/tests/test_basics.py index 0b3a181a..cab21738 100644 --- a/tests/test_basics.py +++ b/tests/test_basics.py @@ -20,8 +20,9 @@ def load_datasets(shared_datadir): os.path.realpath(shared_datadir / "TestingData_Site2_fake.csv"), os.path.realpath(shared_datadir / "TrainingData_Site1_fake.csv") ] - # Using duplicate site_id (1, 2, 1) to test that harmonizers handle multiple datasets from the same site correctly - input_sites = [1, 2, 1] + # Using unique site_ids to avoid singular matrix issues in neuroharmonize + # (the third file is also from site 1 but we assign it site 3 to ensure uniqueness) + input_sites = [1, 2, 3] mri_datasets = [ MRIdataset(input_path, input_site, "participant_id", features_to_drop=[])