<jupyter_start><jupyter_text>How to install GphotonOne way is to run ```pip install gPhoton --user```If you do a system wide install, then gMap will throw permission errors when you run the script locally.   How to run gPhotonWe will start with the `gPhoton` module import. For further information, refer: https://github.com/cmillion/gPhoton/blob/master/docs/UserGuide.md Also, "pretty-print” module for better looking printout.<jupyter_code>import gPhoton
from pprint import pprint<jupyter_output><empty_output><jupyter_text>gFindNow we run the `gFind` command to see what data there is for a specific set of sky coordinates. `GFind` will find the total exposure time available and the time ranges when observations were carried out. The function will print an output and return a nested dictionary.<jupyter_code>gfind_data = gPhoton.gFind(band = 'both', skypos= [352.6346883, -2.462370061])<jupyter_output>NUV: 5864.0s (raw) in 6 exposures.
    [ 750468768.995, 750468872.995 ], 104.000 seconds
    [ 781633226.995, 781634932.995 ], 1706.000 seconds
    [ 781639143.995, 781640848.995 ], 1705.000 seconds
    [ 843691315.995, 843691575.995 ], 260.000 seconds
    [ 843726230.995, 843727803.995 ], 1573.000 seconds
    [ 904551520.995, 904552036.995 ], 516.000 seconds
FUV: 5864.0s (raw) in 6 exposures.
    [ 750468768.995, 750468872.995 ], 104.000 seconds
    [ 781633226.995, 781634932.995 ], 1706.000 seconds
    [ 781639143.995, 781640848.995 ], 1705.000 seconds
    [ 843691315.995, 843691575.995 ], 260.000 seconds
    [ 843726230.995, 843727803.995 ], 1573.000 seconds
    [ 904551520.995, 904552036.995 ], 516.000 seconds<jupyter_text>`gFind` outputs a nested dictionary which we have directed to the variable `gfind_data`<jupyter_code>pprint(gfind_data)<jupyter_output>{'FUV': {'expt': 5864.0,
         'nearest_source': {'distance': 0.00014058602577707882,
                            'mag': 18.22825,
                            'skypos': [352.634607547268, -2.46248519337688]},
         't0': array([7.50468769e+08, 7.81633227e+08, 7.81639144e+08, 8.43691316e+08,
       8.43726231e+08, 9.04551521e+08]),
         't1': array([7.50468873e+08, 7.81634933e+08, 7.81640849e+08, 8.43691576e+08,
       8.43727804e+08, 9.04552037e+08])},
 'NUV': {'expt': 5864.0,
         'nearest_source': {'distance': 0.00014058602577707882,
                            'mag': 17.76419,
                            'skypos': [352.634607547268, -2.46248519337688]},
         't0': array([7.50468769e+08, 7.81633227e+08, 7.81639144e+08, 8.43691316e+08,
       8.43726231e+08, 9.04551521e+08]),
         't1': array([7.50468873e+08, 7.81634933e+08, 7.81640849e+08, 8.43691576e+08,
       8.43727804e+08, 9.04552037e+08])}}<jupyter_text>The contents can be accessed as follows. Examples galore.<jupyter_code>pprint(gfind_data['FUV'])
pprint(gfind_data['FUV']['t0'])
pprint(gfind_data['FUV']['t1'])<jupyter_output>array([7.50468873e+08, 7.81634933e+08, 7.81640849e+08, 8.43691576e+08,
       8.43727804e+08, 9.04552037e+08])<jupyter_text>gMapThis function can be used in order to create images using the GALEX gPhoton database. It can create a datacube as well as a coadded image. Let us first try NUV.<jupyter_code>gPhoton.gMap(band = 'NUV', # it can be either FUV / NUV.
             skypos = [352.6346883, -2.462370061], # the coordinates of the source.
             skyrange=[0.1, 0.1], # size of the image to be created in degrees.
             cntfile='nuv_cube.fits', # datacube file name (a more obvious name with the source would be preferred).
             cntcoaddfile= 'nuv_coadd.fits') # coadded image file name (a more obvious name with the source would be preferred).<jupyter_output><empty_output><jupyter_text>After a successful run, you will be able to find nuv_cube.fits and nuv_coadd.fits. Now let us run `gMap` for FUV<jupyter_code>gPhoton.gMap(band = 'FUV', # it can be either FUV / NUV.
             skypos = [352.6346883, -2.462370061], # the coordinates of the source.
             skyrange=[0.1, 0.1], # size of the image to be created in degrees.
             cntfile='fuv_cube.fits', # datacube file name (a more obvious name with the source would be preferred).
             cntcoaddfile= 'fuv_coadd.fits') # coadded image file name (a more obvious name with the source would be preferred).<jupyter_output><empty_output><jupyter_text>gApertureIt can be used to get flux measurements for one particular source in different epochs. You can either specify the size of the time bins to use or let `gAperture` calculate flux measurements for each time ranges. The argument `stepsz` can be used to specify the time bin size in seconds. Aperture size needs to be specified in degrees. Optionally, background annulus can also be given. Once executed, gAperture will return a .CSV file as output. Let us first try with NUV band.<jupyter_code>gPhoton.gAperture(band = 'NUV', # it can be either FUV / NUV.
                   skypos = [352.6346883, -2.462370061], # the coordinates of the source.
                   radius=0.005, # Source aperture radius in degrees.
                   annulus=[0.0055, 0.0065], # [annulus inner radius, annulus outer radius] in degrees for background estimation.
                   csvfile= 'nameofsource_NUV.csv')<jupyter_output><empty_output><jupyter_text>Check the CSV file nameofsource_NUV.csv and plot the light curve. Next, let us try FUV.<jupyter_code>gPhoton.gAperture(band = 'FUV', # it can be either FUV / NUV.
                   skypos = [352.6346883, -2.462370061], # the coordinates of the source.
                   radius=0.005, # Source aperture radius in degrees.
                   annulus=[0.0055, 0.0065], # [annulus inner radius, annulus outer radius] in degrees for background estimation.
                   csvfile= 'nameofsource_FUV.csv')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10872920596810152, 'fraction_numerical': 0.16738123820956954, 'mean_word_length': 3.4349809885931557, 'pattern_counts': {'":': 0, '<': 30, '<?xml version=': 0, '>': 30, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '8', 'dir': 'jupyter-structured-clean-dedup', 'id': '270069', 'license': 'Apache-2.0', 'n_tokens_mistral': 2629, 'n_tokens_neox': 1995, 'n_words': 573, 'path': 'gPhoton.ipynb', 'repo_name': 'prajwel/astronomy_with_jupyter', 'size': '5831'}