def build_spatial_force_map(samples): return [ { "position": sample.get("position", [0.0, 0.0, 0.0]), "force": sample.get("force", [0.0, 0.0, 0.0]), } for sample in samples ] if __name__ == "__main__": sample_map = build_spatial_force_map([ {"position": [0.0, 0.0, 0.0], "force": [0.0, 0.1, 0.2]}, ]) print(sample_map)