Skip to content

Commit 206956f

Browse files
committed
Made sure errors are displayed on new line in fit
1 parent 2846653 commit 206956f

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

src/fast++-gridder.cpp

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,11 @@ void gridder_t::cache_manager_t::write_model(const model_t& model) {
1111
file::write(cache_file, model.flux);
1212

1313
if (!cache_file) {
14+
print("");
1415
warning("could not write to cache file anymore");
1516
warning("in case you ran out of disk space, the cache file has been removed");
17+
print("");
18+
1619
cache_file.close();
1720
file::remove(cache_filename);
1821
}
@@ -370,9 +373,11 @@ public :
370373
lib.read(&extras(i,0), ntime);
371374
}
372375
} catch (...) {
376+
print("");
373377
error("could not read data in library file '", filename, "'");
374378
error("could not ", state);
375379
error("the file is probably corrupted, try re-downloading it");
380+
print("");
376381
return false;
377382
}
378383

@@ -521,8 +526,10 @@ bool gridder_t::build_and_send(fitter_t& fitter) {
521526
for (uint_t iz : range(output.z)) {
522527
if (cache.read_model(model)) {
523528
if (model.igrid != model_id(im, it, ia, id, iz)) {
529+
print("");
524530
error("data in the cache file are not what was expected");
525531
error("the cache is probably corrupted, please remove it and try again");
532+
print("");
526533
return false;
527534
}
528535

@@ -534,8 +541,10 @@ bool gridder_t::build_and_send(fitter_t& fitter) {
534541

535542
if (opts.verbose) progress(pg, 131);
536543
} else {
544+
print("");
537545
error("could not read data from cache file");
538546
error("the cache is probably corrupted, please remove it and try again");
547+
print("");
539548
return false;
540549
}
541550
}
@@ -554,7 +563,12 @@ bool gridder_t::build_and_send(fitter_t& fitter) {
554563
}
555564

556565
// Make sure input is correct
557-
phypp_check(is_sorted(ised.age), "galaxev age array is not sorted: ", ised.age);
566+
if (!is_sorted(ised.age)) {
567+
print("");
568+
error("galaxev age array is not sorted");
569+
print("");
570+
return false;
571+
}
558572

559573
// Pre-compute dust law
560574
vec1d dust_law = build_dust_law(ised.lambda);
@@ -573,13 +587,17 @@ bool gridder_t::build_and_send(fitter_t& fitter) {
573587
double nage = e10(output.age[ia]);
574588
auto p = bounds(nage, ised.age);
575589
if (p[0] == npos) {
590+
print("");
576591
error("requested age is lower than allowed by the template library (",
577592
output.age[ia], " vs. ", log10(ised.age.safe[p[1]]), ")");
593+
print("");
578594
return false;
579595
} else if (p[1] == npos) {
580596
if (nage > ised.age.safe[p[0]]) {
597+
print("");
581598
error("requested age is larger than allowed by the template library (",
582599
output.age[ia], " vs. ", log10(ised.age.safe[p[0]]), ")");
600+
print("");
583601
return false;
584602
}
585603

@@ -662,20 +680,29 @@ bool gridder_t::build_template(uint_t im, uint_t it, uint_t ia, uint_t id, uint_
662680
}
663681

664682
// Make sure input is correct
665-
phypp_check(is_sorted(ised.age), "galaxev age array is not sorted: ", ised.age);
683+
if (!is_sorted(ised.age)) {
684+
print("");
685+
error("galaxev age array is not sorted");
686+
print("");
687+
return false;
688+
}
666689

667690
// Interpolate the galaxev grid at the requested age
668691
double nage = e10(output.age[ia]);
669692
auto p = bounds(nage, ised.age);
670693
double mass = 0;
671694
if (p[0] == npos) {
695+
print("");
672696
error("requested age is lower than allowed by the template library (",
673697
output.age[ia], " vs. ", log10(ised.age[p[1]]), ")");
698+
print("");
674699
return false;
675700
} else if (p[1] == npos) {
676701
if (nage > ised.age[p[0]]) {
702+
print("");
677703
error("requested age is larger than allowed by the template library (",
678704
output.age[ia], " vs. ", log10(ised.age[p[0]]), ")");
705+
print("");
679706
return false;
680707
}
681708

0 commit comments

Comments
 (0)