search (class) ∞
-
class
search
(log, ra='', dec='', radiusArcsec='', name='', discInLastDays='', settings=False, comments=False)[source] ∞ Bases:
object
Search the Transient Name Server with various search constraints
Key Arguments
log
– loggersettings
– the settings dictionaryra
– RA of the location being checkeddec
– DEC of the location being searchedradiusArcsec
- the radius of the conesearch to perform against the TNSname
– name of the object to search the TNS fordiscInLastDays
– search the TNS for transient reported in the last X dayscomments
– print the comments from the TNS, note these can be long making table outputs somewhat unreadable. Default False
Usage
To initiate a search object to search the TNS via an object name (either TNS or survey names accepted):
from transientNamer import search tns = search( log=log, name="Gaia16bbi" )
or for a conesearch use something similar to:
from transientNamer import search tns = search( log=log, ra="06:50:36.74", dec="+31:06:44.7", radiusArcsec=5 )
Note the search method can accept coordinates in sexagesimal or decimal defree formats.
To list all new objects reported in the last three weeks, then use:
from transientNamer import search tns = search( log=log, discInLastDays=21 )
Methods
csv
([dirPath])Render the results in csv format
json
([dirPath])Render the results in json format
markdown
([dirPath])Render the results in markdown format
mysql
([tableNamePrefix, dirPath])Render the results as MySQL Insert statements
table
([dirPath])Render the results as an ascii table
yaml
([dirPath])Render the results in yaml format
Properties
The associated source files
The associated source photometry
The results of the search returned as a python list of dictionaries
The associated source spectral data
The generated URL used for searching of the TNS
-
csv
(dirPath=None)[source] ∞ Render the results in csv format
Key Arguments
dirPath
– the path to the directory to save the rendered results to. Default None
Return
csvSources
– the top-level transient datacsvPhot
– all photometry associated with the transientscsvSpec
– all spectral data associated with the transientscsvFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in csv format:
csvSources, csvPhot, csvSpec, csvFiles = tns.csv() print(csvSources)
TNSId,TNSName,discoveryName,discSurvey,raSex,decSex,raDeg,decDeg,transRedshift,specType,discMag,discMagFilter,discDate,objectUrl,hostName,hostRedshift,separationArcsec,separationNorthArcsec,separationEastArcsec 2016asf,SN2016asf,ASASSN-16cs,ASAS-SN,06:50:36.73,+31:06:45.36,102.6530,31.1126,0.021,SN Ia,17.1,V-Johnson,2016-03-06 08:09:36,https://www.wis-tns.org/object/2016asf,KUG 0647+311,,0.66,0.65,-0.13
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.csv("~/tns")
:width: 800px :alt: csv output
-
json
(dirPath=None)[source] ∞ Render the results in json format
Key Arguments
dirPath
– the path to the directory to save the rendered results to. Default None
Return
jsonSources
– the top-level transient datajsonPhot
– all photometry associated with the transientsjsonSpec
– all spectral data associated with the transientsjsonFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in json format:
jsonSources, jsonPhot, jsonSpec, jsonFiles = tns.json() print(jsonSources)
[ { "TNSId": "2016asf", "TNSName": "SN2016asf", "decDeg": 31.1126, "decSex": "+31:06:45.36", "discDate": "2016-03-06 08:09:36", "discMag": "17.1", "discMagFilter": "V-Johnson", "discSurvey": "ASAS-SN", "discoveryName": "ASASSN-16cs", "hostName": "KUG 0647+311", "hostRedshift": null, "objectUrl": "https://www.wis-tns.org/object/2016asf", "raDeg": 102.65304166666667, "raSex": "06:50:36.73", "separationArcsec": "0.66", "separationEastArcsec": "-0.13", "separationNorthArcsec": "0.65", "specType": "SN Ia", "transRedshift": "0.021" } ]
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.json("~/tns")
:width: 800px :alt: json output
-
markdown
(dirPath=None)[source] ∞ Render the results in markdown format
Key Arguments
dirPath
– the path to the directory to save the rendered results to. Default None
Return
markdownSources
– the top-level transient datamarkdownPhot
– all photometry associated with the transientsmarkdownSpec
– all spectral data associated with the transientsmarkdownFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in markdown table format:
markdownSources, markdownPhot, markdownSpec, markdownFiles = tns.markdown() print(markdownSources)
| TNSId | TNSName | discoveryName | discSurvey | raSex | decSex | raDeg | decDeg | transRedshift | specType | discMag | discMagFilter | discDate | objectUrl | hostName | hostRedshift | separationArcsec | separationNorthArcsec | separationEastArcsec | |:---------|:-----------|:---------------|:------------|:-------------|:--------------|:----------|:---------|:---------------|:----------|:---------|:---------------|:---------------------|:----------------------------------------------|:--------------|:--------------|:------------------|:-----------------------|:----------------------| | 2016asf | SN2016asf | ASASSN-16cs | ASAS-SN | 06:50:36.73 | +31:06:45.36 | 102.6530 | 31.1126 | 0.021 | SN Ia | 17.1 | V-Johnson | 2016-03-06 08:09:36 | https://www.wis-tns.org/object/2016asf | KUG 0647+311 | | 0.66 | 0.65 | -0.13 |
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.markdown("~/tns")
:width: 800px :alt: markdown output
-
mysql
(tableNamePrefix='TNS', dirPath=None)[source] ∞ Render the results as MySQL Insert statements
Key Arguments
tableNamePrefix
– the prefix for the database table names to assign the insert statements to. Default TNS.dirPath
– the path to the directory to save the rendered results to. Default None
Return
mysqlSources
– the top-level transient datamysqlPhot
– all photometry associated with the transientsmysqlSpec
– all spectral data associated with the transientsmysqlFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in mysql insert format:
mysqlSources, mysqlPhot, mysqlSpec, mysqlFiles = tns.mysql("TNS") print(mysqlSources)
INSERT INTO `TNS_sources` (TNSId,TNSName,dateCreated,decDeg,decSex,discDate,discMag,discMagFilter,discSurvey,discoveryName,hostName,hostRedshift,objectUrl,raDeg,raSex,separationArcsec,separationEastArcsec,separationNorthArcsec,specType,transRedshift) VALUES ("2016asf" ,"SN2016asf" ,"2016-09-20T11:22:13" ,"31.1126" ,"+31:06:45.36" ,"2016-03-06 08:09:36" ,"17.1" ,"V-Johnson" ,"ASAS-SN" ,"ASASSN-16cs" ,"KUG 0647+311" ,null ,"https://www.wis-tns.org/object/2016asf" ,"102.653041667" ,"06:50:36.73" ,"0.66" ,"-0.13" ,"0.65" ,"SN Ia" ,"0.021") ON DUPLICATE KEY UPDATE TNSId="2016asf", TNSName="SN2016asf", dateCreated="2016-09-20T11:22:13", decDeg="31.1126", decSex="+31:06:45.36", discDate="2016-03-06 08:09:36", discMag="17.1", discMagFilter="V-Johnson", discSurvey="ASAS-SN", discoveryName="ASASSN-16cs", hostName="KUG 0647+311", hostRedshift=null, objectUrl="https://www.wis-tns.org/object/2016asf", raDeg="102.653041667", raSex="06:50:36.73", separationArcsec="0.66", separationEastArcsec="-0.13", separationNorthArcsec="0.65", specType="SN Ia", transRedshift="0.021", updated=1, dateLastModified=NOW() ;
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.mysql("TNS", "~/tns")
:width: 800px :alt: mysql output
-
table
(dirPath=None)[source] ∞ Render the results as an ascii table
Key Arguments
dirPath
– the path to the directory to save the rendered results to. Default None
Return
tableSources
– the top-level transient datatablePhot
– all photometry associated with the transientstableSpec
– all spectral data associated with the transientstableFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in ascii table format:
tableSources, tablePhot, tableSpec, tableFiles = tns.table() print(tableSources)
+----------+------------+----------------+-------------+--------------+---------------+-----------+----------+----------------+-----------+----------+----------------+----------------------+-----------------------------------------------+---------------+---------------+-------------------+------------------------+-----------------------+ | TNSId | TNSName | discoveryName | discSurvey | raSex | decSex | raDeg | decDeg | transRedshift | specType | discMag | discMagFilter | discDate | objectUrl | hostName | hostRedshift | separationArcsec | separationNorthArcsec | separationEastArcsec | +----------+------------+----------------+-------------+--------------+---------------+-----------+----------+----------------+-----------+----------+----------------+----------------------+-----------------------------------------------+---------------+---------------+-------------------+------------------------+-----------------------+ | 2016asf | SN2016asf | ASASSN-16cs | ASAS-SN | 06:50:36.73 | +31:06:45.36 | 102.6530 | 31.1126 | 0.021 | SN Ia | 17.1 | V-Johnson | 2016-03-06 08:09:36 | https://www.wis-tns.org/object/2016asf | KUG 0647+311 | | 0.66 | 0.65 | -0.13 | +----------+------------+----------------+-------------+--------------+---------------+-----------+----------+----------------+-----------+----------+----------------+----------------------+-----------------------------------------------+---------------+---------------+-------------------+------------------------+-----------------------+
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.table("~/tns")
:width: 800px :alt: ascii files
-
yaml
(dirPath=None)[source] ∞ Render the results in yaml format
Key Arguments
dirPath
– the path to the directory to save the rendered results to. Default None
Return
yamlSources
– the top-level transient datayamlPhot
– all photometry associated with the transientsyamlSpec
– all spectral data associated with the transientsyamlFiles
– all files associated with the matched transients found on the tns
Usage
To render the results in yaml format:
yamlSources, yamlPhot, yamlSpec, yamlFiles = tns.yaml() print(yamlSources)
- TNSId: 2016asf TNSName: SN2016asf decDeg: 31.1126 decSex: '+31:06:45.36' discDate: '2016-03-06 08:09:36' discMag: '17.1' discMagFilter: V-Johnson discSurvey: ASAS-SN discoveryName: ASASSN-16cs hostName: KUG 0647+311 hostRedshift: null objectUrl: https://www.wis-tns.org/object/2016asf raDeg: 102.65304166666667 raSex: '06:50:36.73' separationArcsec: '0.66' separationEastArcsec: '-0.13' separationNorthArcsec: '0.65' specType: SN Ia transRedshift: '0.021'
You can save the results to file by passing in a directory path within which to save the files to. The four flavours of data (sources, photometry, spectra and files) are saved to separate files but all data can be assoicated with its transient source using the transient’s unique
TNSId
.tns.yaml("~/tns")
:width: 800px :alt: yaml output
-
property
photometry
[source] ∞ The associated source photometry
Usage
sourcePhotometry = tns.photometry