File: AlgorithmUpdate.h

package info (click to toggle)
purify 2.0.0-5
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 58,688 kB
  • sloc: cpp: 8,410; python: 375; makefile: 7
file content (70 lines) | stat: -rw-r--r-- 2,163 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#ifndef ALGORITHMUPDATE_H
#define ALGORITHMUPDATE_H

#include "purify/config.h"
#include <sopt/imaging_padmm.h>
#include <sopt/relative_variation.h>
#include <sopt/utilities.h>
#include <sopt/wavelets.h>
#include <sopt/wavelets/sara.h>
#include "cmdl.h"
#include "purify/MeasurementOperator.h"
#include "purify/pfitsio.h"
#include "purify/types.h"
#include "purify/utilities.h"

namespace purify {
class AlgorithmUpdate {
  // update function that saves information in algorithm
public:
  AlgorithmUpdate(const purify::Params &params, const utilities::vis_params &uv_data,
                  sopt::algorithm::ImagingProximalADMM<t_complex> &padmm, std::ostream &stream,
                  const MeasurementOperator &measurements,
                  const sopt::LinearTransform<sopt::Vector<sopt::t_complex>> &Psi);

  bool operator()(Vector<t_complex> const &x);

private:
  struct Stats {
    t_int iter = 0;
    t_real new_purify_gamma = 0;
    t_real relative_gamma = 0;
    t_real dr = 0;
    t_real rms = 0;
    t_real max = 0;
    t_real min = 0;
    t_real l1_norm = 0;
    t_real l2_norm = 0;
    t_real l1_variation = 0;
    t_real total_time = 0;
  };

  const Params &params;
  Stats stats;
  const utilities::vis_params &uv_data;
  std::ostream &out_diagnostic;
  sopt::algorithm::ImagingProximalADMM<t_complex> &padmm;
  std::clock_t const c_start;
  const sopt::LinearTransform<sopt::Vector<sopt::t_complex>> &Psi;
  const MeasurementOperator &measurements;

private:
  //! Method to modify gamma
  void modify_gamma(Vector<t_complex> const &alpha);
  //! method to print log to stream
  void print_to_stream(std::ostream &stream);
  //! method to save images to fits files
  void save_figure(const Vector<t_complex> &image, std::string const &output_file_name,
                   std::string const &units, t_real const &upsample_ratio);
  //! method to create fits header
  pfitsio::header_params
  create_header(purify::utilities::vis_params const &uv_data, purify::Params const &params);
  //! read params to stats
  Stats read_params_to_stats(const Params &params) {
    Stats stats;
    stats.iter = params.iter;
    return stats;
  }
};
}
#endif