-
Notifications
You must be signed in to change notification settings - Fork 34
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 Dastcom5 Service #115
base: main
Are you sure you want to change the base?
Add Dastcom5 Service #115
Conversation
Hello @shreyasbapat! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-07-22 20:39:45 UTC |
(In case the Slack message is lost: https://matrix.to/#/!DdazxkLDTPnBLekbbL:openastronomy.org/$15497546251785GFeBH:openastronomy.org?via=cadair.com&via=openastronomy.org&via=matrix.org) |
@shreyasbapat please fix the PEP8 errors. |
@Juanlu001 I am also working on tests. Will push both of them together |
e76477b
to
d611927
Compare
Thanks for providing this PR! A few things that I would like to see discussed/changed/added before I proceed with an in-depth review:
Thanks! |
Sure @mommermi . Thanks for a quick response. I will keep you updated as I complete all the requirements. |
I have created the checklist for reference.
|
@mommermi I have done everything that was asked! |
Thanks, @shreyasbapat ! I will work on the review as soon as possible! |
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.
Thanks for working on this! I have a handful of comments and suggestions to make this compatible with the sbpy
API:
- please move the module from
sbpy.utils
tosbpy.data.utils
- please add some examples to the docstrings of the individual functions and methods
- in their current state, the return values of most functions are not very useful and not compatible with other
sbpy
functionality; please make sure that each function returns some derivative ofsbpy.data.DataClass
where the data is split into columns, each of which uses the correspondingastropy.units
unit (see detailed review comments and the wiki: https://github.com/NASA-Planetary-Science/sbpy/wiki)
sbpy/utils/dastcom5.py
Outdated
return body_data | ||
|
||
|
||
def download_dastcom5(): |
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 like the download function, but I would suggest a few minor things:
- during download and in addition to showing the download progress, could you add a line saying: 'downloading current DASTCOM5 database' or something similar?
- can you add a keyword parameter
update
that allows to overwrite the local version of the database? - instead of downloading the files into
~/.sbpy
, can you download them intodata_archive
in thesbpy
directory? - in order to save space, please delete the zip file once it is unpacked
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.
update will mean removing the version user has and downloading completely newer version? I didn't understand.
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.
Yes, sorry if I was unclear. By 'update' I mean to overwrite the existing local version with the latest available version.
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.
instead of downloading the files into ~/.sbpy, can you download them into data_archive in the sbpy directory
Won't the users installing it from pip find it difficult to access the database? I think it is fine if someone is cloning the repository somewhere and then runs pip install -e .
. Otherwise in my opinion, it won't be good?
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.
Good point. I don't think we should assume that the sbpy directory is writable.
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.
Ok, so will we use ~/.sbpy
as the location of the database? ~/sbpy/dastcom5/
?
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.
Yes @mommermi
/.sbpy/dastcom5/
sbpy/utils/dastcom5.py
Outdated
Database with custom dtype. | ||
|
||
""" | ||
with open(AST_DB_PATH, "rb") as f: |
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.
It seems that there is some kind of timestamp in the database; can you issue a warning if the local database is older than 7 days? The same applies to the comet database.
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.
Sure.
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.
Where do you see the timestamp? I am unable to find 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.
I might have mistaken Epoch
as a timestamp. Should we use this?
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 don't think using epoch is a good idea for giving out warnings.
sbpy/utils/dastcom5.py
Outdated
return data | ||
|
||
|
||
def orbit_from_name(name): |
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.
Both this function and orbit_from_record
lack a parser function. Right now, all the data is stored in a single column of an astropy.table
object, which is not very useful. Please split up the data into columns in a useful way; have a look at https://sbpy.readthedocs.io/en/latest/fieldnames.html and the documentation of astroquery.jplhorizons
/astroquery.sbdb
to get an idea of meaningful column names for the different properties that are already being used within sbpy
. Finally, please use the corresponding astropy.units
for each column.
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.
Can you please elaborate a little by what you mean by parser? Sorry that I am unable to understand. Will it be on the top of these pre-existing functions and return the required table?
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.
Yes, exactly. Right now, the functions return single-columns tables. These tables are not really useful as the data are unstructured. A parser function would read in these rows and split them into the individual columns. Does this make sense?
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 got 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.
Should this function still return a table?
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.
Added. Please review what name it should have. I have added a function with a wierd name :/
sbpy/utils/dastcom5.py
Outdated
return records | ||
|
||
|
||
def string_record_from_name(name): |
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.
this function should be mentioned in the documentation
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.
Sure
sbpy/utils/dastcom5.py
Outdated
return lines | ||
|
||
|
||
def read_headers(): |
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.
what does this function do? What are 'headers'?
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.
The HEADERS of the database
sbpy/utils/dastcom5.py
Outdated
for line in inF: | ||
if re.search(r"\b" + name.casefold() + r"\b", line.casefold()): | ||
lines.append(line) | ||
return lines |
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.
please turn this output into a sbpy.data.DataClass
object with corresponding column names.
sbpy/utils/dastcom5.py
Outdated
return ast_header, com_header | ||
|
||
|
||
def read_record(record): |
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 couldn't get this function to work. It fails with
File ".../sbpy/utils/dastcom5.py", line 502, in read_record
f.seek(phis_rec, os.SEEK_SET)
This function would be potentially useful and could output as sbpy.data.Phys
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.
Will work on 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.
This function is already being used in orbit_from_record 😅
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.
This error pops when the record is not there in the database. Please try with :
read_record(1636)
which is for atira
@mommermi I am facing issues in pip installing the package.
Is this my environment problem? |
I just did |
|
@shreyasbapat: have you tried installing |
I am sorry for leaving this for long! I will finish this up asap! |
Finally, a good rebase. I will finish the PR in a day. |
@shreyasbapat @Juanlu001 The test needs to be skipped or marked as remote, probably the latter? Append "# doctest: +REMOTE_DATA" to the lines that need remote data. https://docs.astropy.org/en/stable/development/testguide.html#working-with-data-files |
Sure. I will do so. |
@mkelley The |
If you have a doctest that checks if your download succeeded, I think it's legitimate to skip it. However, in that case, you should have a dedicated test on the module level that checks for this. |
@shreyasbapat @mommermi I don't think the download should ever happen in the documentation. The files are too large. If there were a way to do a mock download, that would be OK. |
True. I will try to get the ticks green this weekend. |
In case it's relevant for this PR, we fixed a bug in the original code poliastro/poliastro#902 |
Will fix that asap here also.
…_______________________________________
This email is sent from a smartphone. Please ignore grammatical mistakes
and typographical errors.
_______________________________________
On Wed, Apr 15, 2020, 5:48 PM Juan Luis Cano Rodríguez < ***@***.***> wrote:
In case it's relevant for this PR, we fixed a bug in the original code
poliastro/poliastro#902
<poliastro/poliastro#902>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#115 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AFZCK6TIG5LVALUXSPEGEHDRMWQ3HANCNFSM4G2TJLTQ>
.
|
Fixing this |
As discussed in chats of astroquery: https://astropy.slack.com/archives/C8U8VGQFM/p1549754624034000
And from a PR in astroquery: astropy/astroquery#1339
I am adding this module here.
cc @Juanlu001