Skip to content

Commit 12b3b7b

Browse files
committed
Add --D48 to CLI
1 parent a541e62 commit 12b3b7b

18 files changed

+267
-177
lines changed

D47crunch/__init__.py

Lines changed: 45 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
__copyright__ = 'Copyright (c) 2023 Mathieu Daëron'
2323
__license__ = 'Modified BSD License - https://opensource.org/licenses/BSD-3-Clause'
2424
__date__ = '2023-07-20'
25-
__version__ = '2.2.0'
25+
__version__ = '2.2.1'
2626

2727
import os
2828
import numpy as np
@@ -3249,6 +3249,7 @@ def _cli(
32493249
exclude: Annotated[str, typer.Option('--exclude', '-e', help = 'The path of a file specifying UIDs and/or Samples to exclude')] = 'none',
32503250
anchors: Annotated[str, typer.Option('--anchors', '-a', help = 'The path of a file specifying custom anchors')] = 'none',
32513251
output_dir: Annotated[str, typer.Option('--output-dir', '-o', help = 'Specify the output directory')] = 'output',
3252+
run_D48: Annotated[bool, typer.Option('--D48', help = 'Also standardize D48')] = False,
32523253
):
32533254
"""
32543255
Process raw D47 data and return standardized results.
@@ -3290,13 +3291,51 @@ def _cli(
32903291
data.crunch()
32913292
data.standardize()
32923293
data.summary(dir = output_dir)
3293-
data.table_of_samples(dir = output_dir)
3294-
data.table_of_sessions(dir = output_dir)
3295-
data.plot_sessions(dir = output_dir)
32963294
data.plot_residuals(dir = output_dir, filename = 'D47_residuals.pdf', kde = True)
3297-
data.table_of_analyses(dir = output_dir)
3298-
data.plot_distribution_of_analyses(dir = output_dir)
32993295
data.plot_bulk_compositions(dir = output_dir + '/bulk_compositions')
3296+
data.plot_sessions(dir = output_dir)
3297+
3298+
if not run_D48:
3299+
data.table_of_samples(dir = output_dir)
3300+
data.table_of_analyses(dir = output_dir)
3301+
data.table_of_sessions(dir = output_dir)
3302+
3303+
3304+
if run_D48:
3305+
data2 = D48data()
3306+
data2.read(rawdata)
3307+
3308+
data2 = D48data([r for r in data2 if r['UID'] not in exclude_uid and r['Sample'] not in exclude_sample])
33003309

3310+
if anchors != 'none':
3311+
data2.Nominal_d13C_VPDB = {
3312+
_['Sample']: _['d13C_VPDB']
3313+
for _ in anchors
3314+
if 'd13C_VPDB' in _
3315+
}
3316+
data2.Nominal_d18O_VPDB = {
3317+
_['Sample']: _['d18O_VPDB']
3318+
for _ in anchors
3319+
if 'd18O_VPDB' in _
3320+
}
3321+
data2.Nominal_D4x = {
3322+
_['Sample']: _['D48']
3323+
for _ in anchors
3324+
if 'D48' in _
3325+
}
3326+
3327+
data2.refresh()
3328+
data2.wg()
3329+
data2.crunch()
3330+
data2.standardize()
3331+
data2.summary(dir = output_dir)
3332+
data2.plot_sessions(dir = output_dir)
3333+
data2.plot_residuals(dir = output_dir, filename = 'D48_residuals.pdf', kde = True)
3334+
data2.plot_distribution_of_analyses(dir = output_dir)
3335+
3336+
table_of_analyses(data, data2, dir = output_dir)
3337+
table_of_samples(data, data2, dir = output_dir)
3338+
table_of_sessions(data, data2, dir = output_dir)
3339+
33013340
def __cli():
33023341
_app()

changelog.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## v2.2.1
4+
*Released on 2023-07-20*
5+
6+
### New feature
7+
8+
* The CLI now processes Δ48 as well as Δ47 data, thanks to the `--D48` option.
9+
10+
311
## v2.2.0
412
*Released on 2023-07-20*
513

code_examples/virtual_data/output.txt

Lines changed: 58 additions & 58 deletions
Large diffs are not rendered by default.

docs/D47_plot_Session_01.png

7 Bytes
Loading

docs/D47_plot_Session_02.png

2 Bytes
Loading

docs/D47_plot_Session_03.png

-3 Bytes
Loading

docs/D47_plot_Session_04.png

-3 Bytes
Loading

docs/D47_plot_Session_05.png

-1 Bytes
Loading

docs/D47_plot_Session_06.png

-1 Bytes
Loading

docs/D47_plot_Session_07.png

-1 Bytes
Loading

0 commit comments

Comments
 (0)