broker: serve the placed model and its maps of the last rugnux live run (/rugnux/model.cif, /rugnux/map.ccp4)

A rugnux live run that placed a model keeps it, with a copy of its map coefficients, beside the live
status (RugnuxStructure), for as long as /rugnux/status keeps the run. Made in memory on the first
request and cached, never written to disk:
- GET /rugnux/model.cif: the placed model as mmCIF, labelled as WritePlacedModel labels _model.cif
  (PlacedModelMmcif, the labelling factored out of WritePlacedModel; the file output is unchanged).
- GET /rugnux/map.ccp4?type=2fofc|fofc: the 2mFo-DFc / mFo-DFc map as a CCP4 map, FFT of the
  FWT/PHWT or DELFWT/PHDELWT coefficients (get_f_phi_on_grid + MapFromFPhi, sampled as ModelValidation
  samples), cut to the box around the model plus 5 A, with the whole cell's mean and RMS in the header.
- 404 without a placed model or maps, 400 for an unknown map type; both routes protected by the dataset
  bearer token like /rugnux/status. rugnux_live_status gets placed_model.

C++ model, python client docs, TypeScript client and redoc regenerated.

Tests: a point's coefficients give a map peaking at the atom in a cropped box; the mmCIF; the structure
is cleared at the next start; the auth test covers the new routes. End to end (myoglobin 2M replay with
an AlphaFold model): the maps equal gemmi's FFT of the written _maps.mtz to 2.5e-6 rms.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015CeEGgpKdfkCTJb3YNMJcu
(cherry picked from commit 33124c3288ba112def3f51c0d91f5206886f3495)
This commit is contained in:
leonarski_f committed 2026-10-22 20:18:50 +02:00
1 parent ae1169072a
commit 15ca4b329f
26 files changed
+835 -55

No files matched your search

