-
Notifications
You must be signed in to change notification settings - Fork 22
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
Add local file option and formatter #48
Conversation
@maaijke - I've reworked a few things, which should address your comments. I've also added some more standard use of I've added a new On the change of filename extension, I think it should be easy enough to do in the new submodule. For example (that I'm making up), if the extensions change after 2025 we could add something like: def ftp_aiub_unibe_ch(server: str, year: int, dayofyear: int, prefix: str) -> str:
"""
Format the URL for the ftp.aiub.unibe.ch server
"""
ext = ".Z" if year <= 2024 else ".gz"
return f"{server}/CODE/{year:4d}/{prefix.upper()}{dayofyear:03d}0.{year%100:02d}I{ext}" |
Oh, I also did a quick bit of autoformatting to make my IDE happy. Sorry if this touched a few files. This mostly fixed up the order of imports (compliant with |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You made a lot of good improvements. This is very much appreciated, because the code needed some extra love and care. I made a few minor remarks.
I saw in the email conversation you also suggested to use a linting tool like ruff
, and to use more rigorous code formatting (I would suggest to use black
for that). I can only support that.
Also, I think the package desperately needs tests. I consider that even more important than proper formatting.
Please feel free to become more closely involved in improving RMextract
.
RMextract/PosTools.py
Outdated
logger.debug('casacore will be used to compute positions') | ||
except ImportError: | ||
logger.debug('We will need PyEphem to perform calculations!') | ||
logger.debug('the accuracy of results might decease a bit') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think I would log this at info
level.
use_mean: Optional[bool] = None, | ||
stat_names=[], | ||
useEMM=False, | ||
object = '', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Kind-a ugly to use a built-in class name as variable name. You may want to rename it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed - this argument was copied from the existing hidden kwarg:
Line 59 in 25638b1
if key=='object': |
Happy to change, but it could break existing use elsewhere.
One thing that bothers me a bit, but is unrelated to your changes is the dependency on |
Thanks @gmloose! Happy to help out where I can! A few top-level thoughts and some additional context. My changes here started from using RMextract in a) a highly parallel manner, and b) an environment where FTP was blocked on compute nodes. This is what lead me to adding the formatting option (allowing for easier offline file access) and catching some race conditions. I'll admit that perhaps this PR has grown a little larger than that narrower set of objectives. For the most part, I tried not to touch any of the actual logic in the existing code. @maaijke mentioned that some more major reworks are potentially in order as well, which added some more motivation for me not to change much of the logical code - rather I tried to make the existing logic clearer for any devs / contributors (starting with myself!). I'm happy to provide some suggestions on how a rework might look - but I can't commit the time to the actual implementation. Plus, I think there'd need to be clear agreement from the core maintainers about how to go about that. I'm happy to start adding tests for the functions I've 'touched' along the way. I've found this to be the easiest way to get unit tests in for a large project that has grown without them. Some less unitary end-to-end tests are useful as well. Perhaps after this PR merge we can start looking at creating those frameworks. On formatters, I'm also a fan of Black. However, I've recently made the move to Ruff as it seems to be where the wider Python community is moving - and the completely replicates the feature set with greater speed.
I added |
Funny. The well-known and often-used |
@maaijke, do you want to press the Merge button? Please do not forgot to select "Squash and merge". I think I need one more change to make sure the Linc interface script is still working. Let me add that and then we can go for it. Can we add Alec as a contributor to the main page? |
Allows local file support (i.e. if you
wget
a bunch of IONEX data for offline use).Adds a formatter for the ever-changing IONEX formats.
Also some tweaks to typing for dev use
Closes #46