Splusdata
connect
Class that logs in into splus.cloud and perform all types of download operation.
Source code in splusdata/connect.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|
__init__(username=None, password=None)
Class may be initialized with splus.cloud user and password. If left in blanck, user and password will be asked on the runtime. Once logged in you may use all main tools from this class.
Examples:
>>> conn = splusdata.connect('spcloud_user', 'password')
You're connected.
>>> conn.get_cut(ra=0.1, dec=0.1, radius=100, band='R')
[<astropy.io.fits.hdu.image.PrimaryHDU object at 0x7f1bd283fe80>, <astropy.io.fits.hdu.compressed.CompImageHDU object at 0x7f1bd283fca0>]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
username |
str
|
splus.cloud username |
None
|
password |
str
|
splus.cloud pasword |
None
|
Source code in splusdata/connect.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
checkcoords(ra, dec)
Check if coords are in footprint
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
Returns:
Name | Type | Description |
---|---|---|
dict | result. |
Source code in splusdata/connect.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 |
|
get_band_img(ra, dec, radius, band='R', mode='linear', option=1)
Get image composed with one band.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
radius |
int
|
Image size in pixels. Final size will be (radius X radius) |
required |
band |
str
|
Band to compose image. Defaults to 'R'. |
'R'
|
mode |
str
|
Mode. Defaults to 'linear'. |
'linear'
|
option |
str
|
in case a coordinate overlap over two fields, use option = 2 if you want the second field. |
1
|
Returns:
Type | Description |
---|---|
PIL.Image: Image requested |
Source code in splusdata/connect.py
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
get_cut(ra, dec, radius, band, filepath=None, option=1)
Get fits cut.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
radius |
int
|
Image size in pixels. Final size will be (radius X radius) |
required |
band |
str
|
Band requested |
required |
filepath |
str
|
file path to save result. Defaults to None. |
None
|
option |
str
|
in case a coordinate overlap over two fields, use option = 2 if you want the second field. |
1
|
Returns:
Type | Description |
---|---|
astropy.io.fits: Fits file with image. |
Source code in splusdata/connect.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 |
|
get_cut_weight(ra, dec, radius, band, filepath=None, option=1)
Get weight image fits cut.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
radius |
int
|
Image size in pixels. Final size will be (radius X radius) |
required |
band |
str
|
Band requested |
required |
filepath |
str
|
file path to save result. Defaults to None. |
None
|
option |
str
|
in case a coordinate overlap over two fields, use option = 2 if you want the second field. |
1
|
Returns:
Type | Description |
---|---|
astropy.io.fits: Fits file with image. |
Source code in splusdata/connect.py
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
get_field(field, band)
Get whole 11k field fits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
field name. |
required |
band |
str
|
Band. |
required |
Returns:
Type | Description |
---|---|
astropy.io.fits: Fits file with image. |
Source code in splusdata/connect.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
|
get_field_weight(field, band)
Get whole 11k weight field fits.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field |
str
|
field name. |
required |
band |
str
|
Band. |
required |
Returns:
Type | Description |
---|---|
astropy.io.fits: Fits file with image. |
Source code in splusdata/connect.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 |
|
get_img(ra, dec, radius, R='I', G='R', B='G', stretch=3, Q=8, option=1)
Function to get three band composed images made by lupton.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
radius |
int
|
Image size in pixels. Final size will be (radius X radius) |
required |
R |
str
|
Band to compose red. Defaults to "I". |
'I'
|
G |
str
|
Band to compose green. Defaults to "R". |
'R'
|
B |
str
|
Band to compose blue. Defaults to "G". |
'G'
|
stretch |
int
|
Stretch of image, same of make_lupton_rgb from astropy. Defaults to 3. |
3
|
Q |
int
|
Q of image, same of make_lupton_rgb from astropy. Defaults to 8. |
8
|
option |
str
|
in case a coordinate overlap over two fields, use option = 2 if you want the second field. |
1
|
Returns:
Type | Description |
---|---|
PIL.Image: Image requested |
Source code in splusdata/connect.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 |
|
get_last_result()
If you missed to save your last query or image into a variable, you may get it here.
Returns:
Name | Type | Description |
---|---|---|
_type_ | Last result, may be image or query. |
Source code in splusdata/connect.py
387 388 389 390 391 392 393 |
|
get_tap_tables()
Get info about available tables.
Source code in splusdata/connect.py
241 242 243 244 245 |
|
query(query, table_upload=None, publicdata=None)
Perform async queries on splus cloud TAP service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
query |
str
|
query itself. |
required |
table_upload |
pandas.DataFrame
|
table to upload. Defaults to None. |
None
|
publicdata |
bool
|
If internal wants to access public data. Defaults to None. |
None
|
Returns:
Type | Description |
---|---|
astropy.table.Table: result table. |
Source code in splusdata/connect.py
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 |
|
twelve_band_img(ra, dec, radius, noise=0.15, saturation=0.15, R='R,I,F861,Z', G='G,F515,F660', B='U,F378,F395,F410,F430', option=1)
Function to get twelve band composed images.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ra |
float
|
RA coordinate in degrees. |
required |
dec |
float
|
DEC coordinate in degrees. |
required |
radius |
int
|
Image size in pixels. Final size will be (radius X radius) |
required |
noise |
float
|
Image noise value. Defaults to 0.15. |
0.15
|
saturation |
float
|
Image saturation value. Defaults to 0.15. |
0.15
|
R |
str
|
Combinations of bands to compose red. Defaults to "R,I,F861,Z". |
'R,I,F861,Z'
|
G |
str
|
Combinations of bands to compose green. Defaults to "G,F515,F660". |
'G,F515,F660'
|
B |
str
|
Combinations of bands to compose blue. Defaults to "U,F378,F395,F410,F430". |
'U,F378,F395,F410,F430'
|
option |
str
|
in case a coordinate overlap over two fields, use option = 2 if you want the second field. |
1
|
Returns:
Type | Description |
---|---|
PIL.Image: Image requested |
Source code in splusdata/connect.py
57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|