[Developers] Robust data parser

Ian Taylor ian.taylor at noaa.gov
Wed Jan 18 11:29:45 PST 2012


This is now Issue #9 on the redmine issue tracking site:
http://admb-project.org/redmine/issues

This seems typical of many minor, persistent problems that we discuss at
length but never put to bed. I like that redmine can help us not forget
these things, and record credit where do when they get solved.
-Ian

On Wed, Jan 18, 2012 at 10:51 AM, Arni Magnusson <arnima at hafro.is> wrote:

> ADMB users generally don't have to worry about line endings - expecially
> when working in Linux.
>
> Surely we can improve the robustness of the data file parser so it can
> handle a file like this, right?
>
> ftp://glpd.fw.msu.edu/QFC/**ADMB-Videos/Current_ADMB_**
> Video_Release/ADMB%202/growth_**loglike.dat<ftp://glpd.fw.msu.edu/QFC/ADMB-Videos/Current_ADMB_Video_Release/ADMB%202/growth_loglike.dat>
>
> Arni
>
>
>
> On Wed, 18 Jan 2012, Arni Magnusson wrote:
>
>  I run into the same problem as Jacob, but only in Linux.
>>
>>  [Windows] the test vector is  -99 100 -101
>>  [Linux]   the test vector is  0 0 0
>>
>> The problem seems to caused by the .dat file, which contains Dos line
>> endings. The short-term solution is to convert the line endings:
>>
>>  $ dos2unix growth_loglike.dat
>>
>> I hope the long-term solution will be to make ADMB data file parser more
>> robust. To examine the problem I changed the model to
>>
>> DATA_SECTION
>>  init_int nobs
>>  !! SHOW(nobs);
>>  init_matrix vonBdata(1,nobs,1,2)
>>  !! SHOW(vonBdata);
>>  init_vector testvec(1,3)
>>  !! SHOW(testvec);
>>
>> PARAMETER_SECTION
>>  init_number t0
>>  objective_function_value nll
>>
>> PROCEDURE_SECTION
>>  nll = square(t0-1.0);
>>
>> GLOBALS_SECTION
>>  #define SHOW(x) cout << #x << ": " << x << endl;
>>
>> It looks like the problem arises when three conditions are met:
>>
>>  1. Model is run in Linux
>>  2. Data file has Dos line endings
>>  3. Data file has empty line between two comments
>>
>> Thanks for reporting this problem, Jacob. You can use the 'dos2unix'
>> shell command to fix the problem for now.
>>
>> Arni
>>
>>
>>
>> On Wed, 18 Jan 2012, Weihai Liu wrote:
>>
>>  pretty sure your admb is broken, can you even run the simple.tpl which
>>> in admb examples folder? The training example is fine after changing its
>>> tpl name and the version will not be a issue for this kind testing.
>>>
>>> weihai
>>>
>>>
>>>
>>> On Wed, Jan 18, 2012 at 11:52 AM, Jacob Kasper <jacobkasper at gmail.com
>>> >wrote:
>>>
>>>  I am going through the training video and I keep getting errors with
>>>> ADMB2 and onwards. I can run some tpl files but not the ones that are
>>>> associated with the training video, even when I download fore example the
>>>> files here ftp://glpd.fw.msu.edu/QFC/**ADMB-Videos/Current_ADMB_**
>>>> Video_Release/ADMB%202/and<ftp://glpd.fw.msu.edu/QFC/ADMB-Videos/Current_ADMB_Video_Release/ADMB%202/and>change the .tpl so that the names is the same as the .dat. when I run the
>>>> .tpl and then the program I get the message "the test vector is 0 0 0"
>>>> which is not what the training video suggests that it should return. I have
>>>> been over the .tpl file carefully and I cannot figure out the error, could
>>>> this be a version issue? I am running Linux 64 bit and built it from the
>>>> source distribution.
>>>>
>>>> THank you
>>>>
>>>> Jacob
>>>>
>>>>
>>>
>>  ______________________________**_________________
> Developers mailing list
> Developers at admb-project.org
> http://lists.admb-project.org/**mailman/listinfo/developers<http://lists.admb-project.org/mailman/listinfo/developers>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/developers/attachments/20120118/97c8eab9/attachment.html>


More information about the Developers mailing list