mailRe: A tip for converting the result directories xmgrace files to eps and png


Others Months | Index by Date | Thread Index
>>   [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Header


Content

Posted by Troels Emtekær Linnet on June 14, 2013 - 08:30:
A last comment for XMGRACE conversion.

for agr in `ls *.agr`;do bn=`basename ${agr} .agr`;gracebat ${agr} -hdevice PNG -printfile ${bn}.png;done

Troels Emtekær Linnet


2013/6/13 Edward d'Auvergne <edward@xxxxxxxxxxxxx>
Great!  For the 64-bit issue, if you look in the file for that test
you might be able to see what I am doing with this.  The file to look
at and the line to go to is given at the end of the traceback message
which you attached to the bug report (https://gna.org/bugs/?20821).
For a hint, the problem has something to do with precision variability
between different setups.  As for adding new models, this is pretty
straight forward when following the tutorial at:

http://thread.gmane.org/gmane.science.nmr.relax.devel/3907

>From my commit messages, you can probably see that it only take me a
few hours per dispersion model.  Note that I have now copied this
tutorial, as well as the docstring for the relax_disp.select_model
user function and created a basic initial relaxation dispersion
chapter in the relax manual.  If you know LaTeX then, when adding the
model, it would good to add the equations and reference via a bibtex
entry to that chapter.  If you have Scons and LaTeX installed on your
system, the manual can be built by typing:

$ scons user_manual_pdf

Cheers,

Edward



On 13 June 2013 17:25, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
> Sure why not :-)
>
> And I am soon in the mood for the Tollinger/Kay equation.
> And solve the 64 bit problem in windows.
>
> Can you guide me in the direction where I should look for the 64 bit
> problem?
>
> Best
> troels
>
> Troels Emtekær Linnet
>
>
> 2013/6/13 Edward d'Auvergne <edward@xxxxxxxxxxxxx>
>>
>> Would you like to try to give this a go?
>>
>> Regards,
>>
>> Edward
>>
>>
>> On 13 June 2013 16:35, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
>> > I am happy that you think it is great. :-)
>> >
>> > As soon there is a file type, which can fast be opened by a image
>> > viewer, I
>> > am happy.
>> >
>> > It works for PNG here, and it is very probably a compilation issue.
>> > I have PNG as a possibility to print in my xmgrace menu.
>> >
>> > I found the commands here:
>> > http://ringo.ams.sunysb.edu/index.php/Xmgrace
>> >
>> > This is for EPS and PNG, but I havent found options for JPEG yet.
>> >
>> > I would say the "more the merrier".
>> > It take's time to create scripts, but no time to delete.
>> >
>> > Best
>> > Troels
>> >
>> >
>> >
>> >
>> > Troels Emtekær Linnet
>> >
>> >
>> > 2013/6/13 Edward d'Auvergne <edward@xxxxxxxxxxxxx>
>> >>
>> >> That's a great trick!  My knowledge of Grace is not that extensive.
>> >> You know what would be even better - if the
>> >> relax_disp.plot_disp_curves user function created this script and
>> >> dropped it into the directory with the Grace files!  I've now shifted
>> >> the code into the
>> >> specific_analyses.relax_disp.disp_data.plot_disp_curves() function.
>> >> Such a script could easily be created at the end of this function -
>> >> best by calling a special function in lib.software.grace.
>> >>
>> >> What would be good would be to generate one script for the PNG files,
>> >> maybe called 'grace_to_png.sh' just to be more informative to the user
>> >> that this is for conversion and that it is a shell script, one for EPS
>> >> files called possibly 'grace_to_eps.sh', and a third called
>> >> 'eps_to_pdf.sh'.  The plot_disp_curves() function can even make them
>> >> executable for the user.  I suggest that the *.tmp files be removed by
>> >> the script at the end.
>> >>
>> >> The only problem is that I tried this and received error messages and
>> >> broken files:
>> >>
>> >> Unknown device: DEVICE "PNG" FONT ANTIALIASING ON
>> >> Unknown device: DEVICE "PNG" OP "compression:9"
>> >> File modifications are disabled in safe mode: PRINT
>> >> File modifications are disabled in safe mode: PRINT
>> >> disp_:70@N agr
>> >>
>> >> The EPS files are created successfully.  I'm not sure why the PNGs
>> >> failed, maybe it's not compiled in.  JPEG and SVG are present in the
>> >> print options through the GUI though, so maybe scripts for these
>> >> formats can be very easily created as well.  A simple loop over 'PNG',
>> >> 'EPS', 'SVG', and 'JPEG' could create separate scripts for each format
>> >> and make them executable, and then at the end the 'eps_to_pdf.sh' can
>> >> be created.  The script generation could be documented in the user
>> >> function docstring.  What do you think?
>> >>
>> >> Cheers,
>> >>
>> >> Edward
>> >>
>> >>
>> >> On 13 June 2013 14:31, Troels Emtekær Linnet <tlinnet@xxxxxxxxx> wrote:
>> >> > Hi.
>> >> >
>> >> > I got tired of opening each xmgrace file to see the plot.
>> >> > I found that to export to png, you need to:
>> >> >
>> >> > Add this to the end of the xmgrace file
>> >> >
>> >> > #Print out to
>> >> > @PRINT TO "/home/you/output.png"
>> >> > @HARDCOPY DEVICE "PNG"
>> >> > @DEVICE "PNG" FONT ANTIALIASING on
>> >> > # Make white background transparent
>> >> > #@DEVICE "PNG" OP "transparent:on"
>> >> > @DEVICE "PNG" OP "compression:9"
>> >> > @PRINT
>> >> >
>> >> > Then issue an "HARDCOPY" with xmgrace
>> >> >> xmgrace -hardcopy xmgracefile.agr
>> >> >
>> >> >
>> >> > Script to make both png and eps for a folder with xmgrace files
>> >> >
>> >> > Write in: xmgrace_png
>> >> > and put in your bin folder
>> >> >
>> >> > #!/bin/bash
>> >> >
>> >> > for gracefile in *.agr; do
>> >> > filename=$(basename "$gracefile")
>> >> > extension="${filename##*.}"
>> >> > filename="${filename%.*}"
>> >> >
>> >> > TMPPNG=${filename}_png.tmp
>> >> > cat $gracefile > $TMPPNG
>> >> > echo "#Print out to" >> $TMPPNG
>> >> > echo '@PRINT TO "'"${PWD}/${filename}.png"'"' >> $TMPPNG
>> >> > echo '@HARDCOPY DEVICE "PNG"' >> $TMPPNG
>> >> > echo '@DEVICE "PNG" FONT ANTIALIASING on' >> $TMPPNG
>> >> > echo '# Make white background transparent' >> $TMPPNG
>> >> > echo '#@DEVICE "PNG" OP "transparent:on"' >> $TMPPNG
>> >> > echo '@DEVICE "PNG" OP "compression:9"' >> $TMPPNG
>> >> > echo '@PRINT' >> $TMPPNG
>> >> > xmgrace -hardcopy $TMPPNG
>> >> >
>> >> > TMPEPS=${filename}_eps.tmp
>> >> > cat $gracefile > $TMPEPS
>> >> > echo "#Print out to" >> $TMPEPS
>> >> > echo '@PRINT TO "'"${PWD}/${filename}.eps"'"' >> $TMPEPS
>> >> > echo '@HARDCOPY DEVICE "EPS"' >> $TMPEPS
>> >> > echo '@DEVICE "EPS" OP "level2"' >> $TMPEPS
>> >> > echo '@PRINT' >> $TMPEPS
>> >> > xmgrace -hardcopy $TMPEPS
>> >> >
>> >> > echo "$filename $extension"
>> >> > #eps2png -resolution 200 $TMPEPS
>> >> > #epstopdf $TMPEPS
>> >> > done
>> >> >
>> >> > Then just make "chmod +x xmgrace_png
>> >> > and in the folder, issue an:
>> >> >
>> >> > xmgrace_png
>> >> >
>> >> > sit back and relax
>> >> >
>> >> > If you want to convert eps to pdf
>> >> >
>> >> > bash ;
>> >> > for epsfile in *.eps; epstopdf $epsfile; echo "Making pdf: $epsfile";
>> >> > done
>> >> >
>> >> > Troels Emtekær Linnet
>> >> >
>> >> > _______________________________________________
>> >> > relax (http://www.nmr-relax.com)
>> >> >
>> >> > This is the relax-users mailing list
>> >> > relax-users@xxxxxxx
>> >> >
>> >> > To unsubscribe from this list, get a password
>> >> > reminder, or change your subscription options,
>> >> > visit the list information page at
>> >> > https://mail.gna.org/listinfo/relax-users
>> >
>> >
>
>


Related Messages


Powered by MHonArc, Updated Mon Jun 24 13:40:05 2013