Skip to content

Commit d7b54e6

Browse files
authored
feat: Combine is taught about formal data (outer) join methods (#752)
* Workspace combination now allows for more robust join operations with a variation of outer join supported * Some refactoring of Workspace.combine was done to support a future clean-up
1 parent aa16787 commit d7b54e6

File tree

3 files changed

+633
-86
lines changed

3 files changed

+633
-86
lines changed

src/pyhf/cli/spec.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -238,12 +238,19 @@ def rename(workspace, output_file, channel, sample, modifier, measurement):
238238
@cli.command()
239239
@click.argument('workspace-one', default='-')
240240
@click.argument('workspace-two', default='-')
241+
@click.option(
242+
'-j',
243+
'--join',
244+
default='none',
245+
type=click.Choice(Workspace.valid_joins),
246+
help='The join operation to apply when combining the two workspaces.',
247+
)
241248
@click.option(
242249
'--output-file',
243250
help='The location of the output json file. If not specified, prints to screen.',
244251
default=None,
245252
)
246-
def combine(workspace_one, workspace_two, output_file):
253+
def combine(workspace_one, workspace_two, join, output_file):
247254
"""
248255
Combine two workspaces into a single workspace.
249256
@@ -257,7 +264,7 @@ def combine(workspace_one, workspace_two, output_file):
257264

258265
ws_one = Workspace(spec_one)
259266
ws_two = Workspace(spec_two)
260-
combined_ws = Workspace.combine(ws_one, ws_two)
267+
combined_ws = Workspace.combine(ws_one, ws_two, join=join)
261268

262269
if output_file is None:
263270
click.echo(json.dumps(combined_ws, indent=4, sort_keys=True))

0 commit comments

Comments
 (0)