Package: pyGCG
pyGCG: GLASS-JWST Classification GUIA Python GUI to aid in viewing and classifying NIRISS data products from GLASS-JWST.InstallationIn all cases, it is strongly recommended to installpyGCGinto a new virtual environment, to minimise dependency conflicts (seeRequirements).Using pip (recommended)pyGCGcan be installed directly from thePython Package Index (PyPI), by running:pip install --upgrade pygcgBuilding from sourceAlternatively, to clone the latest GitHub repository, use this command:git clone https://github.com/PJ-Watson/pyGCG.gitTo build and installpyGCG, run (from the root of the source tree):pip install .UsageLaunching the GUIIn the most basic configuration,pyGCGcan be run in a Python session as follows:frompygcg.GUI_mainimportrun_apprun_app()Alternatively,pyGCGcan be launched from the terminal using a single line:python -c "from pygcg.GUI_main import run_app; run_app()"Configuration fileWhen launchingpyGCG, one can pass the path of a configuration file using theconfig_filekeyword:frompygcg.GUI_mainimportrun_apprun_app(config_file="/path/to/your/config.toml")By default,pyGCGwill look forconfig.tomlin the current working directory, and will create this file if it doesn't exist, using the includedexample_config.toml.
This file will also be created if the supplied configuration file is invalid.The configuration file is TOML-formatted and organised into various sections, or tables.FilesThis table describes the location of the necessary files and directories.KeyDescriptionextractions_dirThe directory in which NIRISS extractions are stored. By default, this is assumed to contain all ancillary data (catalogue, segmentation maps, direct images).out_dirThe directory in which thepyGCGoutput will be stored. If no directory is provided, or it is not possible to create the supplied directory,pyGCGwill run in read-only mode.cat_pathThe file path of the input catalogue. By default,pyGCGwill search for a file matching*ir.cat.fitsinsideextractions_dir. The catalogue must contain columns that can be interpreted asid,ra, anddec(seeCatalogue).prep_dirIf different toextractions_dir, this can be used to specify the directory containing the segmentation map and direct images.cube_pathThe file path of the corresponding MUSE datacube.temp_dirThe directory in which temporary files are stored. Defaults to{out_dir}/.temp/.skip_existingIfTrue,pyGCGwill skip loading objects which already exist in the output catalogue.out_cat_nameThe name of the output catalogue. Defaults topyGCG_output.fits.GrismsThis table specifies the grism filters and position angles used in observations.KeyDefaultDescriptionR"F200W"The name of the grism filter that will be mapped to the red channel in the RGB image. Conventionally, this would be the filter covering the longest wavelengths.G"F150W"Same as above, but for the green channel.B"F115W"Same as above, but for the blue channel.PA172.0The position angle (in degrees) of the first grism orientation.PA2341.0Same as above, but for the second grism orientation.CatalogueThis table can be used to specify non-standard column names (compared to the defaultgrizlicatalogue).KeyDefaultDescriptionid"NUMBER"The unique label used to identify objects. Any type which can be represented as a string is acceptable.ra"X_WORLD"The right ascension of the object, assumed to be in degrees if no unit is present.dec"Y_WORLD"The declination of the object, assumed to be in degrees if no unit is present.seg_id"NUMBER"The unique number corresponding to the object identification in thegrizlisegmentation map and extractions (e.g.nis-wfss_{seg_id}.1D.fits). By default, this is also used as the objectid. Ifseg_idis supplied, but not a valid catalogue column name, a warning will be raised.seg_id_length5The number of characters used forseg_id, which is assumed to be zero-padded (e.g.76 -> 00076).mag"MAG_AUTO"The magnitude of the object. If not supplied, or the column name does not exist, this will not be displayed rather than raising an error.radius5The radius of the object. This will fail silently if not found, in the same way asmag.plate_scaleNoneIn arcsec/pixel. By default,radiuswill be displayed alongside any units included in the catalogue. If plate scale is specified,radiusis taken to be in pixels, and converted to angular units usingplate_scale.LinesIn theSpectrumtab, it is possible to overlay the positions of reference lines at a given redshift. These take the following format:[lines.emission.Lyman_alpha]tex_name='Ly$\alpha$'centre=1215.24pyGCGcurrently supports grouping lines into two categories,emissionandabsorption.
The visibility of these groups can be toggled separately.The key for each line,[lines.emission.XXX], must be unique.
There is no such requirement fortex_name, which uses theMatplotlib Mathtext parserto render the name on the plot.
Note that single quotation marks are used to represent a string literal in TOML.centreis self-evidently the centre of the line, and is given in angstroms.AppearanceThese options can be used to change the appearance of the GUI.KeyDefaultDescriptionappearance"system"The overall appearance. Can be one ofsystem(default),light, ordark.theme"blue"TheCustomTkintercolour theme. This can be one ofblue(default),dark-blue, orgreen. This can also point to the location of a custom .json file describing the desired theme.RequirementspyGCGhas the following strict requirements:Python3.10 or laterNumPy1.24 or laterMatplotlib3.6 or laterAstropy5.3 or laterCustomTkinter5.2 or laterCTkMessageBox2.5 or laterPhotutils1.9 or laterTOML Kit0.12 or latertqdm4.66 or laterpyGCGhas been tested with Python 3.10, and is developed primarily on Python 3.11. Note that not all of the required packages may yet be compatible with Python 3.12.