ChangeLog for pysas
=================

Version 2.3.0 - 2026-??-?? (RT)
---------------

+ FileMain : Added superclass for file handling. Subclasses are: ObsID and PPSFiles
             ObsID class handles ODF files.
             PPSFiles class handles PPS files.

+ PPSFiles : Added PPSFiles class. Contains special methods for interacting with PPS
             files, along with stored paths and filenames to key PPS files.

+ _data    : Added directory named '_data' to contain pySAS data files. Currently
             only contains the file 'PPS_product_names.json'.

+ PPS_product_names.json : File containing dictionaries with values needed to 
                           reconstruct PPS filenames. Has dictionaries for:
                           EPIC_products, RGS_products, and Obs_products (general).

+ _attic    : Directory created to hold unused code (but still needs to be preserved).

- All unused SAS tasks moved to _attic. Delisted from 'pysaspkgs'.
    - pyeslewchain
    - pyeslewsearch
    - pymakethumbs
    - pyomdrifthist
    - pyomgchain
    - pyrgsspecplot
    - rgsbkgsmoothing
    - rgsdupframesfix
    - XMMextractor_tools
    - xmmextractorGUI

- configutils.py : Moved to _attic.

Version 2.2.0 - 2025-10-15 (RT)
---------------

+ sas_config : Added sas_config class to __init__.py. Simplifies configuration 
               settings, and how pySAS handles the config file. Allows it to 
               work seamlessly on Fornax.

- configutils.py : Depricated and replaced by sas_config.

+ config_pysas.py : Modified to use sas_config.

Version 2.1.0 - 2025-09-10 (RT)
---------------

- xmmextractorGUI : Made xmmextractorGUI uncallable. It requires pyds9 to run, and pyds9
                    is no longer being actively maintained. In the next few months users
                    will no longer be able to install pyds9 using pip with the latest 
                    versions of Python and setuptools (standard).

Version 2.0 - 2025-07-25 (RT)
---------------
+ pysaspkgs : List of callable pysas packages. Previously pkgutil.walk_packages was used,
              but there were bugs with this and the list of packages returned didn't match 
              the list of actual packages. The list of packages is now read in using 
              importlib.resources.

- runtask.py: File has been removed and all functionality has been transferred to 
	          sastask.py. It only added an extra layer to the process.

+ sastask.py: The class SASTask has been deprecated since it was only an abstract class, 
	          with only abstract methods and a single child, MyTask. MyTask was the only 
	          class used in the rest of the code. To simplify things, MyTask has been 
	          made the only useful class, but SASTask is declared as a child of MyTask
              for legacy purposes, until all references to it can be removed.

	          Functionality from runtask has been placed in the 'run' method in MyTask.
              The method 'runtask' has been kept as a place holder for legacy code. It 
              just calls 'run'.

              Changed how options that affect environment variables are handled. For 
              Python based SAS tasks, pySAS will *temporarily* change the environment 
              variables, run the task, and then restore the environment variables to
              their previous setting. For non-Python based SAS tasks, these options are
              passed to the subprocess command to run the task.

              Options that will execute and exit are:
                -v (version)
                -h (help)
                -p (param)
                -d (dialog)
                -m (manpage)

              For **only** Python based tasks:
              Options that will *temporarily* set environment variables are:
                -V (SAS_VERBOSITY)
                -a (SAS_CCFPATH)
                -i (SAS_CCF)
                -o (SAS_ODF)

               Options that are not handled for Python based SAS tasks (but are
               passed to the task in 'iparsdic', so in principle they can be used.)
                -f/--ccffiles
                -w/--warning
                -t/--trace

- wrapper.py: The Wrapper class has been deprecated since its only function was to create 
              a MyTask object. It has been left in place until legacy code can be switched
              over to MyTask.

+ logger.py : The logging module 'loguru' has been added with a function 'get_logger'. This
              returns a loguru logger object with options to output to the terminal (default)
              and/or to a log file. The user typically does not interact directly with the 
              'get_logger' function, but through the MyTask object which accepts all 
              necessary inputs.

	          The user can declare a directory for the log files, or even a single log file
              for all output from all SAS tasks called.

+ version.py: At the top level version.py only contains the version information for pySAS.
              For independent tasks they maintain their own version numbers, but for all
              other subdirectories they all point to the master pySAS version file.

	          get_sas_version dedicated function to run 'sasversion' and get SAS version 
              information.

+ */version.py: All version files for individual SAS tasks now only contain their version
                information.

	            Justification: Each individual Python based task should not keep track of 
	            which SAS version it was compiled with 

+ print_version.py: Replaces 'sasver'. SAS version information can now be printed using
                    pysas.print_sas_version()

