-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0ec4a2c
commit 0fec842
Showing
6 changed files
with
47 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
"""Read and write CSV files for anesthetic.""" | ||
from anesthetic.weighted_labelled_pandas import read_csv as wl_read_csv | ||
from anesthetic.samples import MCMCSamples, NestedSamples | ||
from pathlib import Path | ||
|
||
|
||
def read_csv(filename, *args, **kwargs): | ||
"""Read a CSV file into a :class:`Samples` object.""" | ||
filename = Path(filename) | ||
kwargs['label'] = kwargs.get('label', filename.stem) | ||
wldf = wl_read_csv(filename.with_suffix('.csv')) | ||
if 'nlive' in wldf.columns: | ||
return NestedSamples(wldf, *args, **kwargs) | ||
else: | ||
return MCMCSamples(wldf, *args, **kwargs) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters