Open TerenceSperringerJr opened 7 years ago
https://github.com/PublicHealthDynamicsLab/FRED/wiki/Parameter-Sweeps#baseline-parameter-file
Baseline Parameter File First create a file called, for example, params.base that contains parameters that are fixed for all jobs in the parameter sweep. The contents will depend on the purpose if the study. Here is an example:
% cat params.base days = 100 fips = 42065
If I use a parameter instead of fips
for this example (such as counties = 53033
), fred_jobs
will run to completion. Given the error above I'd say that the fips
parameter isn't processing correctly.
Update: Actually it looks like counties = 53033
is ignored and has no effect on the used parameters according to the log.
Update: The problem seems to arise within /FRED/src/Place_List.cc
lines 307 - 341
// get population_id from fips
char line_string[FRED_STRING_SIZE];
char* line;
char* city;
char* state;
char* county;
char* fips;
int found = 0;
int fipsLength = strlen(Global::FIPS_code);
if(fipsLength == 5) {
FILE* fp = Utils::fred_open_file(Place_List::Counties_file);
if(fp == NULL) {
Utils::fred_abort("counties file |%s| NOT FOUND\n", Place_List::Counties_file);
}
while(fgets(line_string, FRED_STRING_SIZE - 1, fp) != NULL) {
line = line_string;
city = strsep(&line, "\t");
state = strsep(&line, "\t");
county = strsep(&line, "\t");
fips = strsep(&line, "\n");
// printf("city = |%s| state = |%s| county = |%s| fips = |%s|\n",
// city,state,county,fips);
if(strcmp(Global::FIPS_code, fips) == 0) {
found = 1;
break;
}
}
fclose(fp);
if(found) {
Utils::fred_log("FOUND a county = |%s County %s| for fips = |%s|\n", county, state, fips);
sprintf(Global::Synthetic_population_id, "%s_%s", Global::Synthetic_population_version, fips);
} else {
Utils::fred_abort("Sorry, could not find a county for fips = |%s|\n", Global::FIPS_code);
}
} else if(fipsLength == 2) {
I uncommented the printf()
instruction after the strsep()
calls and it turns out the problem is Unix newline characters not accounting for Windows-styled carriage return line feed
newlines. My idea is to remove any carriage return
characters whenever a newline character is found.
RESOLVED Cygwin Issue: fred_plot
This arises after correcting for #44
I removed the -m
flag from each of the fred_job
calls within the task files of TASKDIR
and re-ran ./tasks &
. This created the DATA/TABLES
files, so I then tried running fred_plot
again:
> fred_plot -v C -b -n -w -X 10 -t "Comparing Epidemics" -k R0=1.0 -k R0=1.5 -k R0=2.0 -k R0=2.5
Can't exec "plot-C.plt": No such file or directory at .../FRED/bin/fred_plot line 352.
fred_plot: source_file = plot-C.plt image_file = plot-C.pdf
Can't exec "open": No such file or directory at .../FRED/bin/fred_plot line 354.
plot-C.plt
was created in my current working directory (FRED/experiment
which contains the params.base
, config
, and task files and directories mentioned earlier), however, so I retried after moving it to FRED/bin
:
> fred_plot -v C -b -n -w -X 10 -t "Comparing Epidemics" -k R0=1.0 -k R0=1.5 -k R0=2.0 -k R0=2.5
Fontconfig error: Cannot load default config file
fred_plot: source_file = plot-C.plt image_file = plot-C.pdf
Can't exec "open": No such file or directory at .../FRED/bin/fred_plot line 354.
Oddly enough a pdf that lacks labels was still created in my current working directory (FRED/experiment
). I retried with a copy of the config file in FRED/bin
, but apparently the results were the same so Fontconfig
must be trying to load a different config file (which I assume to be for initializing internal defaults)...
So the last part is simply because there is no "open" command on linux like there is on Mac. fred_plot will create the pdf and lastly will try to open it up on a mac. If you want it to open, there is a probably a linux alternative. One such is 'xdg-open' (see: http://stackoverflow.com/questions/264395/linux-equivalent-of-the-mac-os-x-open-command) You can eitehr alter the part of fred_plot to check the OS or you can just alias 'open' to 'xdg-open' on your machine.
That's good to know. This seems to do the trick:
354: 355:
if($^O eq "darwin") {
356:system ("open $outfile") if $display;
357:}
358:else {
359:system ("xdg-open $outfile") if $display;
360:}
361:
Hmmm, but I still need to get Fontconfig
to work if these unlabeled plots are to be of any meaning.
Update: I made some modifications to fred_plot
:
Added Lines 6 - 8
5:
use Getopt::Long qw(:config no_ignore_case bundling);
6:use Cwd;
7: 8:my $cwd = getcwd();
9: . . . Added lines 356 - 367 355:system "chmod +x $pltfile";
356:if(system ($pltfile) != 0) {
357:print "Trying " . $cwd . "/" . $pltfile . "\n";
358:system ($cwd . "/" . $pltfile);
359:}
360:print "fred_plot: source_file = $pltfile image_file = $outfile\n";
361: 362:if($^O eq "darwin") {
363:system ("open $outfile") if $display;
364:}
365:else {
366:system ("xdg-open $outfile") if $display;
367:}
And it turns out the Fontconfig
error seems to be caused in plot-C.plt
(aka $pltfile
), which turns out to be a generated gnuplot
script. So gnuplot
is having difficulty finding its default config file.
ISSUE RESOLVED: fred_plot
And now I realize the default config file couldn't be found because I've been using a localized 'partial' copy of Cygwin in an effort to package a 'runs-out-of-box' solution. Running plot-C.plt
with the full installation version produced the expected output and finished the job appropriately. Please pardon my reporting this last error (though the xdg-open
solution was helpful).
After configuring Cygwin with a custom startup batch and an edit or two (see: #43), I was able to get as far as the fred_plot instructions at the bottom of this page: https://github.com/PublicHealthDynamicsLab/FRED/wiki/Parameter-Sweeps
After running
tasks &
(generated byfred_make_parameters
andfred_make_tasks
), I receive the following errors:task.R0=1.0.out
doesn't tell me a whole lot:but
task.R0=1.0
itself is a script that contains:It seems that
fred_job -k R0=1.0 -p PARAMDIR/params.R0=1.0 -n 10 -m 1
is where my troubles lie as running it produces the aborted errors above.Update: So I tried
fred_job -k R0=1.0 -p PARAMDIR/params.R0=1.0 -n 1
and still got the same error.However, I discovered that
RESULTS/JOB/12/DATA/OUT
outputs an error file,err1.txt
:FRED ERROR: Sorry, could not find a county for fips = |42065|
Checking the bottom of DATA/OUT/LOG1 I find the last two lines are:
But opening
/FRED/input_files/countries/usa/US_counties.txt
and performing a search for '42065' produces 121 matches.