SplusService#
- class mergernet.services.splus.SplusService[source]#
Bases:
object
This service class interacts with splus.cloud server over https
- Parameters:
- _batch_download(download_function: function, download_args: List[dict], workers: int | None = None)[source]#
Generic batch download method. This method receives a donwload function and perform a multi-theread execution
- batch_image_download(ra: List[float], dec: List[float], save_path: List[str | Path], img_type: ImageType = ImageType.lupton, workers: int | None = None, **kwargs)[source]#
Downloads a single Lupton RGB image based on object posistion, this method accepts arguments to customize Lupton’s parameters
- Parameters:
save_path (list of str or list of Path) – A list of paths where the file will be saved
img_type (ImageType (optional)) – Can be ImageType.lupton, ImageType.trilogy or ImageType.fits. Defaults to ImageType.lupton
workers (int (optional)) – The number of parallel processes that will be spawned. Default to a single process
kwargs (Any (optional)) – Any optional parameter of download_lupton_rgb if img_type is ImageType.lupton, or any optional parameter of download_trilogy_rgb if img_type is ImageType.trilogy or any optional parameter of download_fits_rgb if img_type is ImageType.fits. These parameters must have the same type as the mentioned functions, i.e. pass a single value instead of a list of values and all images will be downloaded with the same parameter
Examples
>> ra = [172.4, 193.9, 63.3] >> dec = [0.42, 2.63, -1.24] >> paths = [‘fig1.png’, ‘fig2.png’, ‘fig3.png’] >> service.batch_image_download(ra, dec, paths, ImageType.trilogy, … size=256, noise=0.2, saturation=0.2)
- batch_query(sql: List[str], save_path: List[str | Path], replace: bool = False, scope: str = 'public', fmt: str = 'text/csv', workers: int | None = None)[source]#
Sends a batch of queries to splus.cloud database
- Parameters:
save_path (list of str or list of Path) – The path where the query output will be saved
repalace (bool (optional)) – This method checks if a file exists in save_path location before the download. If this parameters is True and a file exists in save_path location, this method will ovewrite the existing file. If this parameter is False and a file exists in sava_path location, this method will skip the download. Default to False
scope (str (optional)) – The splus.cloud scope. Can be public or private. Use private only if you are assigned as collaborator. Defaults to public
fmt (str (optional)) – The mimi-type of query output. Defaults to text/csv
workers (int (optional)) – The number of parallel processes that will be spawned. Defaults to 1
- download_fits(ra: float, dec: float, save_path: str | Path, replace: bool = False, size: int = 128, band: str = 'R')[source]#
Downloads a single FITS image based on object posistion
- Parameters:
ra (float) – The right ascension in degrees
dec (float) – The declination in degrees
save_path (str or Path) – The path where the file will be saved
replace (bool (optional)) – This method checks if a file exists in save_path location before the download. If this parameters is True and a file exists in save_path location, this method will ovewrite the existing file. If this parameter is False and a file exists in sava_path location, this method will skip the download
size (int (optional)) – The image size in pixels
band (str (optional)) – The S-PLUS band of the fits file
- download_lupton_rgb(ra: float, dec: float, save_path: str | Path, replace: bool = False, size: int = 128, r_band: str = 'I', g_band: str = 'R', b_band: str = 'G', stretch: int | float = 3, Q: int | float = 8)[source]#
Downloads a single Lupton RGB image based on object posistion, this method accepts arguments to customize Lupton’s parameters
- Parameters:
ra (float) – The right ascension in degrees
dec (float) – The declination in degrees
save_path (str or Path) – The path where the file will be saved
replace (bool (optional)) – This method checks if a file exists in save_path location before the download. If this parameters is True and a file exists in save_path location, this method will ovewrite the existing file. If this parameter is False and a file exists in sava_path location, this method will skip the download
size (int (optional)) – The image size in pixels
r_band (str (optional)) – The S-PLUS band that will be mapped as R channel of the RGB image
g_band (str (optional)) – The S-PLUS band that will be mapped as G channel of the RGB image
b_band (str (optional)) – The S-PLUS band that will be mapped as B channel of the RGB image
stretch (int or float (optional)) – The stretch parameter of Lupton’s formula
Q (int or float (optional)) – The Q parameter of Lupton’s formula
- download_trilogy_rgb(ra: float, dec: float, save_path: str | Path, replace: bool = False, size: int = 128, r_band: List[str] = ['R', 'I', 'F861', 'Z'], g_band: List[str] = ['G', 'F515', 'F660'], b_band: List[str] = ['U', 'F378', 'F395', 'F410', 'F430'], noise: float = 0.15, saturation: float = 0.15)[source]#
Downloads a single Trilogy RGB image based on object posistion, this method accepts arguments to customize Trilogy parameters
- Parameters:
ra (float) – The right ascension in degrees
dec (float) – The declination in degrees
save_path (str or Path) – The path where the file will be saved
replace (bool (optional)) – This method checks if a file exists in save_path location before the download. If this parameters is True and a file exists in save_path location, this method will ovewrite the existing file. If this parameter is False and a file exists in sava_path location, this method will skip the download
size (int (optional)) – The image size in pixels
r_band (str (optional)) – The S-PLUS band that will be mapped as R channel of the RGB image
g_band (str (optional)) – The S-PLUS band that will be mapped as G channel of the RGB image
b_band (str (optional)) – The S-PLUS band that will be mapped as B channel of the RGB image
noise (int or float (optional)) – The noise parameter of Trilogy algorithm
saturation (int or float (optional)) – The saturation parameter of Trilogy algorithm
- update_token() bool [source]#
Updates splus.cloud authorization token
- Returns:
True if the token was updated and False otherwise
- Return type:
- _lock: Lock = <Lock(owner=None)>#