adss 1.30__tar.gz → 1.32__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
adss-1.32/PKG-INFO ADDED
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: adss
3
+ Version: 1.32
4
+ Summary: Astronomical Data Smart System
5
+ Author-email: Gustavo Schwarz <gustavo.b.schwarz@gmail.com>
6
+ Project-URL: Homepage, https://github.com/schwarzam/adss
7
+ Classifier: Programming Language :: Python :: 3
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: pyarrow
12
+ Requires-Dist: requests
13
+ Requires-Dist: astropy
14
+ Dynamic: license-file
15
+
16
+ # ADSS
17
+ Astronomical Data Smart System
18
+
19
+ ADSS is a database/server project that provides access to ADSS compatible astronomical services.
20
+
21
+ This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution. Download of images, cutouts, colored images and spectra is also supported.
22
+
23
+ Github repository: [https://github.com/schwarzam/adss](https://github.com/schwarzam/adss)
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install adss
29
+ ```
30
+
31
+ or
32
+
33
+ ```bash
34
+ git clone https://github.com/schwarzam/adss.git
35
+ cd adss
36
+ pip install .
37
+ ```
38
+
39
+
40
+ ### About ADSS compatible services
41
+
42
+ ADSS is a project that is still under development. Currently, some of the ADSS services are available at [https://ai-scope.cbpf.br/](https://ai-scope.cbpf.br/) and [https://splus.cloud/](https://splus.cloud/).
43
+
44
+ ### New Features
45
+
46
+ ADSS supports different queries, including cone searches, cross-matches between tables, and cross-matches against user-supplied data. The library supports both synchronous and asynchronous query execution.
47
+
48
+ Also some improvements in the ADQL parsing were made, allowing queries with wildcards in the SELECT statement, such as:
49
+
50
+ ```sql
51
+ SELECT psf_* FROM my_table WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
52
+ ```
53
+
54
+ This will select all columns that start with "psf_".
55
+
56
+
57
+ ### Starting a client
58
+
59
+ To start using ADSS, you need to initialize a client with the base URL of the ADSS service and your credentials. Here's an example:
60
+
61
+ ```python
62
+ import adss
63
+
64
+ cl = adss.ADSSClient(
65
+ base_url="https://ai-scope.cbpf.br/",
66
+ username="your_username",
67
+ password="your_password"
68
+ )
69
+ ```
70
+
71
+ The client will handle authentication and session management for you.
72
+
73
+ ### Performing Queries
74
+
75
+ You can perform various types of queries using the client. ADSS inherited a lot of the concept of the Table Access Protocol (TAP). Specially the sync and async modes of queries.
76
+
77
+ - **Synchronous Queries** (Short Lived Queries): These queries are executed immediately, and the results are returned in the body of the first request if found! With a timeout of ~10 seconds usually. Good for small tables or queries that return a small number of rows <1000. Example:
78
+
79
+ ```python
80
+ cl.query(
81
+ """
82
+ select *
83
+ from my_table
84
+ where CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
85
+ """
86
+ )
87
+ ```
88
+
89
+ - **Asynchronous Queries**: These queries are executed in the background, and you can check the status of the query and retrieve the results once they are ready. Good for large tables or queries that return a large number of rows or long queries.
90
+
91
+ We have two ways of doing async queries. This first send the query to the server and wait until it's done. Example:
92
+
93
+ ```python
94
+ tab = cl.query_and_wait(
95
+ query_text="""
96
+ select top 100 *
97
+ from splus.splus_idr6 where field = 'HYDRA-0091'
98
+ """,
99
+ mode="adql", # or sql
100
+ file=None, # dataframe
101
+ table_name=None,
102
+ )
103
+ # Print the dataframe
104
+ print(tab.data)
105
+ ```
106
+
107
+ The second way is a more controlled way, where you create the query, check the status and fetch the when you want results:
108
+
109
+ ```python
110
+
111
+ # Create a asynchronous query
112
+ query = cl.async_query(
113
+ query_text="""
114
+ select top 100 id, ra, dec, mag_psf*
115
+ from splus.splus_idr6 where field = 'HYDRA-0091'
116
+ """,
117
+ mode="adql", # or sql
118
+ file=None, # dataframe
119
+ table_name=None,
120
+ )
121
+
122
+ # Check the status of the query and fetch results if complete
123
+ query = cl.queries.get_status(query.id)
124
+ if query.is_complete:
125
+ print("Query is complete. Fetching results...")
126
+ results = cl.queries.get_results(query.id)
127
+ else:
128
+ print("Query is not complete yet.")
129
+
130
+ ```
131
+
132
+ ### Uploading user tables
133
+
134
+ In the last example we left the `file` and `table_name` parameters as `None`. This means that we are not uploading any user table to the server. If you want to upload a user table, you can do it by passing a pandas DataFrame to the `file` parameter and a name for the table to the `table_name` parameter. **The uploaded table should be referenced as upload.`table_name` in the query.**.
135
+
136
+ ```python
137
+ import pandas as pd
138
+ # Create a sample dataframe
139
+ data = {
140
+ "id": [1, 2, 3],
141
+ "ra": [150.1, 150.2, 150.3],
142
+ "dec": [2.1, 2.2, 2.3]
143
+ }
144
+ df = pd.DataFrame(data)
145
+
146
+ # Create a asynchronous query with user table
147
+ query = cl.query_and_wait(
148
+ query_text="""
149
+ select a.*, b.mag_psf_r
150
+ from upload.my_table as a
151
+ join splus.splus_idr6 as b on a.id = b.id
152
+ """,
153
+ mode="adql", # or sql
154
+ file=df, # dataframe
155
+ table_name="my_table",
156
+ )
157
+
158
+ ### Images - File Collections
159
+
160
+ ADSS also supports downloading images, cutouts, colored images. These are handled as Collections. You can list the available file collections in the database metadata:
161
+
162
+ ```python
163
+ cl.get_image_collections()
164
+ ```
165
+
166
+ ```
167
+ [
168
+ {
169
+ 'name': 'splus dr4',
170
+ 'path': '/dados/splus',
171
+ 'description': 'splus dr4 collection',
172
+ 'id': 1,
173
+ 'created_at': '2025-04-22T15:27:36.698058',
174
+ 'updated_at': '2025-07-31T23:27:51.497554',
175
+ 'last_scanned': '2025-05-08T20:28:54.420350',
176
+ 'patterns': {'': 'swp.', 'weight': 'weight'}
177
+ }
178
+ ]
179
+ ```
180
+
181
+ And then to list the files in a collection:
182
+
183
+ ```python
184
+ cl.list_files(1) ## pass the collection ID
185
+ ```
186
+
187
+ ```
188
+ [
189
+ {
190
+ 'filename': 'SPLUS-s17s23_F515_swpweight.fz',
191
+ 'full_path': '/dados/splus/SPLUS-s17s23 SPLUS-s17s23_F515_swpweight.fz',
192
+ 'file_type': 'fz',
193
+ 'ra_center': 316.45153076969416,
194
+ 'dec_center': -21.580560694390957,
195
+ 'width': 11000,
196
+ 'height': 11000,
197
+ 'pixel_scale': 0.55000000000008,
198
+ 'hdus': 2,
199
+ 'data_hdu': 1,
200
+ 'object_name': 'SPLUS-s17s23',
201
+ 'filter': 'F515',
202
+ 'instrument': 'T80Cam',
203
+ 'telescope': 'T80',
204
+ 'date_obs': None,
205
+ 'file_size': 51353280,
206
+ 'id': 28,
207
+ 'collection_id': 1,
208
+ 'created_at': '2025-04-22T15:35:05.487208',
209
+ 'updated_at': '2025-05-08T19:53:09.541437'},
210
+ },...]
211
+ ```
212
+
213
+ You can then download a file by its filename:
214
+
215
+ ```python
216
+ cl.images.download_file("SPLUS-s17s23_F515_swpweight.fz", download_path=".")
217
+ ```
adss-1.32/README.md ADDED
@@ -0,0 +1,202 @@
1
+ # ADSS
2
+ Astronomical Data Smart System
3
+
4
+ ADSS is a database/server project that provides access to ADSS compatible astronomical services.
5
+
6
+ This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution. Download of images, cutouts, colored images and spectra is also supported.
7
+
8
+ Github repository: [https://github.com/schwarzam/adss](https://github.com/schwarzam/adss)
9
+
10
+ ## Installation
11
+
12
+ ```bash
13
+ pip install adss
14
+ ```
15
+
16
+ or
17
+
18
+ ```bash
19
+ git clone https://github.com/schwarzam/adss.git
20
+ cd adss
21
+ pip install .
22
+ ```
23
+
24
+
25
+ ### About ADSS compatible services
26
+
27
+ ADSS is a project that is still under development. Currently, some of the ADSS services are available at [https://ai-scope.cbpf.br/](https://ai-scope.cbpf.br/) and [https://splus.cloud/](https://splus.cloud/).
28
+
29
+ ### New Features
30
+
31
+ ADSS supports different queries, including cone searches, cross-matches between tables, and cross-matches against user-supplied data. The library supports both synchronous and asynchronous query execution.
32
+
33
+ Also some improvements in the ADQL parsing were made, allowing queries with wildcards in the SELECT statement, such as:
34
+
35
+ ```sql
36
+ SELECT psf_* FROM my_table WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
37
+ ```
38
+
39
+ This will select all columns that start with "psf_".
40
+
41
+
42
+ ### Starting a client
43
+
44
+ To start using ADSS, you need to initialize a client with the base URL of the ADSS service and your credentials. Here's an example:
45
+
46
+ ```python
47
+ import adss
48
+
49
+ cl = adss.ADSSClient(
50
+ base_url="https://ai-scope.cbpf.br/",
51
+ username="your_username",
52
+ password="your_password"
53
+ )
54
+ ```
55
+
56
+ The client will handle authentication and session management for you.
57
+
58
+ ### Performing Queries
59
+
60
+ You can perform various types of queries using the client. ADSS inherited a lot of the concept of the Table Access Protocol (TAP). Specially the sync and async modes of queries.
61
+
62
+ - **Synchronous Queries** (Short Lived Queries): These queries are executed immediately, and the results are returned in the body of the first request if found! With a timeout of ~10 seconds usually. Good for small tables or queries that return a small number of rows <1000. Example:
63
+
64
+ ```python
65
+ cl.query(
66
+ """
67
+ select *
68
+ from my_table
69
+ where CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
70
+ """
71
+ )
72
+ ```
73
+
74
+ - **Asynchronous Queries**: These queries are executed in the background, and you can check the status of the query and retrieve the results once they are ready. Good for large tables or queries that return a large number of rows or long queries.
75
+
76
+ We have two ways of doing async queries. This first send the query to the server and wait until it's done. Example:
77
+
78
+ ```python
79
+ tab = cl.query_and_wait(
80
+ query_text="""
81
+ select top 100 *
82
+ from splus.splus_idr6 where field = 'HYDRA-0091'
83
+ """,
84
+ mode="adql", # or sql
85
+ file=None, # dataframe
86
+ table_name=None,
87
+ )
88
+ # Print the dataframe
89
+ print(tab.data)
90
+ ```
91
+
92
+ The second way is a more controlled way, where you create the query, check the status and fetch the when you want results:
93
+
94
+ ```python
95
+
96
+ # Create a asynchronous query
97
+ query = cl.async_query(
98
+ query_text="""
99
+ select top 100 id, ra, dec, mag_psf*
100
+ from splus.splus_idr6 where field = 'HYDRA-0091'
101
+ """,
102
+ mode="adql", # or sql
103
+ file=None, # dataframe
104
+ table_name=None,
105
+ )
106
+
107
+ # Check the status of the query and fetch results if complete
108
+ query = cl.queries.get_status(query.id)
109
+ if query.is_complete:
110
+ print("Query is complete. Fetching results...")
111
+ results = cl.queries.get_results(query.id)
112
+ else:
113
+ print("Query is not complete yet.")
114
+
115
+ ```
116
+
117
+ ### Uploading user tables
118
+
119
+ In the last example we left the `file` and `table_name` parameters as `None`. This means that we are not uploading any user table to the server. If you want to upload a user table, you can do it by passing a pandas DataFrame to the `file` parameter and a name for the table to the `table_name` parameter. **The uploaded table should be referenced as upload.`table_name` in the query.**.
120
+
121
+ ```python
122
+ import pandas as pd
123
+ # Create a sample dataframe
124
+ data = {
125
+ "id": [1, 2, 3],
126
+ "ra": [150.1, 150.2, 150.3],
127
+ "dec": [2.1, 2.2, 2.3]
128
+ }
129
+ df = pd.DataFrame(data)
130
+
131
+ # Create a asynchronous query with user table
132
+ query = cl.query_and_wait(
133
+ query_text="""
134
+ select a.*, b.mag_psf_r
135
+ from upload.my_table as a
136
+ join splus.splus_idr6 as b on a.id = b.id
137
+ """,
138
+ mode="adql", # or sql
139
+ file=df, # dataframe
140
+ table_name="my_table",
141
+ )
142
+
143
+ ### Images - File Collections
144
+
145
+ ADSS also supports downloading images, cutouts, colored images. These are handled as Collections. You can list the available file collections in the database metadata:
146
+
147
+ ```python
148
+ cl.get_image_collections()
149
+ ```
150
+
151
+ ```
152
+ [
153
+ {
154
+ 'name': 'splus dr4',
155
+ 'path': '/dados/splus',
156
+ 'description': 'splus dr4 collection',
157
+ 'id': 1,
158
+ 'created_at': '2025-04-22T15:27:36.698058',
159
+ 'updated_at': '2025-07-31T23:27:51.497554',
160
+ 'last_scanned': '2025-05-08T20:28:54.420350',
161
+ 'patterns': {'': 'swp.', 'weight': 'weight'}
162
+ }
163
+ ]
164
+ ```
165
+
166
+ And then to list the files in a collection:
167
+
168
+ ```python
169
+ cl.list_files(1) ## pass the collection ID
170
+ ```
171
+
172
+ ```
173
+ [
174
+ {
175
+ 'filename': 'SPLUS-s17s23_F515_swpweight.fz',
176
+ 'full_path': '/dados/splus/SPLUS-s17s23 SPLUS-s17s23_F515_swpweight.fz',
177
+ 'file_type': 'fz',
178
+ 'ra_center': 316.45153076969416,
179
+ 'dec_center': -21.580560694390957,
180
+ 'width': 11000,
181
+ 'height': 11000,
182
+ 'pixel_scale': 0.55000000000008,
183
+ 'hdus': 2,
184
+ 'data_hdu': 1,
185
+ 'object_name': 'SPLUS-s17s23',
186
+ 'filter': 'F515',
187
+ 'instrument': 'T80Cam',
188
+ 'telescope': 'T80',
189
+ 'date_obs': None,
190
+ 'file_size': 51353280,
191
+ 'id': 28,
192
+ 'collection_id': 1,
193
+ 'created_at': '2025-04-22T15:35:05.487208',
194
+ 'updated_at': '2025-05-08T19:53:09.541437'},
195
+ },...]
196
+ ```
197
+
198
+ You can then download a file by its filename:
199
+
200
+ ```python
201
+ cl.images.download_file("SPLUS-s17s23_F515_swpweight.fz", download_path=".")
202
+ ```
@@ -450,7 +450,7 @@ class ADSSClient:
450
450
 
451
451
  # === Image methods ===
452
452
 
453
- def get_image_collections(self, skip: int = 0, limit: int = 100, **kwargs) -> List[Dict[str, Any]]:
453
+ def get_collections(self, skip: int = 0, limit: int = 100, **kwargs) -> List[Dict[str, Any]]:
454
454
  """
455
455
  Get a list of accessible image collections.
456
456
 
@@ -464,7 +464,7 @@ class ADSSClient:
464
464
  """
465
465
  return self.images.get_collections(skip, limit, **kwargs)
466
466
 
467
- def get_image_collection(self, collection_id: int, **kwargs) -> Dict[str, Any]:
467
+ def get_collection(self, collection_id: int, **kwargs) -> Dict[str, Any]:
468
468
  """
469
469
  Get a specific image collection by ID.
470
470
 
@@ -477,7 +477,7 @@ class ADSSClient:
477
477
  """
478
478
  return self.images.get_collection(collection_id, **kwargs)
479
479
 
480
- def list_image_files(self, collection_id: int, skip: int = 0, limit: int = 100,
480
+ def list_files(self, collection_id: int, skip: int = 0, limit: int = 100,
481
481
  filter_name: Optional[str] = None, filter_str: Optional[str] = None,
482
482
  object_name: Optional[str] = None, **kwargs) -> List[Dict[str, Any]]:
483
483
  """
@@ -516,7 +516,7 @@ class ADSSClient:
516
516
  """
517
517
  return self.images.cone_search(collection_id, ra, dec, radius, filter_name, limit, **kwargs)
518
518
 
519
- def download_image(self, file_id: int, output_path: Optional[str] = None, **kwargs) -> Union[bytes, str]:
519
+ def download_file(self, file_id: int, output_path: Optional[str] = None, **kwargs) -> Union[bytes, str]:
520
520
  """
521
521
  Download an image file.
522
522
 
@@ -25,7 +25,7 @@ class ImagesEndpoint:
25
25
  params = {"skip": skip, "limit": limit}
26
26
 
27
27
  try:
28
- resp = self.auth_manager.download(
28
+ resp = self.auth_manager.request(
29
29
  method="GET",
30
30
  url=url,
31
31
  headers=headers,
@@ -46,7 +46,7 @@ class ImagesEndpoint:
46
46
  headers = {"Accept": "application/json"}
47
47
 
48
48
  try:
49
- resp = self.auth_manager.download(
49
+ resp = self.auth_manager.request(
50
50
  method="GET",
51
51
  url=url,
52
52
  headers=headers,
@@ -90,6 +90,19 @@ class Query:
90
90
  def is_failed(self) -> bool:
91
91
  """Check if the query failed."""
92
92
  return self.status == 'failed'
93
+
94
+ def report(self) -> None:
95
+ """Print a summary of the query."""
96
+ print(f"Query ID: {self.id}")
97
+ print(f"Status: {self.status}")
98
+ if self.completed_at:
99
+ print(f"Completed At: {self.completed_at}")
100
+ if self.execution_time_ms is not None:
101
+ print(f"Execution Time (ms): {self.execution_time_ms}")
102
+ if self.row_count is not None:
103
+ print(f"Row Count: {self.row_count}")
104
+ if self.error:
105
+ print(f"Error: {self.error}")
93
106
 
94
107
 
95
108
  @dataclass
@@ -0,0 +1,217 @@
1
+ Metadata-Version: 2.4
2
+ Name: adss
3
+ Version: 1.32
4
+ Summary: Astronomical Data Smart System
5
+ Author-email: Gustavo Schwarz <gustavo.b.schwarz@gmail.com>
6
+ Project-URL: Homepage, https://github.com/schwarzam/adss
7
+ Classifier: Programming Language :: Python :: 3
8
+ Requires-Python: >=3.8
9
+ Description-Content-Type: text/markdown
10
+ License-File: LICENSE
11
+ Requires-Dist: pyarrow
12
+ Requires-Dist: requests
13
+ Requires-Dist: astropy
14
+ Dynamic: license-file
15
+
16
+ # ADSS
17
+ Astronomical Data Smart System
18
+
19
+ ADSS is a database/server project that provides access to ADSS compatible astronomical services.
20
+
21
+ This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution. Download of images, cutouts, colored images and spectra is also supported.
22
+
23
+ Github repository: [https://github.com/schwarzam/adss](https://github.com/schwarzam/adss)
24
+
25
+ ## Installation
26
+
27
+ ```bash
28
+ pip install adss
29
+ ```
30
+
31
+ or
32
+
33
+ ```bash
34
+ git clone https://github.com/schwarzam/adss.git
35
+ cd adss
36
+ pip install .
37
+ ```
38
+
39
+
40
+ ### About ADSS compatible services
41
+
42
+ ADSS is a project that is still under development. Currently, some of the ADSS services are available at [https://ai-scope.cbpf.br/](https://ai-scope.cbpf.br/) and [https://splus.cloud/](https://splus.cloud/).
43
+
44
+ ### New Features
45
+
46
+ ADSS supports different queries, including cone searches, cross-matches between tables, and cross-matches against user-supplied data. The library supports both synchronous and asynchronous query execution.
47
+
48
+ Also some improvements in the ADQL parsing were made, allowing queries with wildcards in the SELECT statement, such as:
49
+
50
+ ```sql
51
+ SELECT psf_* FROM my_table WHERE CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
52
+ ```
53
+
54
+ This will select all columns that start with "psf_".
55
+
56
+
57
+ ### Starting a client
58
+
59
+ To start using ADSS, you need to initialize a client with the base URL of the ADSS service and your credentials. Here's an example:
60
+
61
+ ```python
62
+ import adss
63
+
64
+ cl = adss.ADSSClient(
65
+ base_url="https://ai-scope.cbpf.br/",
66
+ username="your_username",
67
+ password="your_password"
68
+ )
69
+ ```
70
+
71
+ The client will handle authentication and session management for you.
72
+
73
+ ### Performing Queries
74
+
75
+ You can perform various types of queries using the client. ADSS inherited a lot of the concept of the Table Access Protocol (TAP). Specially the sync and async modes of queries.
76
+
77
+ - **Synchronous Queries** (Short Lived Queries): These queries are executed immediately, and the results are returned in the body of the first request if found! With a timeout of ~10 seconds usually. Good for small tables or queries that return a small number of rows <1000. Example:
78
+
79
+ ```python
80
+ cl.query(
81
+ """
82
+ select *
83
+ from my_table
84
+ where CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', 150.0, 2.0, 0.1))=1
85
+ """
86
+ )
87
+ ```
88
+
89
+ - **Asynchronous Queries**: These queries are executed in the background, and you can check the status of the query and retrieve the results once they are ready. Good for large tables or queries that return a large number of rows or long queries.
90
+
91
+ We have two ways of doing async queries. This first send the query to the server and wait until it's done. Example:
92
+
93
+ ```python
94
+ tab = cl.query_and_wait(
95
+ query_text="""
96
+ select top 100 *
97
+ from splus.splus_idr6 where field = 'HYDRA-0091'
98
+ """,
99
+ mode="adql", # or sql
100
+ file=None, # dataframe
101
+ table_name=None,
102
+ )
103
+ # Print the dataframe
104
+ print(tab.data)
105
+ ```
106
+
107
+ The second way is a more controlled way, where you create the query, check the status and fetch the when you want results:
108
+
109
+ ```python
110
+
111
+ # Create a asynchronous query
112
+ query = cl.async_query(
113
+ query_text="""
114
+ select top 100 id, ra, dec, mag_psf*
115
+ from splus.splus_idr6 where field = 'HYDRA-0091'
116
+ """,
117
+ mode="adql", # or sql
118
+ file=None, # dataframe
119
+ table_name=None,
120
+ )
121
+
122
+ # Check the status of the query and fetch results if complete
123
+ query = cl.queries.get_status(query.id)
124
+ if query.is_complete:
125
+ print("Query is complete. Fetching results...")
126
+ results = cl.queries.get_results(query.id)
127
+ else:
128
+ print("Query is not complete yet.")
129
+
130
+ ```
131
+
132
+ ### Uploading user tables
133
+
134
+ In the last example we left the `file` and `table_name` parameters as `None`. This means that we are not uploading any user table to the server. If you want to upload a user table, you can do it by passing a pandas DataFrame to the `file` parameter and a name for the table to the `table_name` parameter. **The uploaded table should be referenced as upload.`table_name` in the query.**.
135
+
136
+ ```python
137
+ import pandas as pd
138
+ # Create a sample dataframe
139
+ data = {
140
+ "id": [1, 2, 3],
141
+ "ra": [150.1, 150.2, 150.3],
142
+ "dec": [2.1, 2.2, 2.3]
143
+ }
144
+ df = pd.DataFrame(data)
145
+
146
+ # Create a asynchronous query with user table
147
+ query = cl.query_and_wait(
148
+ query_text="""
149
+ select a.*, b.mag_psf_r
150
+ from upload.my_table as a
151
+ join splus.splus_idr6 as b on a.id = b.id
152
+ """,
153
+ mode="adql", # or sql
154
+ file=df, # dataframe
155
+ table_name="my_table",
156
+ )
157
+
158
+ ### Images - File Collections
159
+
160
+ ADSS also supports downloading images, cutouts, colored images. These are handled as Collections. You can list the available file collections in the database metadata:
161
+
162
+ ```python
163
+ cl.get_image_collections()
164
+ ```
165
+
166
+ ```
167
+ [
168
+ {
169
+ 'name': 'splus dr4',
170
+ 'path': '/dados/splus',
171
+ 'description': 'splus dr4 collection',
172
+ 'id': 1,
173
+ 'created_at': '2025-04-22T15:27:36.698058',
174
+ 'updated_at': '2025-07-31T23:27:51.497554',
175
+ 'last_scanned': '2025-05-08T20:28:54.420350',
176
+ 'patterns': {'': 'swp.', 'weight': 'weight'}
177
+ }
178
+ ]
179
+ ```
180
+
181
+ And then to list the files in a collection:
182
+
183
+ ```python
184
+ cl.list_files(1) ## pass the collection ID
185
+ ```
186
+
187
+ ```
188
+ [
189
+ {
190
+ 'filename': 'SPLUS-s17s23_F515_swpweight.fz',
191
+ 'full_path': '/dados/splus/SPLUS-s17s23 SPLUS-s17s23_F515_swpweight.fz',
192
+ 'file_type': 'fz',
193
+ 'ra_center': 316.45153076969416,
194
+ 'dec_center': -21.580560694390957,
195
+ 'width': 11000,
196
+ 'height': 11000,
197
+ 'pixel_scale': 0.55000000000008,
198
+ 'hdus': 2,
199
+ 'data_hdu': 1,
200
+ 'object_name': 'SPLUS-s17s23',
201
+ 'filter': 'F515',
202
+ 'instrument': 'T80Cam',
203
+ 'telescope': 'T80',
204
+ 'date_obs': None,
205
+ 'file_size': 51353280,
206
+ 'id': 28,
207
+ 'collection_id': 1,
208
+ 'created_at': '2025-04-22T15:35:05.487208',
209
+ 'updated_at': '2025-05-08T19:53:09.541437'},
210
+ },...]
211
+ ```
212
+
213
+ You can then download a file by its filename:
214
+
215
+ ```python
216
+ cl.images.download_file("SPLUS-s17s23_F515_swpweight.fz", download_path=".")
217
+ ```
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "adss"
7
- version = "1.30"
7
+ version = "1.32"
8
8
  description = "Astronomical Data Smart System"
9
9
  readme = "README.md"
10
10
  authors = [{ name = "Gustavo Schwarz", email = "gustavo.b.schwarz@gmail.com" }]
adss-1.30/PKG-INFO DELETED
@@ -1,36 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: adss
3
- Version: 1.30
4
- Summary: Astronomical Data Smart System
5
- Author-email: Gustavo Schwarz <gustavo.b.schwarz@gmail.com>
6
- Project-URL: Homepage, https://github.com/schwarzam/adss
7
- Classifier: Programming Language :: Python :: 3
8
- Requires-Python: >=3.8
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
- Requires-Dist: pyarrow
12
- Requires-Dist: requests
13
- Requires-Dist: astropy
14
- Dynamic: license-file
15
-
16
- # ADSS
17
- Astronomical Data Smart System
18
-
19
- ADSS is a database/server project hosted at CBPF (Brazilian Center for Research in Physics) that provides access to astronomical data from different surveys.
20
-
21
- This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution.
22
-
23
- ## Instalation
24
-
25
- ```bash
26
- pip install adss
27
- ```
28
-
29
- or
30
-
31
- ```bash
32
- git clone https://github.com/schwarzam/adss.git
33
- cd adss
34
- pip install .
35
- ```
36
-
adss-1.30/README.md DELETED
@@ -1,21 +0,0 @@
1
- # ADSS
2
- Astronomical Data Smart System
3
-
4
- ADSS is a database/server project hosted at CBPF (Brazilian Center for Research in Physics) that provides access to astronomical data from different surveys.
5
-
6
- This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution.
7
-
8
- ## Instalation
9
-
10
- ```bash
11
- pip install adss
12
- ```
13
-
14
- or
15
-
16
- ```bash
17
- git clone https://github.com/schwarzam/adss.git
18
- cd adss
19
- pip install .
20
- ```
21
-
@@ -1,36 +0,0 @@
1
- Metadata-Version: 2.4
2
- Name: adss
3
- Version: 1.30
4
- Summary: Astronomical Data Smart System
5
- Author-email: Gustavo Schwarz <gustavo.b.schwarz@gmail.com>
6
- Project-URL: Homepage, https://github.com/schwarzam/adss
7
- Classifier: Programming Language :: Python :: 3
8
- Requires-Python: >=3.8
9
- Description-Content-Type: text/markdown
10
- License-File: LICENSE
11
- Requires-Dist: pyarrow
12
- Requires-Dist: requests
13
- Requires-Dist: astropy
14
- Dynamic: license-file
15
-
16
- # ADSS
17
- Astronomical Data Smart System
18
-
19
- ADSS is a database/server project hosted at CBPF (Brazilian Center for Research in Physics) that provides access to astronomical data from different surveys.
20
-
21
- This repository provides a set of tools for querying astronomical ADSS services using ADQL. You can perform cone searches, cross-match queries between tables, and even cross-match against user-supplied data. The library supports both synchronous and asynchronous query execution.
22
-
23
- ## Instalation
24
-
25
- ```bash
26
- pip install adss
27
- ```
28
-
29
- or
30
-
31
- ```bash
32
- git clone https://github.com/schwarzam/adss.git
33
- cd adss
34
- pip install .
35
- ```
36
-
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes