{
  "schema_version": 1,
  "name": "PF core SR/GR timing with ISAES evidence",
  "description": "Actual production radial null-geodesic computations; explicit coordinate chart, metric, units, clock, schedule and numerical consistency; no experimental or PF advantage claim.",
  "adapter": "python",
  "entrypoint": "main.py:run",
  "requirements": [
    {
      "distribution": "numpy",
      "version": "2.3.5"
    },
    {
      "distribution": "scipy",
      "version": "1.18.1"
    }
  ],
  "parameters": [
    {
      "name": "receiver_height_m",
      "label": "Receiver height above areal Earth surface (m)",
      "type": "number",
      "default": 400000,
      "minimum": 1000,
      "maximum": 2000000
    },
    {
      "name": "samples",
      "label": "Retained affine samples",
      "type": "integer",
      "default": 17,
      "minimum": 3,
      "maximum": 129
    }
  ],
  "outputs": [
    {
      "name": "flat_sr_flight_time_s",
      "kind": "number"
    },
    {
      "name": "flat_sr_reference_error_s",
      "kind": "number"
    },
    {
      "name": "gr_static_flight_time_s",
      "kind": "number"
    },
    {
      "name": "gr_static_reference_error_s",
      "kind": "number"
    },
    {
      "name": "gr_excess_time_s",
      "kind": "number"
    },
    {
      "name": "rays",
      "kind": "json"
    },
    {
      "name": "conventions",
      "kind": "json"
    },
    {
      "name": "reporting",
      "kind": "json"
    },
    {
      "name": "ray_artifact",
      "kind": "file"
    }
  ],
  "checks": [
    {
      "name": "Actual radial ray agrees with exact coordinate-time integral",
      "inputs": {},
      "expectations": [
        {
          "output": "/metrics/flat_sr_reference_error_s",
          "operator": "le",
          "value": 2e-13
        },
        {
          "output": "/metrics/gr_static_reference_error_s",
          "operator": "le",
          "value": 2e-13
        },
        {
          "output": "/metrics/gr_excess_time_s",
          "operator": "gt",
          "value": 0
        },
        {
          "output": "/data/rays/gr_static/path_positions_m",
          "operator": "length",
          "value": 17
        }
      ]
    }
  ],
  "files": [
    {
      "path": "main.py",
      "content": "\"\"\"Actual PF core radial null-geodesic runs with independently derived references.\n\nThis example is a numerical consistency check, not a PF advantage experiment.\nBoth schedules are static radial endpoints, with no clock noise or randomness.\nThe flat result is the GM=0 limit of the same production boundary-value solver.\n\"\"\"\nimport hashlib\nimport json\nimport math\n\nfrom gr_photon import C, EARTH_GM, EARTH_RADIUS_M, solve_null_geodesic\nfrom pf_reporting.adapters import adapt\n\n\ndef run(inputs, context):\n    height = inputs.get('receiver_height_m', 400000.0)\n    samples = inputs.get('samples', 17)\n    if type(height) not in (int, float) or not math.isfinite(height) or not 1000 <= height <= 2000000:\n        raise ValueError('Receiver height must be 1,000..2,000,000 m')\n    if type(samples) is not int or not 3 <= samples <= 129:\n        raise ValueError('Use 3..129 retained affine samples')\n    ra, rb = EARTH_RADIUS_M, EARTH_RADIUS_M + height\n    records, datasets, metrics = {}, [], {}\n    assumptions = ['Static radial endpoints outside a nonrotating spherical Earth.',\n        'Areal Cartesian coordinates with Schwarzschild coordinate time normalized at infinity.',\n        'No atmospheric delays, rotation, multipoles, noisy clocks or hardware observations.',\n        'The GM=0 limit uses the same coordinates with a Minkowski metric; no operational PF advantage is inferred.']\n    for name, gm in (('flat_sr', 0.0), ('gr_static', EARTH_GM)):\n        ray = solve_null_geodesic([ra, 0, 0], [rb, 0, 0], gm=gm,\n            body_radius_m=EARTH_RADIUS_M, samples=samples, rtol=1e-11)\n        if ray['status'] != 'ok':\n            raise RuntimeError('Core ray calculation failed: '+ray['status'])\n        rs = 2*gm/C**2\n        # Exact integral of dt/dr = 1/[c(1-rs/r)] for a radial Schwarzschild ray.\n        reference = height/C + rs/C*math.log1p(height/(ra-rs))\n        records[name] = ray\n        metrics[name+'_flight_time_s'] = ray['flight_time_s']\n        metrics[name+'_reference_error_s'] = abs(ray['flight_time_s']-reference)\n        metadata = {'frame': 'source-centred static frame', 'chart': 'areal_cartesian_schwarzschild_time',\n            'metric': 'Schwarzschild exterior', 'signature': '(-,+,+,+)',\n            'clock': 'Schwarzschild coordinate time normalized at infinity',\n            'origin': 'deterministic_simulation', 'assumptions': assumptions,\n            'tolerances': {'null_residual_max': 2e-10, 'endpoint_residual_m': 2e-6},\n            'schedule': {'emission_coordinate_time_s': 0.0, 'static_emitter_areal_radius_m': ra,\n                         'static_receiver_areal_radius_m': rb},\n            'noise_realization': 'none; deterministic ray boundary problem',\n            'core_source_sha256': hashlib.sha256((context.core_source/'gr_photon.py').read_bytes()).hexdigest()}\n        adapted = adapt('pf.srgr-timing/1', ray, metadata, name=name)\n        dataset = adapted['data']['reporting']['datasets'][0]\n        dataset['source'] = '/data/rays/'+name\n        datasets.append(dataset)\n    metrics['gr_excess_time_s'] = records['gr_static']['flight_time_s']-records['flat_sr']['flight_time_s']\n    artifact = context.output_path('radial_rays.json')\n    artifact.write_text(json.dumps(records, indent=2, allow_nan=False)+'\\n', encoding='utf-8')\n    return {'metrics': metrics, 'data': {'rays': records, 'conventions': {\n        'assumptions': assumptions, 'reference': 'Exact radial Schwarzschild coordinate-time integral',\n        'coordinate_comparison': 'Same declared endpoints and emission coordinate time; GM changes between scenarios.',\n        'source': 'gr_photon.solve_null_geodesic', 'model_discrepancy_assessed': False},\n        'reporting': {'schema_version': 2, 'intent': 'PF core SR/GR radial timing: numerical consistency and retained ray evidence',\n            'datasets': datasets, 'require': ['flat_sr', 'gr_static'],\n            'analysis': {'question': 'Do the retained core ray solutions agree with the stated coordinate-time conventions and numerical tolerances?'}}},\n        'series': [], 'tables': [], 'artifacts': [{'name': 'ray_artifact', 'path': 'radial_rays.json', 'mime_type': 'application/json'}]}\n"
    }
  ]
}
