Skip to content

Commit

Permalink
initial chat with Carsten
Browse files Browse the repository at this point in the history
  • Loading branch information
kratsg committed Dec 8, 2023
1 parent 4d215a7 commit 9a1a72e
Show file tree
Hide file tree
Showing 6 changed files with 358 additions and 0 deletions.
333 changes: 333 additions & 0 deletions src/pyhf/schemas/1.1.0/defs.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,333 @@
{
"$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 },
"measurements": { "type": "array", "items": {"$ref": "#/definitions/measurement"}, "minItems": 1 },
"observations": { "type": "array", "items": {"$ref": "#/definitions/observation" }, "minItems": 1 },
"type": { "const": "histfactory_dist" },
"version": { "const": "1.1.0" }
},
"additionalProperties": false,
"required": ["distributions", "measurements", "observations", "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"]
},
"observation": {
"type": "object",
"properties": {
"name": { "type": "string" },
"data": { "type": "array", "items": {"type": "number"}, "minItems": 1 }
},
"required": ["name", "data"],
"additionalProperties": false
},
"measurement": {
"type": "object",
"properties": {
"name": { "type": "string" },
"config": { "$ref": "#/definitions/config" }
},
"required": ["name", "config"],
"additionalProperties": false
},
"config": {
"type": "object",
"properties": {
"poi": { "type" : "string" },
"parameters": { "type": "array", "items": {"$ref": "#/definitions/parameter"} }
},
"required": ["poi", "parameters"],
"additionalProperties": false
},
"parameter": {
"type": "object",
"properties": {
"name": { "type": "string" },
"inits": { "type": "array", "items": {"type": "number"}, "minItems": 1 },
"bounds": { "type": "array", "items": {"type": "array", "items": {"type": "number", "minItems": 2, "maxItems": 2}}, "minItems": 1 },
"auxdata": { "type": "array", "items": {"type": "number"}, "minItems": 1 },
"factors": { "type": "array", "items": {"type": "number"}, "minItems": 1 },
"sigmas": { "type": "array", "items": {"type": "number"}, "minItems": 1},
"fixed": { "type": "boolean" }
},
"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/axis"}, "minItems": 1, "maxItems": 1}
},
"required": ["name", "samples"],
"additionalProperties": false
},
"axis": {
"type": "object",
"MAKE THIS ONEOF": "",
"(A)": "",
"properties_oneof": {
"name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" },
"max": { "type": "number" },
"min": { "type": "number" },
"nbins": { "type": "number" }
},
"(B)": "",
"properties": {
"name": { "type": "string", "pattern": "^[a-zA-Z0-9_]+$" },
"edges": { "type": "array", "items": { "type": "number", "minItems": 2 } }
}
},
"sample": {
"type": "object",
"properties": {
"name": { "type": "string" },
"data": { "type": "object", "properties": { "contents": { "type": "array", "items": {"type": "number"}, "minItems": 1 }} },
"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_data": { "type": "array", "items": {"type": "number"}, "minItems": 1 },
"hi_data": { "type": "array", "items": {"type": "number"}, "minItems": 1 }
},
"required": ["lo_data", "hi_data"],
"additionalProperties": false
}
},
"required": ["name", "type", "data"],
"additionalProperties": false
},
"lumi": {
"type": "object",
"properties": {
"name": { "const": "lumi" },
"type": { "const": "lumi" },
"data": { "type": "null" }
},
"required": ["name", "type", "data"],
"additionalProperties": false
},
"normfactor": {
"type": "object",
"properties": {
"name": { "type": "string" },
"type": { "const": "normfactor" },
"data": { "type": "null" }
},
"required": ["name", "type", "data"],
"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
}
},
"required": ["name", "type", "data"],
"additionalProperties": false
},
"shapefactor": {
"type": "object",
"properties": {
"name": { "type": "string" },
"type": { "const": "shapefactor" },
"data": { "type": "null" }
},
"required": ["name", "type", "data"],
"additionalProperties": false
},
"shapesys": {
"type": "object",
"properties": {
"name": { "type": "string" },
"type": { "const": "shapesys" },
"data": { "type": "array", "items": {"type": "number"}, "minItems": 1 }
},
"required": ["name", "type", "data"],
"additionalProperties": false
},
"staterror": {
"type": "object",
"properties": {
"name": { "type": "string" },
"type": { "const": "staterror" },
"data": { "type": "array", "items": {"type": "number"}, "minItems": 1 }
},
"required": ["name", "type", "data"],
"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
}
}
}
}
5 changes: 5 additions & 0 deletions src/pyhf/schemas/1.1.0/jsonpatch.json
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions src/pyhf/schemas/1.1.0/measurement.json
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions src/pyhf/schemas/1.1.0/model.json
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions src/pyhf/schemas/1.1.0/patchset.json
Original file line number Diff line number Diff line change
@@ -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"
}
5 changes: 5 additions & 0 deletions src/pyhf/schemas/1.1.0/workspace.json
Original file line number Diff line number Diff line change
@@ -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"
}

0 comments on commit 9a1a72e

Please sign in to comment.