Comments (4)
Regarding changing spacegroups, we have a long-standing issue (#5) to address this -- exactly because of all the gotchas that can come up with regard to centering. It hasn't been a high priority for now and will require some diligence with regard to testing to make sure we get it all right.
I think that sort of check for fractional Miller indices could be a good idea though because it would cause issues in other places in rs
.
from reciprocalspaceship.
This maybe should even raise an error. I'm fine with whatever you all decide.
from reciprocalspaceship.
Just to expand on this, the current behavior when this arises is to coerce the result to an integer value. This can result in something that isn't the applied symmetry operation. This occurs because of the implementation using np.floor_divide()
in rs.utils.apply_to_hkl()
:
I can see two solutions:
- Implement in
rs.utils.apply_to_hkl()
-- we can change this function to usenp.divide()
and raise a warning or error if the resulting array has non-integer parts. The checking for non-integer parts could be handled with something likenot np.any(np.mod(Hnew, 1))
, however the error-checking does run the risk of slowing down functions that heavily rely onapply_to_hkl()
such asrs.utils.hkl_to_asu()
(we test whether this really is a bottleneck though). - Implement error-checking in
DataSet.apply_symop()
-- this will require modifyingrs.utils.apply_to_hkl()
to usenp.divide
, and letting other functions handle the testing of this. My hesitation here is that it could require re-implementing the same checks in different places. However, by construction,hkl_to_asu()
won't produce fractional Miller indices, so these checks may only be needed in the more general methods likeapply_symop()
from reciprocalspaceship.
Looking back at this, one can detect gemmi.Op
instances that won't run into this problem:
import gemmi
# Can't produce non-integer HKLs if provided integer HKLs
op = gemmi.Op("x,x-y,2*x-z")
print(((np.array(op.rot)/op.DEN)%1==0).all()) # prints True
# Can cause problems given integer HKL input
op = gemmi.Op("1/2*x-1/2*y,1/2*x+1/2*y,z")
print(((np.array(op.rot)/op.DEN)%1==0).all()) # prints False
The test if ((np.array(op.rot)/op.DEN)%1==0).all()
can be used to go between the two operating modes for this function.
from reciprocalspaceship.
Related Issues (20)
- Cannot unstack_anomalous with other columns in index
- groupby apply drops cell and spacegroup HOT 2
- `stack_anomalous` inside `groupby` breaks `as_index=False` HOT 1
- Unstack anomalous taking into account Careless repeats HOT 10
- rs.utils.asu.in_asu() does not use the 'anomalous ASU' for stacked anomalous data. HOT 1
- function for cif file IO and possible support for multi-dataset files HOT 3
- `hkl_to_asu` does not annotate M/ISYM field correctly HOT 2
- support for read_precognition() for hkl without anomalous columns HOT 6
- unstack_anomalous makes data that phenix cannot interpret HOT 3
- API reference website display
- Return keys of dictionary in crystfel.py HOT 8
- add_rfree() does not consider Friedel mates HOT 2
- `rs.DataSet.reset_index()` call signature does not match pandas >1.5 HOT 1
- Used pandas.core.ops attribute does not appear to exist HOT 4
- A `rs.cifdump` utility? HOT 1
- No documentation of CrystFEL columns HOT 1
- mean_intensity_by_miller_index should use a grid HOT 1
- write_mtz SettingWithCopyWarning HOT 2
- Failure to correctly read Miller indices from cctbx-generated MTZ HOT 8
- RS requires set_index(["H","K","L"]) to create a multi_index using rs.DataSet HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from reciprocalspaceship.