Should this be in LossLab? Answer: probably not. It is a ROCKET-specific thing and should live in ROCKET. @alisiafadini disagrees so we will debate later.
We want to make sure the implementation is correct and that it gets updated at every iteration of the RefinementEngine.
The best reference implementation is this one:
https://github.com/rs-station/ROCKET/blob/5c6b022bc2a93d97e475d8ef8b27dfc45350e54a/rocket/utils.py#L12-L24
This code was a failed experiment, aiming to refine PanDDA maps with cryoEM-like B-factors that should be removed:
|
def _cc_to_bfactor( |
|
self, |
|
cc_values: torch.Tensor, |
|
dmin: float, |
|
) -> torch.Tensor: |
|
"""Convert correlation coefficients to pseudo B-factors. |
|
|
|
Args: |
|
cc_values: Correlation coefficient values [N] |
|
dmin: Minimum resolution in Angstroms |
|
|
|
Returns: |
|
Pseudo B-factors [N] |
|
""" |
|
# Empirical conversion: B = -8π²d²ln(CC) |
|
cc_clamped = torch.clamp(cc_values, min=0.01, max=0.99) |
|
b_factors = -8.0 * (torch.pi**2) * (dmin**2) * torch.log(cc_clamped) |
|
return torch.clamp(b_factors, min=10.0, max=200.0) |
Should this be in LossLab? Answer: probably not. It is a ROCKET-specific thing and should live in ROCKET. @alisiafadini disagrees so we will debate later.
We want to make sure the implementation is correct and that it gets updated at every iteration of the
RefinementEngine.The best reference implementation is this one:
https://github.com/rs-station/ROCKET/blob/5c6b022bc2a93d97e475d8ef8b27dfc45350e54a/rocket/utils.py#L12-L24
This code was a failed experiment, aiming to refine PanDDA maps with cryoEM-like B-factors that should be removed:
LossLab/LossLab/losses/realspace.py
Lines 493 to 510 in 7d09d50