+2
View File
@@ -159,6 +159,8 @@ Class | Method | HTTP request | Description
*DefaultApi* | [**preview_plot_bin_get**](docs/DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | Generate 1D plot from Jungfraujoch and send in raw binary format. Data are provided as (32-bit) float binary array. This format doesn&#39;t transmit information about X-axis, only values, so it is of limited use for azimuthal integration.
*DefaultApi* | [**preview_plot_get**](docs/DefaultApi.md#preview_plot_get) | **GET** /preview/plot | Generate 1D plot from Jungfraujoch
*DefaultApi* | [**result_scan_get**](docs/DefaultApi.md#result_scan_get) | **GET** /result/scan | Get full scan result
*DefaultApi* | [**rugnux_map_ccp4_get**](docs/DefaultApi.md#rugnux_map_ccp4_get) | **GET** /rugnux/map.ccp4 | Get an electron-density map of the last rugnux live run
*DefaultApi* | [**rugnux_model_cif_get**](docs/DefaultApi.md#rugnux_model_cif_get) | **GET** /rugnux/model.cif | Get the model as placed by the last rugnux live run
*DefaultApi* | [**rugnux_status_get**](docs/DefaultApi.md#rugnux_status_get) | **GET** /rugnux/status | Get live rugnux processing status of the last collection
*DefaultApi* | [**start_post**](docs/DefaultApi.md#start_post) | **POST** /start | Start detector
*DefaultApi* | [**statistics_calibration_get**](docs/DefaultApi.md#statistics_calibration_get) | **GET** /statistics/calibration | Get calibration statistics
+164
View File
@@ -62,6 +62,8 @@ Method | HTTP request | Description
[**preview_plot_bin_get**](DefaultApi.md#preview_plot_bin_get) | **GET** /preview/plot.bin | Generate 1D plot from Jungfraujoch and send in raw binary format. Data are provided as (32-bit) float binary array. This format doesn&#39;t transmit information about X-axis, only values, so it is of limited use for azimuthal integration.
[**preview_plot_get**](DefaultApi.md#preview_plot_get) | **GET** /preview/plot | Generate 1D plot from Jungfraujoch
[**result_scan_get**](DefaultApi.md#result_scan_get) | **GET** /result/scan | Get full scan result
[**rugnux_map_ccp4_get**](DefaultApi.md#rugnux_map_ccp4_get) | **GET** /rugnux/map.ccp4 | Get an electron-density map of the last rugnux live run
[**rugnux_model_cif_get**](DefaultApi.md#rugnux_model_cif_get) | **GET** /rugnux/model.cif | Get the model as placed by the last rugnux live run
[**rugnux_status_get**](DefaultApi.md#rugnux_status_get) | **GET** /rugnux/status | Get live rugnux processing status of the last collection
[**start_post**](DefaultApi.md#start_post) | **POST** /start | Start detector
[**statistics_calibration_get**](DefaultApi.md#statistics_calibration_get) | **GET** /statistics/calibration | Get calibration statistics
@@ -4073,6 +4075,168 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **rugnux_map_ccp4_get**
> bytearray rugnux_map_ccp4_get(type=type)
Get an electron-density map of the last rugnux live run
The map of the placed model (`/rugnux/model.cif`) in CCP4 format (mode 2, float), made from the map
coefficients written to `_maps.mtz`. It covers the box around the model plus 5 A on every side, sampled
every d_min/3; the mean and RMS in its header are those of the whole unit cell, so contour levels in
sigma are the usual ones.
### Example
* Bearer Authentication (bearerAuth):
```python
import jfjoch_client
from jfjoch_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:5232
# See configuration.py for a list of all supported configuration parameters.
configuration = jfjoch_client.Configuration(
host = "http://localhost:5232"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = jfjoch_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with jfjoch_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = jfjoch_client.DefaultApi(api_client)
type = 2fofc # str | `2fofc`: the 2mFo-DFc map; `fofc`: the mFo-DFc difference map (optional) (default to 2fofc)
try:
# Get an electron-density map of the last rugnux live run
api_response = api_instance.rugnux_map_ccp4_get(type=type)
print("The response of DefaultApi->rugnux_map_ccp4_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DefaultApi->rugnux_map_ccp4_get: %s\n" % e)
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**type** | **str**| &#x60;2fofc&#x60;: the 2mFo-DFc map; &#x60;fofc&#x60;: the mFo-DFc difference map | [optional] [default to 2fofc]
### Return type
**bytearray**
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream, text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Map | - |
**400** | Unknown map type | - |
**401** | The current dataset is protected and no valid bearer token was presented. | - |
**404** | The last rugnux live run placed no model or made no maps | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **rugnux_model_cif_get**
> bytearray rugnux_model_cif_get()
Get the model as placed by the last rugnux live run
The model placed against the data by molecular replacement or validation, as mmCIF: the coordinates, cell
and space group of the `_model.cif` file written beside the data, with the input model's own metadata
(entities, citation) kept. Kept as long as `/rugnux/status`.
### Example
* Bearer Authentication (bearerAuth):
```python
import jfjoch_client
from jfjoch_client.rest import ApiException
from pprint import pprint
# Defining the host is optional and defaults to http://localhost:5232
# See configuration.py for a list of all supported configuration parameters.
configuration = jfjoch_client.Configuration(
host = "http://localhost:5232"
)
# The client must configure the authentication and authorization parameters
# in accordance with the API server security policy.
# Examples for each auth method are provided below, use the example that
# satisfies your auth use case.
# Configure Bearer authorization: bearerAuth
configuration = jfjoch_client.Configuration(
access_token = os.environ["BEARER_TOKEN"]
)
# Enter a context with an instance of the API client
with jfjoch_client.ApiClient(configuration) as api_client:
# Create an instance of the API class
api_instance = jfjoch_client.DefaultApi(api_client)
try:
# Get the model as placed by the last rugnux live run
api_response = api_instance.rugnux_model_cif_get()
print("The response of DefaultApi->rugnux_model_cif_get:\n")
pprint(api_response)
except Exception as e:
print("Exception when calling DefaultApi->rugnux_model_cif_get: %s\n" % e)
```
### Parameters
This endpoint does not need any parameter.
### Return type
**bytearray**
### Authorization
[bearerAuth](../README.md#bearerAuth)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: chemical/x-mmcif, text/plain
### HTTP response details
| Status code | Description | Response headers |
|-------------|-------------|------------------|
**200** | Placed model | - |
**401** | The current dataset is protected and no valid bearer token was presented. | - |
**404** | The last rugnux live run placed no model | - |
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **rugnux_status_get**
> RugnuxLiveStatus rugnux_status_get()
@@ -7,6 +7,7 @@ Live rugnux processing of the last collection; kept until the next collection st
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**state** | **str** | |
**placed_model** | **bool** | The run placed the model: it can be fetched from &#x60;/rugnux/model.cif&#x60; and its maps from &#x60;/rugnux/map.ccp4&#x60;. |
**probe** | **str** | Answer of the early lattice probe on the first 60 degrees; empty until it answers |
**probe_s** | **float** | When the probe answered, since the first image | [optional]
**start_to_first_image_s** | **float** | From the START message to the first image; set once the first image arrives | [optional]