forums.silverfrost.com Forum Index forums.silverfrost.com
Welcome to the Silverfrost forums
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Native %pl
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
 
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+
View previous topic :: View next topic  
Author Message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Apr 13, 2017 12:32 pm    Post subject: Reply with quote

A new version of the native %pl is available via the following download.
There will probably still be some forms of data that it can't handle.

I am not going to do any further work on this for at least a few months so if you have feedback it would be better to keep it till later.

https://www.dropbox.com/s/xhk4ofgp5g5xcpn/newDLLs6.zip?dl=0
Back to top
View user's profile Send private message AIM Address
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Thu Apr 13, 2017 5:44 pm    Post subject: Reply with quote

Paul,

Can you confirm the syntax for the specification of separate top, left, and bottom, margins?

The readme file says:-

Quote:
%pl[margin=(left,top,right,bottom)] ... set the margins to left,top,right,bottom pixels


but my example below generates an error

Quote:
Runtime error from program:g:\motor\problem.exe
Run-time Error
Invalid margin value in %PL specification

00401000 main [+01d2]


Code:
winapp
program test
implicit none
include <windows.ins>

real(kind=2) :: ns = 3600.d0
real(kind=2) :: slope = -200.d0
real(kind=2), dimension(1:1000) :: speed, po_pr
real(kind = 2) po
integer i

po = 0.d0
do i = 1, 1000, 1
  speed(i) = ns + slope*po
  po_pr(i) = po
  po       = po + 0.001d0
end do

      i = winio@('%fn[Tahoma]&')
      i = winio@('%mn[Close ]&','EXIT')
      i = winio@('%bg&',rgb@(250,250,250))
      i = winio@('%tc&',rgb@(0,0,0))
      i = winio@('%`bg&',rgb@(255,255,255))

call winop@("%pl[native]")

!call winop@("%pl[margin=60]")                !THIS WORKS
call winop@("%pl[margin=(60,60,60,60)]")      !THIS DOES NOT WORK

i = winio@('%pl[x_array,N_GRAPHS=1,COLOUR=BLACK]',400, 300, 1000, po_pr, speed)

end program test


I can see that I am picking up the new dlls since the default %pl[x_sigfigs] and %pl[y_sigfigs] have changed in another test I ran.

Thanks
Back to top
View user's profile Send private message Visit poster's website
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Apr 13, 2017 7:21 pm    Post subject: Reply with quote

That is what was intended and I thought that I had tested it but you are right it doesn't work.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Thu Apr 13, 2017 7:32 pm    Post subject: Reply with quote

Not very stable DLLs, or some other conflicts there. My codes freeze immediately with access violation like that (if this tells you anything):

Within file CLEARWIN64.DLL
In _fdebug_printf at address 17C
In _send_text_message at address 3B3
In _yield_program_control at address 234
In _sleep_at at address 5A
Within file PPP.exe
in ANGULARBREMMS at address 590b

Can not start the code in the debug mode to see what's wrong. Also crashes at start with /optimize mode.
With /nocheck code may start OK but is now sensitive and crashes often, seems it does not like something. For example the code freezes when i use %ac and works ok if the same callback is called via clicking on a button %bt.

Ones code worked with such tricks and i succeeded to run the new %pl i found that it still does not like something in the data and switches to linear scale from LOG. Is there a way to push it not do that ? As we discussed before it should not switch to linear scale when zero or negative data is present if condition y_min=val is used -- there is no reason to switch (and i do not see any zero/negative data and it still switches to linear). I see the work on that is almost done, %pl plots minimum of axis at y_min if you set it like this %pl[y_min=100.] but it still plots curves below this minimum threshold line and switches to linear if data has zeroes (or it suspects that)

New feature - the axis thickness works fine and looks good
CALL winop@("%pl[axes_pen=3]")

The new way of axis numbering when it switches the styles is probably not good idea. Example of some my real axis numbering: 0, 20, 40, 60, 80, 1e2, 1.2e2, 1.4e2 does not look good.
For reasonably small numbers it should be 0, 20, 40, 60, 80, 100, 120, 140.
The numbers as large as 1.2e5, 1e12 are probably OK represented like that but when axis is plotted they all should be in the same style


