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

Cutouts + light curves in anomaly notifications #153

Merged
merged 11 commits into from Jul 17, 2023

Conversation

Knispel2
Copy link
Collaborator

@Knispel2 Knispel2 commented Jul 14, 2023

I have added 3 new functions:

  • get_cutout - this function loads cutout image via Fink API;
  • get_curve - this function loads light curve image via Fink API (I used the code from the example in Fink API documentation to build the curve);
  • get_data_permalink_slack - using the two functions listed above, this function loads two images and copies these images to the Slack server.

I also put the status_code check of post requests into a separate function status_check, so as not to duplicate the code.

These versions of the modules are required to upload images to Slack:
slack-sdk==3.21.3 or newer
slackclient==2.9.4 or newer

Examples:
image
image

@Knispel2
Copy link
Collaborator Author

Knispel2 commented Jul 14, 2023

The code is ready for review, but I don't know how to hide the tokens to pass the tests

Copy link
Member

@JulienPeloton JulienPeloton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @Knispel2 ! For the tokens, we could use the Slack Fink_bot_test workspace, and the Telegram Fink_test channel? You can send me the token via email, and I will add them in the secrets of GitHub.

pdf[maskValid & maskFilt]['i:jd'].apply(lambda x: x - 2400000.5),
pdf[maskValid & maskFilt]['i:magpsf'],
pdf[maskValid & maskFilt]['i:sigmapsf'],
ls='', marker='o', color=colordic[filt]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would also add the label=filt argument

ls='', marker='v', color=colordic[filt]
)

plt.gca().invert_yaxis()
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add the plt.legend() command to display the legend.

@JulienPeloton JulienPeloton changed the base branch from master to ad_secrets July 17, 2023 06:05
@JulienPeloton JulienPeloton merged commit 1c81737 into astrolabsoftware:ad_secrets Jul 17, 2023
2 of 4 checks passed
JulienPeloton added a commit that referenced this pull request Jul 17, 2023
* Cutouts + light curves in anomaly notifications (#153)

* ZTF DR OID added

* docstring

* docstring refinement

* flake8 check

* ZTF DR OID ---> DR OID (<1'')

* '' -> "

* Moving the variables inside the if

* cutouts+lc images in notifications

* Hide token in status_check

* Add secrets to the env

* plot legend

* correction

---------

Co-authored-by: Timofei Pshenichnyy <93309519+Knispel2@users.noreply.github.com>
Co-authored-by: Timofei Pshenichniy <timofei.psheno@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants