Skip to content

Commit 58625ee

Browse files
Add deprecation warning + docstring, some docs updates
1 parent 4cd0934 commit 58625ee

File tree

2 files changed

+45
-28
lines changed

2 files changed

+45
-28
lines changed

docs/usage/demo-notebooks.rst

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,19 @@ Demo Notebooks
66
Reference Guide
77
-----------------
88

9-
For a high-level overview of the Firefly Python client API and important methods, refer to this `reference guide notebook`.
10-
11-
.. _`reference guide notebook`:
12-
https://nbviewer.org/github/Caltech-IPAC/firefly_client/tree/master/examples/reference-guide.ipynb.
9+
For a high-level overview of the Firefly Python client API and important methods, refer to this `reference guide notebook <https://nbviewer.org/github/Caltech-IPAC/firefly_client/tree/master/examples/reference-guide.ipynb>`_.
1310

1411

1512
Science Use-cases
1613
-----------------
1714

1815
IRSA Tutorials is collection of multiple notebooks that demonstrate the use of IRSA data services and tools for science use-cases.
19-
The following notebook demonstrates the use of Firefly Python Client:
20-
- https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/SEDs_in_Firefly.html
21-
- https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/NEOWISE_light_curve_demo.html
22-
- https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/OpenUniverse2024Preview_Firefly.html
23-
- https://caltech-ipac.github.io/irsa-tutorials/tutorials/euclid_access/4_Euclid_intro_PHZ_catalog.html#vizualize-the-image-with-firefly
16+
The following tutorial notebooks demonstrates the use of Firefly Python client:
17+
18+
- `Using Firefly visualization tools in Python to vet SEDs <https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/SEDs_in_Firefly.html>`_
19+
- `Using Firefly visualization tools to understand the light curves of Solar System objects <https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/NEOWISE_light_curve_demo.html>`_
20+
- `Using Firefly to Explore OpenUniverse2024 Data Preview Simulated Roman and Rubin Images <https://caltech-ipac.github.io/irsa-tutorials/tutorials/firefly/OpenUniverse2024Preview_Firefly.html>`_
21+
- `Euclid Q1: PHZ catalogs — Visualize with Firefly section <https://caltech-ipac.github.io/irsa-tutorials/tutorials/euclid_access/4_Euclid_intro_PHZ_catalog.html#vizualize-the-image-with-firefly>`_
2422

2523

2624
Other Examples

