diff --git a/src/pyhf/schemas/1.1.0/defs.json b/src/pyhf/schemas/1.1.0/defs.json new file mode 100644 index 0000000000..5ba70e014a --- /dev/null +++ b/src/pyhf/schemas/1.1.0/defs.json @@ -0,0 +1,406 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/defs.json", + "definitions": { + "workspace": { + "type": "object", + "properties": { + "distributions": { "type": "array", "items": {"$ref": "#/definitions/distribution"}, "minItems": 1 }, + "domains": { "type": "array", "items": {"$ref": "#/definitions/domain"}, "minItems": 1 }, + "inits": { "type": "array", "items": {"$ref": "#/definitions/init"}, "minItems": 1 }, + "likelihoods": { "type": "array", "items": {"$ref": "#/definitions/likelihood"}, "minItems": 1 }, + "measurements": { "type": "array", "items": {"$ref": "#/definitions/measurement"}, "minItems": 1 }, + "datasets": { "type": "array", "items": {"$ref": "#/definitions/dataset" }, "minItems": 1 }, + "version": { "const": "1.1.0" } + }, + "additionalProperties": false, + "required": ["distributions", "likelihoods", "measurements", "datasets", "version"] + }, + "model": { + "type": "object", + "properties": { + "channels": { "type": "array", "items": {"$ref": "#/definitions/distribution"}, "minItems": 1 }, + "parameters": { "type": "array", "items": {"$ref": "#/definitions/parameter"} } + }, + "additionalProperties": false, + "required": ["channels"] + }, + "domain": { + "type": "object", + "properties": { + "name": { "type" : "string" }, + "type": { "const": "product_domain" }, + "axes": { "type": "array", "items": {"$ref": "#/definitions/unbinnedAxis"}, "minItems": 1} + }, + "additionalProperties": false, + "required": ["name", "type", "axes"] + }, + "init": { + "type": "object", + "properties": { + "name": { "type" : "string" }, + "data": { "type": "array", "items": {"type": "number"}, "minItems": 1 }, + "fixed": { "type": "boolean" } + }, + "additionalProperties": false, + "required": ["name", "data"] + }, + "dataset": { + "type": "object", + "properties": { + "axes": { "type": "array", "items": {"$ref": "#/definitions/binnedAxis"}, "minItems": 1, "maxItems": 1}, + "name": { "type": "string" }, + "type": { "const": "binned" }, + "contents": { "type": "array", "items": {"type": "number"}, "minItems": 1 } + }, + "required": ["axes", "name", "type", "contents"], + "additionalProperties": false + }, + "likelihood": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "distributions": { "type": "array", "items": { "type": "string" } }, + "datasets": { "type": "array", "items": { "type": "string" } } + }, + "required": ["name", "distributions", "datasets"], + "additionalProperties": false + }, + "measurement": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "poi": { "type" : "string" }, + "parameters": { "type": "array", "items": {"$ref": "#/definitions/parameter"} }, + "domains": { "type": "array", "items": {"type": "string"}}, + "likelihood": { "type": "string" } + }, + "required": ["name", "poi", "parameters", "likelihood"], + "additionalProperties": false + }, + "parameter": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "auxdata": { "type": "array", "items": {"type": "number"}, "minItems": 1 }, + "factors": { "type": "array", "items": {"type": "number"}, "minItems": 1 }, + "sigmas": { "type": "array", "items": {"type": "number"}, "minItems": 1} + }, + "required": ["name"], + "additionalProperties": false + }, + "distribution": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "samples": { "type": "array", "items": {"$ref": "#/definitions/sample"}, "minItems": 1 }, + "axes": { "type": "array", "items": {"$ref": "#/definitions/binnedAxis"}, "minItems": 1, "maxItems": 1}, + "type": { "const": "histfactory_dist" } + }, + "required": ["name", "samples", "axes", "type"], + "additionalProperties": false + }, + "axis": { + "type": "object", + "oneOf": [ + { "$ref": "#/definitions/unbinnedAxis" }, + { "$ref": "#/definitions/binnedAxis" } + ] + }, + "binnedAxis": { + "type": "object", + "oneOf": [ + { + "properties": { + "name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, + "max": { "type": "number" }, + "min": { "type": "number" }, + "nbins": { "type": "number" } + }, + "required": [ "name", "max", "min", "nbins" ], + "additionalProperties": false + }, + { + "properties": { + "name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, + "edges": { "type": "array", "items": { "type": "number", "minItems": 2 } } + }, + "required": [ "name", "edges" ], + "additionalProperties": false + } + ] + }, + "unbinnedAxis": { + "type": "object", + "properties": { + "name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, + "max": { "type": "number" }, + "min": { "type": "number" } + }, + "required": [ "name", "max", "min" ], + "additionalProperties": false + }, + "histogram": { + "type": "object", + "properties": { + "contents": { "type": "array", "items": {"type": "number"}, "minItems": 1 } + }, + "required": ["contents"], + "additionalProperties": false + }, + "histogramWithErrors": { + "type": "object", + "properties": { + "contents": { "type": "array", "items": {"type": "number"}, "minItems": 1 }, + "errors": { "type": "array", "items": {"type": "number"}, "minItems": 1 } + }, + "required": ["contents"], + "additionalProperties": false + }, + "sample": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "data": { "type": "object", "$ref": "#/definitions/histogramWithErrors" }, + "modifiers": { + "type": "array", + "items": { + "anyOf": [ + { "$ref": "#/definitions/modifier/histosys" }, + { "$ref": "#/definitions/modifier/lumi" }, + { "$ref": "#/definitions/modifier/normfactor" }, + { "$ref": "#/definitions/modifier/normsys" }, + { "$ref": "#/definitions/modifier/shapefactor" }, + { "$ref": "#/definitions/modifier/shapesys" }, + { "$ref": "#/definitions/modifier/staterror" } + ] + } + } + }, + "required": ["name", "data", "modifiers"], + "additionalProperties": false + }, + "modifier": { + "histosys": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "histosys" }, + "data": { + "type": "object", + "properties": { + "lo": { "type": "object", "$ref": "#/definitions/histogram" }, + "hi": { "type": "object", "$ref": "#/definitions/histogram" } + }, + "required": ["lo", "hi"], + "additionalProperties": false + }, + "parameter": { "type": "string" } + }, + "required": ["name", "type", "data"], + "additionalProperties": false + }, + "lumi": { + "type": "object", + "properties": { + "name": { "const": "lumi" }, + "type": { "const": "lumi" }, + "data": { "type": "null" }, + "parameter": { "type": "string" } + }, + "required": ["name", "type", "data"], + "additionalProperties": false + }, + "normfactor": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "normfactor" }, + "data": { "type": "null" }, + "parameter": { "type": "string" } + }, + "required": ["name", "type"], + "additionalProperties": false + }, + "normsys": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "normsys" }, + "data": { + "type": "object", + "properties": { + "lo": { "type": "number" }, + "hi": { "type": "number"} + }, + "required": ["lo", "hi"], + "additionalProperties": false + }, + "parameter": { "type": "string" } + }, + "required": ["name", "type", "data"], + "additionalProperties": false + }, + "shapefactor": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "shapefactor" }, + "data": { "type": "null" }, + "parameters": { "type": "array", "items": { "type": "string" }} + }, + "required": ["name", "type"], + "additionalProperties": false + }, + "shapesys": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "shapesys" }, + "data": { "type": "object", "$ref": "#/definitions/histogram" }, + "parameters": { "type": "array", "items": { "type": "string" }} + }, + "required": ["name", "type", "data"], + "additionalProperties": false + }, + "staterror": { + "type": "object", + "properties": { + "name": { "type": "string" }, + "type": { "const": "staterror" }, + "parameters": { "type": "array", "items": { "type": "string" }} + }, + "required": ["name", "type"], + "additionalProperties": false + } + }, + "jsonpatch": { + "description": "an array of patch operations (copied from http://json.schemastore.org/json-patch)", + "type": "array", + "items": { + "$ref": "#/definitions/jsonpatch/operation" + }, + "operation": { + "type": "object", + "required": [ "op", "path" ], + "allOf": [ { "$ref": "#/definitions/jsonpatch/path" } ], + "oneOf": [ + { + "required": [ "value" ], + "properties": { + "op": { + "description": "The operation to perform.", + "type": "string", + "enum": [ "add", "replace", "test" ] + }, + "value": { + "description": "The value to add, replace or test." + } + } + }, + { + "properties": { + "op": { + "description": "The operation to perform.", + "type": "string", + "enum": [ "remove" ] + } + } + }, + { + "required": [ "from" ], + "properties": { + "op": { + "description": "The operation to perform.", + "type": "string", + "enum": [ "move", "copy" ] + }, + "from": { + "description": "A JSON Pointer path pointing to the location to move/copy from.", + "type": "string" + } + } + } + ] + }, + "path": { + "properties": { + "path": { + "description": "A JSON Pointer path.", + "type": "string" + } + } + } + }, + "patchset": { + "description": "A set of JSONPatch patches which modify a pyhf workspace", + "type": "object", + "properties": { + "patches": { "$ref": "#/definitions/patchset/patches" }, + "metadata": { "$ref": "#/definitions/patchset/metadata" }, + "version": { "const": "1.1.0" } + }, + "additionalProperties": false, + "required": ["patches", "metadata", "version"], + "references": { + "type": "object", + "properties": { + "hepdata": { "type": "string", "pattern": "^ins[0-9]{7}$" } + }, + "additionalProperties": false, + "minProperties": 1 + }, + "digests": { + "type": "object", + "properties": { + "md5": { "type": "string", "pattern": "^[a-f0-9]{32}$" }, + "sha256": { "type": "string", "pattern": "^[a-fA-F0-9]{64}$" } + }, + "additionalProperties": false, + "minProperties": 1 + }, + "patches": { + "type": "array", + "items": { "$ref": "#/definitions/patchset/patch" }, + "minItems": 1 + }, + "patch": { + "type": "object", + "properties": { + "patch": { "$ref": "#/definitions/jsonpatch" }, + "metadata": { + "type": "object", + "properties": { + "name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, + "values": { + "type": "array", + "items": { + "anyOf": [{"type": "number"}, {"type": "string"}] + } + } + }, + "required": ["name", "values"], + "additionalProperties": true + } + }, + "required": ["metadata", "patch"], + "additionalProperties": false + }, + "metadata": { + "type": "object", + "properties": { + "digests": { "$ref": "#/definitions/patchset/digests" }, + "labels": { + "type": "array", + "items": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" }, + "minItems": 1 + }, + "description": { "type": "string" }, + "references": { "$ref": "#/definitions/patchset/references" } + }, + "required": ["references", "digests", "labels", "description"], + "additionalProperties": true + } + } + } +} diff --git a/src/pyhf/schemas/1.1.0/jsonpatch.json b/src/pyhf/schemas/1.1.0/jsonpatch.json new file mode 100644 index 0000000000..93b7aba6b0 --- /dev/null +++ b/src/pyhf/schemas/1.1.0/jsonpatch.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/jsonpatch.json", + "$ref": "defs.json#/definitions/jsonpatch" +} diff --git a/src/pyhf/schemas/1.1.0/measurement.json b/src/pyhf/schemas/1.1.0/measurement.json new file mode 100644 index 0000000000..09db479667 --- /dev/null +++ b/src/pyhf/schemas/1.1.0/measurement.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/measurement.json", + "$ref": "defs.json#/definitions/measurement" +} diff --git a/src/pyhf/schemas/1.1.0/model.json b/src/pyhf/schemas/1.1.0/model.json new file mode 100644 index 0000000000..a3d6e6ae4a --- /dev/null +++ b/src/pyhf/schemas/1.1.0/model.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/model.json", + "$ref": "defs.json#/definitions/model" +} diff --git a/src/pyhf/schemas/1.1.0/patchset.json b/src/pyhf/schemas/1.1.0/patchset.json new file mode 100644 index 0000000000..f453981dad --- /dev/null +++ b/src/pyhf/schemas/1.1.0/patchset.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/patchset.json", + "$ref": "defs.json#/definitions/patchset" +} diff --git a/src/pyhf/schemas/1.1.0/workspace.json b/src/pyhf/schemas/1.1.0/workspace.json new file mode 100644 index 0000000000..22ee3e3736 --- /dev/null +++ b/src/pyhf/schemas/1.1.0/workspace.json @@ -0,0 +1,5 @@ +{ + "$schema": "http://json-schema.org/draft/2020-12/schema#", + "$id": "https://scikit-hep.org/pyhf/schemas/1.1.0/workspace.json", + "$ref": "defs.json#/definitions/workspace" +}