- sasver    : Subdirectory has been removed. All functionality has been transferred to 
              pysas.print_sas_version()

- write_version.py: write_version.py and */write_version.py files have been removed since 
                    they cannot be used by the end user.

+ obsid     : obsid.py introduced. Replaces odfcontrol.
              Significant changes to pySAS.
              
              New class: ObsID

              New and replacement methods from odfcontrol (methods with leading __ are not 
              accessible to the end user):

                1. __set_obsid: Not accessible to the end user. Auto detects if Obs ID data
                   is present, and looks for event lists and other critical files. 
                   Automatically called when ObsID object is instantiated.
            
                2. basic_setup: Downloads data, runs cifbuild, odfingest, epproc or epchain,
                   emproc or emchain, and rgsproc.

                3. run_MyTask: Convienence wrapper around 'MyTask'. Used to call a task 
                   from the ObsID object.

                4. download_ODF_data: Downloads ODF data. Called by basic_setup.

                5. download_PPS_data: Downloads PPS data.

                6. download_ALL_data: Downloads both ODF and PPS data.

                7. calibrate_odf: Runs cifbuild and odfingest. Called by basic_setup.

                8. get_active_instruments: Creates active_instruments dict with boolean
                   values indicating if the instrument was active for that Obs ID.

                9. inisas: Can reinitialize SAS. Generally not used.

                10. sas_talk: Changes SAS_VERBOSITY and SAS_SUPPRESS_WARNING

                11. find_event_list_files: Checks the observation directory (obs_dir) for
                    basic unfiltered event list files created by 'epproc', 'emproc', 
                    and 'rgsproc'.

                12. find_rgs_spectra_files: Checks obs_dir for RGS spectra files created 
                    by 'rgsproc'.

                13. get_ccf_cif: Stores ccf.cif file path in ObsID.files.

                14. get_SUM_SAS: Stores *SUM.SAS file path in ObsID.files.

                15. clear_obs_dir: Removes all files and subdirectories from the obs_dir.

                16. clear_work_dir: Removes all files and subdirectories from the work_dir.

                17. quick_eplot: Runs 'evselect' on an event list to create a simple image 
                    file. Then uses 'quick_image_plot' from 'pysasplot_utils' to plot the 
                    image using matplotlib.

                18. quick_lcplot: Runs 'evselect' on an event list to create a simple light 
                    curve file. Then uses 'quick_light_curve_plot' from 'pysasplot_utils' to 
                    plot the light curve using matplotlib.

                19. __run_analysis: Used by 'basic_setup' to run epproc or epchain,
                    emproc or emchain, and rgsproc.

                20. __run_calibration: Called by calibrate_odf to actually run cifbuild and 
                    odfingest.

                21. __reset_logger: Used to reset the logger object with different inputs.

                22. __parse_obs_dir: Parses the obs_dir to see what is there (ODF files, 
                    PPS files, ccf.cif file, manifest, event lists, etc.).

                23. __set_data_dir: Sets the data_dir.

                24. __check_for_ccf_cif: Checks for existence of the ccf.cif file.
                    Does not return path.

                25. __check_for_SUM_SAS: Checks for existence of the *SUM.SAS file. 
                    Does not return path.

                26. __check_for_manifest: Checks for existence of the MANIFEST file. 
                    Does not return path.

                27. __get_list_of_ODF_files: Returns list of files in odf_dir.

                28. __get_list_of_PPS_files: Returns list of files in pps_dir.

                29. __remove_attr: Can be used to remove an attribute from the 
                    ObsID object.

+ parser.py : Update documentation, add logger to ParseArgs, changed 'taskparser' 
              to 'optparser'. 'procopt' has been split into 'exe_options' and 
              'env_options' to handle options that require immediate action
              (exe_options), and options that handle environment variables 
              (env_options).

              When options that affect environment variables are passed back to 
              MyTask, for Python based tasks the environment variables will be 
              set temporarily, and then reset after the task finishes. For 
              non-Python based tasks these options will be passed directly to the 
              task through the subprocess call.

+ param.py  : Update documentation, add logger to paramXmlInfoReader.
              
              Add 'SASParams' dict for returning defaults to the user. 
              If the user modifies the default values, SASParams will keep track 
              of which parameters have been modified.

              Include function 'get_input_params' that returns a filled out 
              SASParams dict with the default parameters. Recommended that the 
              user get a SASParams dict *only* through 'get_input_params'.

+ pysasplot_utils.py: Updated to include two new functions:

                1. quick_image_plot: Uses matplotlib to plot a simple 
                   FITS image file.
                2. quick_light_curve_plot: Uses matplotlib to plot a simple 
                   light curve file.

            Both are intended to be used with ObsID.quick_eplot and 
            ObsID.quick_lcplot respectively.