firefly_client/firefly_client.py

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -658,6 +658,7 @@ def get_payload_from_file(self, file_input):
658658
out : `dict`
659659
A dict that can be used as part of payload. The returned dict will
660660
have one of the following keys:
661+
661662
- 'fileOnServer': `str` (server file reference for the uploaded file/stream)
662663
- 'url': `str` (for a remote file)
663664
"""
@@ -779,6 +780,7 @@ def reinit_viewer(self):
779780
def show_data(self, file_input, preview_metadata=False, title=None):
780781
"""
781782
Show any data file of the type that Firefly supports:
783+
782784
- Custom catalog or table in IPAC, CSV, TSV, VOTABLE, Parquet, or FITS table format
783785
- A ds9 region file
784786
- Images in FITS format, including multi-extension FITS files with images, tables, or a mixture of both
@@ -831,13 +833,18 @@ def show_fits_image(self, file_input=None, file_on_server=None, url=None,
831833
If you use `upload_file()`, then it is the return value of the method. Otherwise it is a file that
832834
Firefly has direct access to.
833835
834-
.. note:: Ignored if `file_input` is provided, which can automatically
835-
upload a local file and use its name on the server.
836+
.. deprecated:: 3.4.0
837+
Use `file_input` instead, which can automatically
838+
upload a local file and use its name on the server.
839+
If this parameter is passed, it will be ignored if
840+
`file_input` is also passed.
836841
url : `str`, optional
837842
URL of the FITS image file, if it's not a local file you can upload.
838843
839-
.. note:: Ignored if `file_input` is provided, which can automatically
840-
infer if a URL is passed to it.
844+
.. deprecated:: 3.4.0
845+
Use `file_input` instead, which can automatically
846+
infer if a URL is passed to it. If this parameter is passed,
847+
it will be ignored if `file_input` is also passed.
841848
plot_id : `str`, optional
842849
The ID you assign to the image plot. This is necessary to further control the plot.
843850
viewer_id : `str`, optional
@@ -870,9 +877,9 @@ def show_fits_image(self, file_input=None, file_on_server=None, url=None,
870877
out : `dict`
871878
Status of the request, like {'success': True}.
872879
873-
.. note:: `file_input`, `url`, `file_on_server`, and service specific `additional_params` are exclusively required.
874-
If more than one of these 4 parameters are passed, precedence order is:
875-
service specific `additional_params` > (`file_input` > `file_on_server` > `url`).
880+
.. note:: `file_input` (previously `url` and `file_on_server`), and service specific `additional_params` are exclusively required.
881+
If more than one of these parameters are passed, precedence order is:
882+
service specific `additional_params` > `file_input` (> `file_on_server` > `url`).
876883
"""
877884
# WebPlotRequest parameters
878885
wp_request = {'plotGroupId': 'groupFromPython',
@@ -882,15 +889,19 @@ def show_fits_image(self, file_input=None, file_on_server=None, url=None,
882889

883890
warning = None
884891
if not viewer_id or self.is_triview():
885-
warning = 'viewer_id unnecessary and ignored in triview mode' if self.is_triview() and viewer_id else None
892+
warning = 'viewer_id is unnecessary and ignored in triview mode' if self.is_triview() and viewer_id else None
886893
viewer_id = FireflyClient.PINNED_IMAGE_VIEWER_ID
887894

888895
payload.update({'viewerId': viewer_id})
889896
plot_id and payload['wpRequest'].update({'plotId': plot_id})
890897

891898
# Handle different params of file input
892-
file_on_server and payload['wpRequest'].update({'file': file_on_server})
893-
url and payload['wpRequest'].update({'url': url})
899+
if file_on_server:
900+
warn('file_on_server is deprecated, use file_input parameter instead')
901+
payload['wpRequest'].update({'file': file_on_server})
902+
if url:
903+
warn('url is deprecated, use file_input parameter instead')
904+
payload['wpRequest'].update({'url': url})
894905
if file_input:
895906
file_payload = self.get_payload_from_file(file_input)
896907
if 'fileOnServer' in file_payload:
@@ -908,7 +919,8 @@ def show_fits_image(self, file_input=None, file_on_server=None, url=None,
908919

909920
def show_fits(self, *args, **kwargs):
910921
"""
911-
DEPRECATED: Use show_fits_image() instead.
922+
.. deprecated:: 3.4.0
923+
Use show_fits_image() instead.
912924
"""
913925
warn("show_fits() is deprecated. Use show_fits_image() instead.")
914926
return self.show_fits_image(*args, **kwargs)
@@ -973,13 +985,18 @@ def show_table(self, file_input=None, file_on_server=None, url=None,
973985
If you use `upload_file()`, then it is the return value of the method. Otherwise it is a file that
974986
Firefly has direct access to.
975987
976-
.. note:: Ignored if `file_input` is provided, which can automatically
977-
upload a local file and use its name on the server.
988+
.. deprecated:: 3.4.0
989+
Use `file_input` instead, which can automatically
990+
upload a local file and use its name on the server.
991+
If this parameter is passed, it will be ignored if
992+
`file_input` is also passed.
978993
url : `str`, optional
979994
URL of the table file, if it's not a local file you can upload.
980995
981-
.. note:: Ignored if `file_input` is provided, which can automatically
982-
infer if a URL is passed to it.
996+
.. deprecated:: 3.4.0
997+
Use `file_input` instead, which can automatically
998+
infer if a URL is passed to it. If this parameter is passed,
999+
it will be ignored if `file_input` is also passed.
9831000
tbl_id : `str`, optional
9841001
A table ID. It will be created automatically if not specified.
9851002
title : `str`, optional
@@ -1026,7 +1043,7 @@ def show_table(self, file_input=None, file_on_server=None, url=None,
10261043
- **showFilters** : `bool`
10271044
if table shows filter button
10281045
table_index : `int`, optional
1029-
The table to be shown in case `file_on_server` contains multiple tables. It is the extension number for
1046+
The table to be shown in case file input contains multiple tables. It is the extension number for
10301047
a FITS file or the table index for a VOTable file. In unspecified, the server will fetch extension 1 from
10311048
a FITS file or the table at index 0 from a VOTable file.
10321049
column_spec : `str`, optional
@@ -1045,9 +1062,9 @@ def show_table(self, file_input=None, file_on_server=None, url=None,
10451062
out : `dict`
10461063
Status of the request, like {'success': True}.
10471064
1048-
.. note:: `file_input`, `url`, `file_on_server`, and `target_search_info` are exclusively required.
1049-
If more than one of these 4 parameters are passed, precedence order is:
1050-
(`file_input` > `file_on_server` > `url`) > `target_search_info`
1065+
.. note:: `file_input` (previously `url` and `file_on_server`) and `target_search_info` are exclusively required.
1066+
If more than one of these parameters are passed, precedence order is:
1067+
`file_input` (> `file_on_server` > `url`) > `target_search_info`
10511068
"""
10521069
has_file_input = bool(file_on_server) or bool(url) or bool(file_input)
10531070

@@ -1073,8 +1090,10 @@ def show_table(self, file_input=None, file_on_server=None, url=None,
10731090
file_payload = self.get_payload_from_file(file_input)
10741091
source = file_payload.get('fileOnServer') or file_payload.get('url')
10751092
elif file_on_server:
1093+
warn('file_on_server is deprecated, use file_input parameter instead')
10761094
source = file_on_server
10771095
elif url:
1096+
warn('url is deprecated, use file_input parameter instead')
10781097
source = url
10791098

10801099
tbl_req.update({'source': source, 'tblType': tbl_type,

0 commit comments

Comments
 (0)