Last edited by DanRRight on Fri Apr 14, 2017 8:20 am; edited 7 times in total
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Thu Apr 13, 2017 10:06 pm    Post subject: Reply with quote

Dan

I suggest that you just go back to a stable set of DLLs.
I am not able to do any more work on this for the time being.
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Apr 14, 2017 6:58 am    Post subject: Reply with quote

Paul,
Of course i will go to older dlls, but i'm curious if this is only my compiler state/settings issue. One simple case which crashes i already found. This demo code works in usual 32 bit mode

ftn95 name.f95 /link

and if you switch to 64

ftn95 name.f95 /64 /link

it crashes if you push DRAW or hit Ctrl+Z set in %ac

Code:

use clrwin
integer, external :: callb

  i=winio@('%ww%gr%ff&', 600,400)
  i=winio@('%ac[Ctrl+Z]&',callb)
  i=winio@('%cn%^bt[DRAW]%es',callb)
end

integer function callb()
use clrwin
ipos = random()*555
call draw_line@(1,1,ipos,111,rgb@(255,1,1))
callb =2
end function
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Fri Apr 14, 2017 8:22 am    Post subject: Reply with quote

Code:
use clrwin
integer, external :: callb

  i=winio@('%ww%gr%ff&', 600,400)
  i=winio@('%ac[Ctrl+Z]&',callb)
  i=winio@('%cn%^bt[DRAW]%es',callb)
end

integer function callb()
use clrwin
real(2) random
ipos = random()*555
call draw_line_between@(1,1,ipos,111,rgb@(255,1,1))
callb =2
end function
Back to top
View user's profile Send private message AIM Address
DanRRight



Joined: 10 Mar 2008
Posts: 2813
Location: South Pole, Antarctica

PostPosted: Fri Apr 14, 2017 10:19 am    Post subject: Reply with quote

This is not an answer, Paul. This implies that compiler is fine and the program is wrong. But if program is wrong and it is wrong 100 times per day when you develop the code then it is the debugger which must tell me where the error is or at least give a hint. I'd like to but probably will never afford to hire you guys to substitute SDBG Smile. How I have to proceed to find the error of immediately crashing code with "Access violation writing address 0x00007ff..........."? Just inspecting by hand each of a quarter of million lines of code will take me the same quarter of million years. The debugger crashes at the start of debugging. How come such error can crash both the EXE and the debugger? The 32bit code works by the way fine hence we can not use 32bit debugger to find this bug --> we are screwed.

I see few nice new features, i'd like to use it, the LINEAR scale %pl for example already approaching ideal beating for XY plots in quality MATLAB being equally simple,

https://www.mathworks.com/products/matlab/plot-gallery.html

the LOG one is almost done and just needs final fixes (still plots outside the allowed area etc), but this was very unstable build, totally unusable because of crashing on everything. Could it be that the new dlls are conflicting with the rest of the older 8.10 compiler ?

