Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python API? #27

Open
dennisbrookner opened this issue Sep 15, 2022 · 3 comments
Open

Python API? #27

dennisbrookner opened this issue Sep 15, 2022 · 3 comments
Labels
enhancement Improvement to existing feature wishlist New requested features

Comments

@dennisbrookner
Copy link
Member

I think it is worthwhile to consider a python API for rs-booster analogous to its command-line functionalities. I know that this would be useful and preferable for me, and I have discussed this with Doeke as well. Given that the spirit of reciprocalspaceship is essentially "you can do crystallography in python!" it feels entirely natural for rs-booster to work this way as well. I just wanted to open an issue to gauge thoughts on this and get folks' opinions.

I am happy to take this on. I don't think it would require the writing of much new code, just some refactoring of existing code. The end result can and certainly should be entirely reverse compatible with existing rs-booster usage.

@JBGreisman
Copy link
Member

My plan is to restructure things (as part of #24) to provide a bit more of a python interface. Right now, many of the tools are written as simple Python scripts, so although it is possible to import things they are not structured in a useful way.

My plan though is to have a limited scope for the task -- for example, I plan to write a DifferenceMap class to back many of the CLI implementations.

Do you have any specific things in mind? My hesitation with going to broad in terms of this library, is that I don't want it to be confusing where rs ends and rsbooster begins -- I still very much see rsbooster as providing useful implementations of certain tasks.

@JBGreisman JBGreisman added enhancement Improvement to existing feature wishlist New requested features labels Oct 7, 2022
@dennisbrookner
Copy link
Member Author

I'm going to make a PR soon with regards to this, because I'm building a larger python-based thing that uses rs.scaleit and I would like to be able to access scaleit from within python. My goal will be basically to have the main() function do only the following:

def main():
    args = parse_arguments()

    mtz1 = rs.read_mtz(args.mtz1) # etc. for other input files

    scaled = do_the_stuff(mtz1, ..., *args, etc.)

    scaled.write_mtz(args.mtzout)

    return

Such that everything except the io is accessible from inside python.

Does this make sense as a general structure? I like it, and I like the idea of keeping the python and command-line APIs as similar as possible. I would also be happy to go through and reorganize other functions in this manner.

@JBGreisman
Copy link
Member

yup -- I think this plan makes sense to me, and is a good framework for organize comparable methods/tools

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Improvement to existing feature wishlist New requested features
Projects
None yet
Development

No branches or pull requests

2 participants