LCOV - code coverage report
Current view: top level - include/ao - aoPaths.hpp (source / functions) Coverage Total Hit
Test: mxlib Lines: 0.0 % 158 0
Test Date: 2026-08-30 22:23:37 Functions: 0.0 % 26 0

            Line data    Source code
       1              : /** \file aoPaths.hpp
       2              :  * \author Jared R. Males (jaredmales@gmail.com)
       3              :  * \brief Standardized paths for the mx::AO system.
       4              :  * \ingroup mxAO_files
       5              :  *
       6              :  */
       7              : 
       8              : #ifndef __aoPaths_hpp__
       9              : #define __aoPaths_hpp__
      10              : 
      11              : #include "../sys/environment.hpp"
      12              : 
      13              : #include "../ioutils/fileUtils.hpp"
      14              : 
      15              : namespace mx
      16              : {
      17              : 
      18              : namespace AO
      19              : {
      20              : 
      21              : /// Namespace for paths
      22              : /** \ingroup mxAO_paths
      23              :  */
      24              : namespace path
      25              : {
      26              : 
      27              : /// Namespace for basis paths
      28              : /** \ingroup mxAO_paths
      29              :  */
      30              : namespace basis
      31              : {
      32              : 
      33              : /// The root path for basis files
      34              : /**
      35              :  * \param[in] basisName the name of the basis
      36              :  * \param[in] create [optional] create the directory if it noes not exist.
      37              :  *
      38              :  * \returns the root path for basis files.
      39              :  *
      40              :  * \ingroup mxAO_paths
      41              :  */
      42            0 : std::string root( const std::string &basisName, bool create = false )
      43              : {
      44              : 
      45            0 :     std::string path = mx::sys::getEnv( "MX_AO_DATADIR" );
      46              : 
      47            0 :     path += "/basis/" + basisName;
      48              : 
      49            0 :     if( create )
      50              :     {
      51            0 :         ioutils::createDirectories( path );
      52              :     }
      53            0 :     return path;
      54            0 : }
      55              : 
      56            0 : std::string modes( const std::string &basisName, bool create = false )
      57              : {
      58            0 :     std::string path = root( basisName, create ) + "/modes.fits";
      59              : 
      60            0 :     return path;
      61              : }
      62              : 
      63            0 : std::string spectrum( const std::string &basisName, bool create = false )
      64              : {
      65            0 :     std::string path = root( basisName, create ) + "/spectrum.fits";
      66              : 
      67            0 :     return path;
      68              : }
      69              : } // namespace basis
      70              : 
      71              : //--------------------------------------------------------------------------------
      72              : 
      73              : namespace dm
      74              : {
      75              : 
      76              : /// The root path for deformable mirror (DM) files
      77              : /**
      78              :  * \param[in] dmName the name of the DM
      79              :  * \param[in] create [optional] create the directory if it noes not exist.
      80              :  *
      81              :  * \returns the root path for DM files.
      82              :  */
      83            0 : std::string root( const std::string &dmName, bool create = false )
      84              : {
      85            0 :     std::string path = mx::sys::getEnv( "MX_AO_DATADIR" );
      86              : 
      87            0 :     path += "/dm/" + dmName;
      88              : 
      89            0 :     if( create )
      90              :     {
      91            0 :         ioutils::createDirectories( path );
      92              :     }
      93              : 
      94            0 :     return path;
      95            0 : }
      96              : 
      97              : /// The path for the deformable mirror (DM) influence functions.
      98              : /**
      99              :  * \param[in] dmName the name of the DM
     100              :  * \param[in] create [optional] create the root directory if it noes not exist.
     101              :  *
     102              :  * \returns the path to the FITS file containing the DM influence functions.
     103              :  */
     104            0 : std::string influenceFunctions( const std::string &dmName, bool create = false )
     105              : {
     106            0 :     std::string path = root( dmName, create ) + "/inf.fits";
     107              : 
     108            0 :     return path;
     109              : }
     110              : 
     111              : /// The path for the deformable mirror (DM) actuator positions
     112              : /**
     113              :  * \param[in] dmName the name of the DM
     114              :  * \param[in] create [optional] create the root directory if it noes not exist.
     115              :  *
     116              :  * \returns the path to the FITS file containing the DM actuator positions
     117              :  */
     118            0 : std::string actuatorPositions( const std::string &dmName, bool create = false )
     119              : {
     120            0 :     std::string path = root( dmName, create ) + "/actPos.fits";
     121              : 
     122            0 :     return path;
     123              : }
     124              : 
     125              : /// The path for the deformable mirror (DM) influence function pseudo-inverse.
     126              : /**
     127              :  * \param[in] dmName the name of the DM
     128              :  * \param[in] create [optional] create the root directory if it noes not exist.
     129              :  *
     130              :  * \returns the path to the FITS file containing the DM influence function pseudo-inverse matrix
     131              :  */
     132            0 : std::string pseudoInverse( const std::string &dmName, bool create = false )
     133              : {
     134            0 :     std::string path = root( dmName, create ) + "/pinv.fits";
     135              : 
     136            0 :     return path;
     137              : }
     138              : 
     139              : /// The path for the deformable mirror (DM) influence function based mirror modes.
     140              : /**
     141              :  * \param[in] dmName the name of the DM
     142              :  * \param[in] create [optional] create the root directory if it noes not exist.
     143              :  *
     144              :  * \returns the path to the FITS file containing the DM influence function based mirror modes
     145              :  */
     146            0 : std::string mirrorModes( const std::string &dmName, bool create = false )
     147              : {
     148            0 :     std::string path = basis::modes( dmName, create );
     149              : 
     150            0 :     return path;
     151              : }
     152              : 
     153              : /// The path for the deformable mirror (DM) influence function pseudo-inverse singular values.
     154              : /**
     155              :  * \param[in] dmName the name of the DM
     156              :  * \param[in] create [optional] create the root directory if it noes not exist.
     157              :  *
     158              :  * \returns the path to the FITS file containing the DM influence function pseudo-inverse singular values
     159              :  */
     160            0 : std::string singularValues( const std::string &dmName, bool create = false )
     161              : {
     162            0 :     std::string path = root( dmName, create ) + "/singularValues.dat";
     163              : 
     164            0 :     return path;
     165              : }
     166              : 
     167              : /// The root path for the deformable mirror (DM) basis related files.
     168              : /**
     169              :  * \param[in] dmName the name of the DM
     170              :  * \param[in] basisName the name of the basis set
     171              :  * \param[in] create [optional] create the root directory if it noes not exist.
     172              :  *
     173              :  * \returns the root path for the DM basis related files
     174              :  */
     175            0 : std::string basisRoot( const std::string &dmName, const std::string &basisName, bool create = false )
     176              : {
     177            0 :     std::string path = root( dmName, create ) + "/basis/" + basisName;
     178              : 
     179            0 :     if( create )
     180              :     {
     181            0 :         ioutils::createDirectories( path );
     182              :     }
     183              : 
     184            0 :     return path;
     185            0 : }
     186              : 
     187              : /// The path for the modes-to-commands (M2c) matrix for a deformable mirror (DM) and a basis set.
     188              : /**
     189              :  * \param[in] dmName the name of the DM
     190              :  * \param[in] basisName the name of the basis set
     191              :  * \param[in] create [optional] create the root directory if it noes not exist.
     192              :  *
     193              :  * \returns the path to the FITS file containting the M2c matrix for a DM and a basis set.
     194              :  */
     195            0 : std::string M2c( const std::string &dmName, const std::string &basisName, bool create = false )
     196              : {
     197            0 :     std::string path = basisRoot( dmName, basisName, create );
     198              : 
     199            0 :     if( create )
     200              :     {
     201            0 :         ioutils::createDirectories( path );
     202              :     }
     203              : 
     204            0 :     path += "/M2c.fits";
     205              : 
     206            0 :     return path;
     207            0 : }
     208              : 
     209              : // ///The path for the modes-to-commands (M2c) matrix for a deformable mirror (DM) and an orthogonalized basis set.
     210              : // /**
     211              : //   * \param[in] dmName the name of the DM
     212              : //   * \param[in] basisName the name of the basis set
     213              : //   * \param[in] create [optional] create the root directory if it noes not exist.
     214              : //   *
     215              : //   * \returns the path to the FITS file containting the Mortho2c matrix for a DM and a basis set.
     216              : //   */
     217              : // std::string Mortho2c(const std::string & dmName, const std::string & basisName, const std::string & pupilName, bool
     218              : // create = false)
     219              : // {
     220              : //
     221              : //    std::string path = basisRoot(dmName, basisName, create);
     222              : //
     223              : //    path += "/" + pupilName;
     224              : //
     225              : //    if(create)
     226              : //    {
     227              : //       ioutils::createDirectories(path);
     228              : //    }
     229              : //
     230              : //    path += "/Mortho2c.fits";
     231              : //
     232              : //    return path;
     233              : // }
     234              : 
     235              : /// The path for the projected modes for a deformable mirror (DM) and a basis set.
     236              : /** These are the modes as reproduced by the DM actuators.
     237              :  *
     238              :  * \param[in] dmName the name of the DM
     239              :  * \param[in] basisName the name of the basis set
     240              :  * \param[in] pupilName the name of the pupil
     241              :  * \param[in] create [optional] create the root directory if it noes not exist.
     242              :  *
     243              :  * \returns the path to the FITS file containting the M2c matrix for a DM and a basis set.
     244              :  */
     245            0 : std::string projectedModes( const std::string &dmName, const std::string &basisName, bool create = false )
     246              : {
     247              : 
     248            0 :     std::string path = basisRoot( dmName, basisName, create );
     249              : 
     250            0 :     if( create )
     251              :     {
     252            0 :         ioutils::createDirectories( path );
     253              :     }
     254              : 
     255            0 :     path += "/projectedModes.fits";
     256              : 
     257            0 :     return path;
     258            0 : }
     259              : 
     260              : // ///The path for the projected modes for a deformable mirror (DM) and an orthogonalized basis set.
     261              : // /** These are the modes as reproduced by the DM actuators.
     262              : //   *
     263              : //   * \param[in] dmName the name of the DM
     264              : //   * \param[in] basisName the name of the basis set
     265              : //   * \param[in] pupilName the name of the pupil
     266              : //   * \param[in] create [optional] create the root directory if it noes not exist.
     267              : //   *
     268              : //   * \returns the path to the FITS file containting the M2c matrix for a DM and a basis set.
     269              : //   */
     270              : // std::string projectedOrthoModes(const std::string & dmName, const std::string & basisName, const std::string &
     271              : // pupilName, bool create = false)
     272              : // {
     273              : //
     274              : //    std::string path = basisRoot(dmName, basisName, create);
     275              : //
     276              : //    path += "/" + pupilName;
     277              : //
     278              : //    if(create)
     279              : //    {
     280              : //       ioutils::createDirectories(path);
     281              : //    }
     282              : //
     283              : //    path += "/projectedOrthoModes.fits";
     284              : //
     285              : //    return path;
     286              : // }
     287              : 
     288              : } // namespace dm
     289              : 
     290              : //--------------------------------------------------------------------------------
     291              : 
     292              : namespace pupil
     293              : {
     294              : /// The root path for pupil files
     295              : /**
     296              :  * \param[in] pupilName the name of the basis
     297              :  * \param[in] create [optional] create the directory if it noes not exist.
     298              :  *
     299              :  * \returns the root path for pupil files.
     300              :  */
     301            0 : std::string root( const std::string &pupilName, bool create = false )
     302              : {
     303              : 
     304            0 :     std::string path = mx::sys::getEnv( "MX_AO_DATADIR" );
     305              : 
     306            0 :     path += "/pupil/" + pupilName;
     307              : 
     308            0 :     if( create )
     309              :     {
     310            0 :         ioutils::createDirectories( path );
     311              :     }
     312              : 
     313            0 :     return path;
     314            0 : }
     315              : 
     316              : /// The path for the pupil FITS file.
     317              : /**
     318              :  * \param[in] pupilName the name of the pupil file
     319              :  * \param[in] create [optional] create the root directory if it noes not exist.
     320              :  *
     321              :  * \returns the path to the FITS file containing the pupil as a 1/0 mask
     322              :  */
     323            0 : std::string pupilFile( const std::string &pupilName, bool create = false )
     324              : {
     325            0 :     std::string path = root( pupilName, create ) + "/pupil.fits";
     326              : 
     327            0 :     return path;
     328              : }
     329              : 
     330              : } // namespace pupil
     331              : 
     332              : //--------------------------------------------------------------------------------
     333              : 
     334              : namespace sys
     335              : {
     336              : 
     337              : /// The root path for system files
     338              : /**
     339              :  * \param[in] sysName the name of the system
     340              :  * \param[in] create [optional] create the directory if it noes not exist.
     341              :  *
     342              :  * \returns the root path for calibration files.
     343              :  */
     344            0 : std::string root( const std::string &sysName, bool create = false )
     345              : {
     346            0 :     std::string path = mx::sys::getEnv( "MX_AO_DATADIR" );
     347              : 
     348            0 :     path += "/system/" + sysName;
     349              : 
     350            0 :     if( create )
     351              :     {
     352            0 :         ioutils::createDirectories( path );
     353              :     }
     354              : 
     355            0 :     return path;
     356            0 : }
     357              : 
     358              : namespace cal
     359              : {
     360              : 
     361              : /// The root path for system calibration files
     362              : /**
     363              :  * \param[in] sysName the name of the system
     364              :  * \param[in] create [optional] create the directory if it noes not exist.
     365              :  *
     366              :  * \returns the root path for calibration files.
     367              :  */
     368            0 : std::string root( const std::string &sysName, bool create = false )
     369              : {
     370              : 
     371            0 :     std::string path = mx::AO::path::sys::root( sysName, create );
     372              : 
     373            0 :     path += "/cal";
     374              : 
     375            0 :     if( create )
     376              :     {
     377            0 :         ioutils::createDirectories( path );
     378              :     }
     379              : 
     380            0 :     return path;
     381            0 : }
     382              : 
     383              : /// Path for the system response calibration
     384            0 : std::string sysResp( const std::string &sysName,
     385              :                      const std::string &dmName,
     386              :                      const std::string &wfsName,
     387              :                      const std::string &pupilName,
     388              :                      const std::string &basisName,
     389              :                      bool create = false )
     390              : {
     391            0 :     std::string path = root( sysName, create );
     392              : 
     393            0 :     path += "/" + dmName + "/" + wfsName + "/" + pupilName + "/" + basisName;
     394              : 
     395            0 :     if( create )
     396              :     {
     397            0 :         ioutils::createDirectories( path );
     398              :     }
     399              : 
     400            0 :     return path;
     401            0 : }
     402              : 
     403              : /// Path for the system response calibration
     404            0 : std::string rMat( const std::string &sysName,
     405              :                   const std::string &dmName,
     406              :                   const std::string &wfsName,
     407              :                   const std::string &pupilName,
     408              :                   const std::string &basisName,
     409              :                   const std::string &id,
     410              :                   bool create = false )
     411              : {
     412              : 
     413            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     414              : 
     415            0 :     path += "/";
     416            0 :     path += "rMat_";
     417              : 
     418            0 :     path += id;
     419            0 :     path += ".fits";
     420              : 
     421            0 :     return path;
     422            0 : }
     423              : 
     424              : /// Path for the system response calibration
     425            0 : std::string rImages( const std::string &sysName,
     426              :                      const std::string &dmName,
     427              :                      const std::string &wfsName,
     428              :                      const std::string &pupilName,
     429              :                      const std::string &basisName,
     430              :                      const std::string &id,
     431              :                      bool create = false )
     432              : {
     433              : 
     434            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     435              : 
     436            0 :     path += "/";
     437            0 :     path += "rImages_";
     438              : 
     439            0 :     path += id;
     440            0 :     path += ".fits";
     441              : 
     442            0 :     return path;
     443            0 : }
     444              : 
     445              : /// Path for the system response interaction matrix
     446            0 : std::string iMat( const std::string &sysName,
     447              :                   const std::string &dmName,
     448              :                   const std::string &wfsName,
     449              :                   const std::string &pupilName,
     450              :                   const std::string &basisName,
     451              :                   const std::string &id,
     452              :                   bool create = false )
     453              : {
     454              : 
     455            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     456              : 
     457            0 :     path += "/";
     458              : 
     459            0 :     path += "iMat_";
     460              : 
     461            0 :     path += id;
     462            0 :     path += ".fits";
     463              : 
     464            0 :     return path;
     465            0 : }
     466              : 
     467              : /// Path for the system response interaction matrix
     468            0 : std::string U( const std::string &sysName,
     469              :                const std::string &dmName,
     470              :                const std::string &wfsName,
     471              :                const std::string &pupilName,
     472              :                const std::string &basisName,
     473              :                const std::string &id,
     474              :                bool create = false )
     475              : {
     476              : 
     477            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     478              : 
     479            0 :     path += "/";
     480              : 
     481            0 :     path += "U_";
     482              : 
     483            0 :     path += id;
     484            0 :     path += ".fits";
     485              : 
     486            0 :     return path;
     487            0 : }
     488              : 
     489              : /// Path for the system response interaction matrix
     490            0 : std::string S( const std::string &sysName,
     491              :                const std::string &dmName,
     492              :                const std::string &wfsName,
     493              :                const std::string &pupilName,
     494              :                const std::string &basisName,
     495              :                const std::string &id,
     496              :                bool create = false )
     497              : {
     498              : 
     499            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     500              : 
     501            0 :     path += "/";
     502              : 
     503            0 :     path += "S_";
     504              : 
     505            0 :     path += id;
     506            0 :     path += ".fits";
     507              : 
     508            0 :     return path;
     509            0 : }
     510              : 
     511              : /// Path for the system response interaction matrix
     512            0 : std::string VT( const std::string &sysName,
     513              :                 const std::string &dmName,
     514              :                 const std::string &wfsName,
     515              :                 const std::string &pupilName,
     516              :                 const std::string &basisName,
     517              :                 const std::string &id,
     518              :                 bool create = false )
     519              : {
     520              : 
     521            0 :     std::string path = sysResp( sysName, dmName, wfsName, pupilName, basisName, create );
     522              : 
     523            0 :     path += "/";
     524              : 
     525            0 :     path += "VT_";
     526              : 
     527            0 :     path += id;
     528            0 :     path += ".fits";
     529              : 
     530            0 :     return path;
     531            0 : }
     532              : 
     533            0 : std::string siGains( const std::string &sysName,
     534              :                      const std::string &dmName,
     535              :                      const std::string &wfsName,
     536              :                      const std::string &pupilName,
     537              :                      const std::string &basisName,
     538              :                      double mag,
     539              :                      bool create = false )
     540              : {
     541            0 :     std::string path = root( sysName, create );
     542            0 :     path += "/" + dmName + "/" + wfsName + "/" + pupilName + "/" + basisName + "/gains/si";
     543              : 
     544            0 :     if( create )
     545              :     {
     546            0 :         ioutils::createDirectories( path );
     547              :     }
     548              : 
     549            0 :     path += "/optg_" + std::to_string( mag ) + "mag.fits";
     550              : 
     551            0 :     return path;
     552            0 : }
     553              : 
     554            0 : std::string lpGains( const std::string &sysName,
     555              :                      const std::string &dmName,
     556              :                      const std::string &wfsName,
     557              :                      const std::string &pupilName,
     558              :                      const std::string &basisName,
     559              :                      double mag,
     560              :                      int lpNc,
     561              :                      bool create = false )
     562              : {
     563            0 :     std::string path = root( sysName, create );
     564            0 :     path += "/" + dmName + "/" + wfsName + "/" + pupilName + "/" + basisName + "/gains/lp";
     565              : 
     566            0 :     if( create )
     567              :     {
     568            0 :         ioutils::createDirectories( path );
     569              :     }
     570              : 
     571            0 :     path += "/optg_" + std::to_string( mag ) + "mag_lpNc_" + std::to_string( lpNc ) + ".fits";
     572              : 
     573            0 :     return path;
     574            0 : }
     575              : 
     576            0 : std::string lpCoeff( const std::string &sysName,
     577              :                      const std::string &dmName,
     578              :                      const std::string &wfsName,
     579              :                      const std::string &pupilName,
     580              :                      const std::string &basisName,
     581              :                      double mag,
     582              :                      int lpNc,
     583              :                      bool create = false )
     584              : {
     585            0 :     std::string path = root( sysName, create );
     586            0 :     path += "/" + dmName + "/" + wfsName + "/" + pupilName + "/" + basisName + "/gains/lp";
     587              : 
     588            0 :     if( create )
     589              :     {
     590            0 :         ioutils::createDirectories( path );
     591              :     }
     592              : 
     593            0 :     path += "/lpc_" + std::to_string( mag ) + "mag_lpNc_" + std::to_string( lpNc ) + ".fits";
     594              : 
     595            0 :     return path;
     596            0 : }
     597              : } // namespace cal
     598              : 
     599              : } // namespace sys
     600              : 
     601              : //--------------------------------------------------------------------------------
     602              : 
     603              : } // namespace path
     604              : 
     605              : } // namespace AO
     606              : 
     607              : } // namespace mx
     608              : 
     609              : #endif //__mxao_hpp__
        

Generated by: LCOV version 2.0-1