So before you interrupt with further development of native %pl (I thought you enjoyed this work and understand how important is to have top quality and simplicity graphics utilities natively in Fortran but in reality it appears that things were going exactly opposite) can you please fix these issues with LOG scale which are demonstrated with this code below so that %pl will not plot outside the allowed area and will not switch to linear scale automatically if y_min=val exists (the data plotted often fluctuates and zeros/negatives are inevitable). That could be hopefully easy fixes. Also, though this could be not related to %pl problem: by some reason the new %pl does not react on Redraw like the older %pl was doing (to see that action remove the line CALL winop@("%pl[native]" and compile under regular 32bit). This will make %pl finally at least usable in 64bits.

Code:
Module Modd
use clrwin
integer, parameter:: N=10
real*8 X(N), Y(N), Z(N), T(N)

Contains

integer function callb()
real(2) random
do i=1,N
  X(i)=i
  Y(i)=exp(1.*i) * random()
  Z(i)=exp(2.*i) * random()
  T(i)=exp(3.*i) * random()
enddo

call simpleplot_redraw@
callb =2
end function
End module
!.....................................
program hhh
use clrwin
use Modd

j=callb()

i=winio@('%ww&')
CALL winop@("%pl[native]")
i=winio@('%pl[x_array,scale=log_linear,N_GRAPHS=3,y_min=100.]%ff&', 600,400, N, X,Y,Z,T) 
i=winio@('%ac[Ctrl+Z]&',callb)
i=winio@('%cn%^bt[Redraw]%es',callb)
end


Last edited by DanRRight on Mon Apr 17, 2017 4:52 pm; edited 6 times in total
Back to top
View user's profile Send private message
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sat Apr 15, 2017 1:32 am    Post subject: Reply with quote

Paul said:
Quote:
I am not going to do any further work on this for at least a few months so if you have feedback it would be better to keep it till later.


.. except for bug fixes I assume ?

what's going to keep you busy for the next year or so then Paul ?
some interesting development in the melting pot ? .. .or just popping off for that much needed & deserved caribbean 'gap year' LOL Wink
(if the latter, who's the mug .. .err genius who'll be taking over Wink)
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sat Apr 15, 2017 7:38 am    Post subject: Reply with quote

Thanks John. I only meant development work on the native %PL. Yes I aim to fix any native %PL "bugs" but the tick mark values on the axes may not always be tidy and the behaviour for log scales and negative data values will not change (for me these are not "bugs").

I am not sure what comes next. Maybe some of the requested missing Fortran standard features. Anyway I hope that I have learned my lesson. No more ventures like the native %PL.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Apr 16, 2017 2:20 am    Post subject: Reply with quote

I think you're too harsh on yourself, what you've done in such a short space of time (and so unexpectedly too) has been great. Not always easy to hack together something like you've done.
However, pity you have to leave it with the same initial niggly defects like ... tic marks ! And as for the log scales, well it makes it pretty much useless to me for one, especially bearing in mind its unpredictability in behaviour.
Thanks for the noble effort to date anyway.
I'll look forward to it being picked up again whenever.
Back to top
View user's profile Send private message
PaulLaidler
Site Admin


Joined: 21 Feb 2005
Posts: 7916
Location: Salford, UK

PostPosted: Sun Apr 16, 2017 8:27 am    Post subject: Reply with quote

John

The question about using negative data values and logarithmic transformations has gone on for so long now that I am beginning to doubt myself. If the user supplies a negative value of y then ClearWin+ can't calculate log(y) as a real value. I know that what is taught in physics can change but not mathematics surely. The issue about what happens with negative values of log(y) (e.g. log10(1e-3)) has been fixed.

As to the values shown at ticks marks, you can usually get good results particularly if you set (for example) the y_max and maybe the dy values.
Back to top
View user's profile Send private message AIM Address
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Apr 16, 2017 11:30 am    Post subject: Reply with quote

the negative data point was clear, it can't be done, but following on from Dan's last comment:
Quote:
Also before you interrupt with native %pl can you please fix these issues with LOG scale which are demonstrated with this code below so that %pl will not plot outside the allowed area and will not switch to linear scale automatically if y_min=val exists

there is still the issue of switching to a linear scale automatically which is a major problem really.
Also, I don't see where the additional introduced options are documented at all lik the margins option for example, and the upper-lower limits specification for log (has that been implemented or not ? I assume not judging by Dan's last comment. Without it it'll often revert automatically to linear scale - which sort of defeats the object of using log scale no ?)

The last dlls file I see are V6, but they're not stable are they, so return to v5, where the last fixes aren't included.

I'm now confused.
Back to top
View user's profile Send private message
Kenneth_Smith



Joined: 18 May 2012
Posts: 697
Location: Hamilton, Lanarkshire, Scotland.

PostPosted: Sun Apr 16, 2017 1:37 pm    Post subject: Reply with quote

John,

Apart from the issue with setting the margins independently the V6 DLLs are running fine for myself.

Ken
Back to top
View user's profile Send private message Visit poster's website
John-Silver



Joined: 30 Jul 2013
Posts: 1520
Location: Aerospace Valley

PostPosted: Sun Apr 16, 2017 2:52 pm    Post subject: Reply with quote

Except for the definition of seperate margins Ken I think ? which you mentioned above and which Paul acknowledged above was not working as expected.

Have you also tried log scales in the last update without problems like Dan has experienced or has it been only linear scales for yourself ?
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.silverfrost.com Forum Index -> ClearWin+ All times are GMT + 1 Hour
Goto page Previous  1, 2, 3, 4, 5, 6, 7, 8  Next
Page 7 of 8

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group