43     if (streaks.size() > 0) {
    44       streaks.sort(std::greater<std::size_t>());
    45       std::size_t max_streak = streaks.front();
    46       for (std::size_t i=0; i <= max_streak; ++i) {
    48         for (
auto s: streaks) {
    54         wtd[i] = n_steps / ((float) streaks.size());
    61   main(boost::program_options::variables_map args) {
    63     namespace b_po = boost::program_options;
    66                                   << 
"    trajectory from: " << args[
"states"].as<std::string>()
    69     std::set<std::size_t> state_names(states.begin(), states.end());
    70     std::size_t n_frames = states.size();
    71     std::string header_comment = args[
"header"].as<std::string>();
    72     std::map<std::string,float> commentsMap = args[
"commentsMap"].as<std::map<std::string,float>>();
    75     if (args.count(
"output") || args.count(
"distribution") || args.count(
"cores")) {
    78       std::vector<std::size_t> concat_limits;
    79       if (args.count(
"concat-limits")) {
    81                                       << args[
"concat-limits"].as<std::string>() << std::endl;
    83       } 
else if (args.count(
"concat-nframes")) {
    84         std::size_t n_frames_per_subtraj = args[
"concat-nframes"].as<std::size_t>();
    85         for (std::size_t i=n_frames_per_subtraj; i <= n_frames; i += n_frames_per_subtraj) {
    86           concat_limits.push_back(i);
    89         concat_limits = {n_frames};
    95                                     << args[
"windows"].as<std::string>() << std::endl;
    96       std::map<std::size_t, std::size_t> coring_windows;
    98         std::ifstream ifs(args[
"windows"].as<std::string>());
   101         std::size_t state, window;
   102         std::size_t size_for_all = 1;
   104           std::cerr << 
"error: cannot open file '"   105                     << args[
"windows"].as<std::string>()
   110             if (std::isdigit(ifs.peek())) {
   114                 coring_windows[state] = window;
   116                 std::cerr << 
"error: file not correctly formated." << std::endl;
   118             } 
else if (ifs.peek() == 
'*') {
   122                 size_for_all = window;
   124                 std::cerr << 
"error: file not correctly formated." << std::endl;
   127               ifs.ignore(std::numeric_limits<std::streamsize>::max(), 
'\n');
   143         std::size_t undefined_windows = 0;
   144         for (std::size_t name: state_names) {
   145           if ( ! coring_windows.count(name)){
   146             coring_windows[name] = size_for_all;
   151         if (coring_windows.size() == 0) {
   152           commentsMap[
"single_coring_time"] = size_for_all;
   155                 "#\n# coring specific parameters: \n"   156                 "#    %i state-specific coring windows were read\n"   157                 "#    %i frames is used for reamining states\n",
   158                 state_names.size() - undefined_windows, size_for_all));
   160                                       << 
" state-specific coring windows were read" << std::endl;
   161         if (size_for_all > 1) {
   163                                       << 
" frames" << std::endl;
   168       std::vector<std::size_t> cored_traj(n_frames);
   169       std::size_t current_core = states[0];
   170       std::vector<long> cores(n_frames);
   171       std::size_t changed_frames = 0;
   173       std::size_t last_limit = 0;
   174       for (std::size_t next_limit: concat_limits) {
   175         current_core = states[last_limit];
   176         std::size_t next_limit_corrected = std::min(next_limit, n_frames);
   177         for (std::size_t i=last_limit; i < next_limit_corrected; ++i) {
   179           std::size_t w = std::min(i+coring_windows[states[i]], next_limit);
   180           bool is_in_core = 
true;
   181           for (std::size_t j=i+1; j < w; ++j) {
   182             if (states[j] != states[i]) {
   188             current_core = states[i];
   189             cores[i] = current_core;
   194           cored_traj[i] = current_core;
   196         last_limit = next_limit_corrected;
   198       float changed_frames_perc = (float) 100*changed_frames / n_frames;
   200                                     << 
"% of frames were changed\n    " << changed_frames
   201                                     << 
" frames in total"   202                                     << 
"\n    store result in: " << args[
"output"].as<std::string>()
   205       std::string header_coring = header_comment
   207                   + 
"% of frames were changed\n";
   208       if (args.count(
"output")) {
   215       if (args.count(
"cores")) {
   217         Clustering::Tools::write_single_column<long>(args[
"cores"].as<std::string>(),
   223       if (args.count(
"distribution")) {
   225         std::map<std::size_t, std::list<std::size_t>> streaks;
   226         std::size_t current_state = cored_traj[0];
   228         for (std::size_t state: cored_traj) {
   229           if (state == current_state) {
   232             streaks[current_state].push_back(n_counts);
   233             current_state = state;
   237         streaks[current_state].push_back(n_counts);
   242         std::map<std::size_t, WTDMap> etds;
   243         for (std::size_t state: state_names) {
   248         for (
auto state_etd: etds) {
   250           Clustering::Tools::write_map<std::size_t, float>(fname, state_etd.second, header_comment);
   254       std::cerr << 
"\n" << 
"error (coring): nothing to do! please define '--output', '--distribution' or both!" << 
"\n\n";
 
general namespace for clustering package 
 
std::ostream & logger(std::ostream &s)
 
void main(boost::program_options::variables_map args)
controlling function and user interface for boundary corrections 
 
std::map< std::size_t, float > WTDMap
store the waiting time distribution for each state with time vs count. 
 
WTDMap compute_wtd(std::list< std::size_t > streaks)
compute the waiting time distribution for single state