How to run this route from Python with the Ouro SDK.
API access requires an API key. Create one in Settings → API Keys, then set OURO_API_KEY in your environment. Install the SDK with pip install ouro-py.
POST /rank-re-free-magnetsParameters and request body schema for this route.
Range: 1 to 5000
Maximum number of eligible ranked candidates to include.
Range: 0 to
Range: 0 to
Range: 0 to
Range: 0 to
Non-negative metric weights; they are normalized to sum to one.
Optional stable output dataset name. Reuse it to overwrite the same result idempotently.
Require a calculated MAE. Default false retains candidates without MAE and applies an explicit missing-evidence penalty.
Require calculated energy above hull. Default false retains unknown stability with an explicit evidence penalty.
Range: 0 to 1
Range: 0 to
Candidate dataset to rank.
Apply the min-score, Curie-temperature, and hull cutoffs as hard exclusions. Default false keeps a broader evidence-ranked list; the cutoffs remain visible in config but do not remove candidates.
Range: 0 to 1
Range: 0 to 1
Range: 0 to
Require calculated saturation magnetization. This is the default minimum magnetic evidence.
Require calculated Curie temperature. Default false retains unknown Tc with an explicit evidence penalty.
Range: 0 to 1
execute returns an action: the record of this run, with its status, response, and any assets it created.
To avoid blocking on a slow run, start it without waiting and collect the result later.
By default a failed run comes back as an action with status error. Pass raise_on_error=True to raise an exception instead.
Every run is saved as an action. List yours, or read the logs of a single run. See the Python SDK reference for everything an action carries.
import os
from ouro import Ouro
ouro = Ouro(api_key=os.environ.get("OURO_API_KEY"))
# The ID also works, and stays the same if the route is renamed: "c6942f9f-d3d1-4841-bb5b-39a833eb6f3d"
route = ouro.routes.retrieve("hermes/rank-re-free-permanent-magnet-lab-candidates")
action = route.execute(
body={
"top_n": 250,
"weights": {
"hhi": 0.15,
"magnetic": 0.4,
"toxicity": 0.15,
"synthesizability": 0.3,
},
"output_name": "example_string",
"require_mae": False,
"require_hull": False,
"min_hhi_score": 0.2,
"min_curie_temp_K": 300,
"source_dataset_id": "019f7111-6b38-7c6d-a962-ffacd979a94c",
"enforce_thresholds": False,
"min_magnetic_score": 0.35,
"min_toxicity_score": 0.5,
"max_hull_eV_per_atom": 0.1,
"require_magnetization": True,
"require_curie_temperature": False,
"min_synthesizability_score": 0.5,
},
)
print(action.status) # "success" or "error"
print(action.final_data)# Returns as soon as the run is accepted
action = route.execute(
body={
"top_n": 250,
"weights": {
"hhi": 0.15,
"magnetic": 0.4,
"toxicity": 0.15,
"synthesizability": 0.3,
},
"output_name": "example_string",
"require_mae": False,
"require_hull": False,
"min_hhi_score": 0.2,
"min_curie_temp_K": 300,
"source_dataset_id": "019f7111-6b38-7c6d-a962-ffacd979a94c",
"enforce_thresholds": False,
"min_magnetic_score": 0.35,
"min_toxicity_score": 0.5,
"max_hull_eV_per_atom": 0.1,
"require_magnetization": True,
"require_curie_temperature": False,
"min_synthesizability_score": 0.5,
},
wait=False,
)
print(action.id, action.status)
# Later, even from another process
action = ouro.routes.poll_action(str(action.id), poll_interval=5, timeout=1800)
print(action.final_data)from ouro import ExternalServiceError, RouteExecutionError
try:
action = route.execute(
body={
"top_n": 250,
"weights": {
"hhi": 0.15,
"magnetic": 0.4,
"toxicity": 0.15,
"synthesizability": 0.3,
},
"output_name": "example_string",
"require_mae": False,
"require_hull": False,
"min_hhi_score": 0.2,
"min_curie_temp_K": 300,
"source_dataset_id": "019f7111-6b38-7c6d-a962-ffacd979a94c",
"enforce_thresholds": False,
"min_magnetic_score": 0.35,
"min_toxicity_score": 0.5,
"max_hull_eV_per_atom": 0.1,
"require_magnetization": True,
"require_curie_temperature": False,
"min_synthesizability_score": 0.5,
},
raise_on_error=True,
)
except ExternalServiceError as exc:
# The API behind this route failed
print(exc.status_code, exc.retryable)
except RouteExecutionError as exc:
print(exc.action_id, exc.status, exc.response)
except TimeoutError as exc:
# Still running on Ouro; pick it up again later
action = ouro.routes.poll_action(exc.action_id, timeout=None)route = ouro.routes.retrieve("hermes/rank-re-free-permanent-magnet-lab-candidates")
# Your runs of this route
actions = route.read_actions()
for action in actions:
print(action.id, action.status, action.created_at)
# One run and its logs
action = ouro.routes.retrieve_action("your-action-id")
for entry in action.read_logs(chronological=True):
print(entry.level, entry.message)Creates a deterministic, weighted lab shortlist from a permanent-magnet candidate dataset.
Execution
Usage
1 callView history