Persistent spectrum

Need help in implementing some specific function to your LightningChart Ultimate powered application? Post a question and get code snippets from other LightningChart Ultimate community members.

Moderator: Queue Moderators

Post Reply
Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Persistent spectrum

Post by Hendrik » Fri Aug 07, 2015 2:48 pm

Hi,

I want to use your PersistentSeriesRenderingIntensityLayer with a HighLowSeries. I do not understand, how the Colors are mapped to the incomming spectrum data sets.
Let's assume the following:
  • - A probability range from 0...100 where 100 is the highest probability of occurence for one data point (every spectrum a data point has the same Y value all the time) and 0 for the lowest
    - A color/probability range from Red: 100, Yellow:50, Green:25, Blue:0 (from your ValueRangePalette)
    - An updating spectrum, where a few samples occur half of the time with Y=Value1 (a), a few samples occur fourth of the time with Y=Value2 (b) and the rest of the samples per spectrum every time Y=Value3 (c)
Now I would think that the color for a=Yellow, b=Green and c=Red but that is not the case. I saw the HistoryIntensityFactor and NewTraceIntensity in your code. What do these mean?
I need the exact relations between these properties or can I map the colors for myself somehow? How can I achieve my assumption? What will happen If I change the properties
HistoryIntensityFactor/NewTraceIntensity exactly?

Thanks
Hendrik

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Mon Aug 10, 2015 6:00 am

Hi Hendrik,

the PerstentSeriesRenderingIntensityLayer uses a pixel hit counter to color the layer.

Please see http://arction.com/download/lightningch ... manual.pdf, section 5.29.

PerstentSeriesRenderingIntensityLayer's ValueRangePalette sets the colors for hit counts. If you render a new trace, with NewTraceIntensity = 1, it will increase the pixel-wise hit counter by 1 where the trace hits. Other pixels it doesn't modify.

HistoryIntensityFactor multiplies the hit counters with given value, to make some decay, when set lower than 1.

Please let me know if this doesn't answer your question.
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Mon Aug 10, 2015 2:04 pm

Hi,

thanks for the response. Ok if I have my color range from 0...100 then I will have my maximum hit count at 100. With a NewTraceIntensity = 1 and HistoryIntensityFactor = 1
my assumption from my first post is then the same. If I have a spectrum data set varying only at one index occuring every second spectrum
I will have my color at 50 because this must be the current hit count for this pixel, isn't? But when I try this after 100 data sets the wrong color still appears and it will change
until it is red (Red=100 in palette) but this is not correct. It must be stopped at Green=50. What am I missing here?

Thanks

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Mon Aug 10, 2015 2:34 pm

Could you please post your VS project (or stripped version of it) so I can take a closer look. Also pictures would help understand the problem here. :?:
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Tue Aug 11, 2015 6:15 am

Hi,

I attacted a sample project for you, where you can see my problem.

Regards

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Tue Aug 11, 2015 12:34 pm

I downloaded the project, but I couldn't build it. It shows some kind of file missing error regarding NuGet. I set of course our own assembly references, but it didn't much help, these errors remained:

Severity Code Description Project File Line Source
Warning The referenced component 'Microsoft.Practices.Prism.Composition' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.Practices.Prism.Interactivity' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.Practices.Prism.Mvvm' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.Practices.Prism.Mvvm.Desktop' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.Practices.Prism.PubSubEvents' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.Practices.Prism.SharedInterfaces' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'PresentationFramework.Aero' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'PresentationFramework.Aero2' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'PresentationFramework.Luna' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.ComponentModel.Composition' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Data' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Drawing' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Windows.Forms' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Xml' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'Microsoft.CSharp' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Core' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Xml.Linq' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Data.DataSetExtensions' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'System.Xaml' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'WindowsBase' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'PresentationCore' could not be found. INRADIOS.TOOLS Build
Warning The referenced component 'PresentationFramework' could not be found. INRADIOS.TOOLS Build
Error This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is C:\temp\inradios\INRADIOS.TOOLS\\.nuget\NuGet.targets. INRADIOS.TOOLS C:\temp\inradios\INRADIOS.TOOLS\INRADIOS.TOOLS.csproj 193 Build

Do you have that missing file available, or could you strip all other references and NuGet out from it?
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Tue Aug 11, 2015 1:05 pm

Hi,

please enable package restore by right clicking the solution and select "Enable NuGet Package Restore". The other references are simply microsoft assemblies you can take by "Add Reference" on the project
and take the assemblies under Framwork.
I can only attach files smaller than 256 kB unfortunatly.

Thanks

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Tue Aug 11, 2015 2:11 pm

Thanks, it opened now. :roll:
LightningChart Support Team, PT

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Wed Aug 12, 2015 8:27 am

I wrote an app to test HistoryIntensityFactor = 1 (no decay) and HistoryIntensityFactor < 1 side-by-side.
PersistentIntensityLayerProject.jpg
PersistentIntensityLayerProject.jpg (379.29 KiB) Viewed 40403 times
The project is here:
WpfPersistentIntenistyAppVS2010.zip
(16.65 KiB) Downloaded 883 times
On the left side, HistoryIntensityFactor = 1. That means, no decay of layer counter values when plotting new trace.
On the right side, HistoryIntensityFactor = 0.9. That means, multiply old counter value by 0.9.

After pressing "Render Traces" button, it starts a timer and plots one filled Highlow series trace at a time into the rendering layer, and displays the rendering layer in the chart. According to my tests, the HistoryIntensityFactor works correctly. The Y amplitude of a new trace decreases continuously, so it leaves the old traces visible on top, and accumulating the counters between Y= 0 and Y amplitude marked with continuous magenta line.

When looking at any pixel in the layer, when calling layer.RenderSeries, it will multiply the counter value by HistoryIntensityFactor. After that, it will add NewTraceIntensity to that, if the trace that is being plotted hits that pixel.
if(hitsThePixel)
CounterValue = CounterValue * HistoryIntensityFactor + NewTraceIntensity.
else
CounterValue = CounterValue * HistoryIntensityFactor.

I hope this clarifies the persistent layers operation. :)
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Wed Aug 19, 2015 6:22 am

Hi,

thanks for the clarification. How can I present the decay factor to the user? If I have no decay the color code will be fine but if I use the a certain decay
there will be a changed color code isn't?
I read in your docs that there will be an automatic reset of the chart on resizing it. This is not very satisfied because you do not want to have this behavior.
Can I somehow workaround this? I did this with a wrapping image which automatically resizes the content without losing the important information or the aspect ratio
of the bitmap.

Best regards,
Hendrik

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Thu Aug 20, 2015 8:27 am

DecayFactor can be read from HistoryIntensityFactor. That applies when using RenderSeries next time, the counters get multiplied with this value. (I probably understood your question wrong :? )

The persistent layer is a GPU-side texture. Currently, we can't get that to CPU side to resize, crop or stretch automatically when margins are resized, axis values changed etc. It's such a massive task so we just haven't found time to implement it. Talking about weeks of work here. Sorry.
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Thu Aug 20, 2015 10:54 am

Can I get this texture or the pixel data as byte array from the layer somehow?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Thu Aug 20, 2015 11:03 am

Unfortunately the current counter values or bitmap/texture can't be retrieved from GPU, currently.
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Thu Aug 20, 2015 12:23 pm

is this resize without reset feature scheduled for the future?

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Thu Aug 20, 2015 2:12 pm

It's not scheduled. We can't promise this to be implemented at the moment, but maybe in the future after our new DirectX 11 platform is up and running.
LightningChart Support Team, PT

Hendrik
Posts: 21
Joined: Wed Aug 05, 2015 2:27 pm

Re: Persistent spectrum

Post by Hendrik » Tue Mar 29, 2016 2:41 pm

Hi,
I downloaded the new API for v7. I saw your sample browser.
The sample "ExamplePersistentFFT" seems to have the feature to zoom and resize the chart
without resetting the persistent chart. This is what I want actually.
The sample "ExamplePersistentRenderingHighLowAreas" on the other hand still resets itself after zoom or resizing.

My question is: Where is the difference between those two samples, that I could have no reset after resizing or zooming the chart?

Thanks

User avatar
ArctionPasi
Posts: 1367
Joined: Tue Mar 26, 2013 10:57 pm
Location: Finland
Contact:

Re: Persistent spectrum

Post by ArctionPasi » Tue Mar 29, 2016 3:04 pm

The examples in ViewXY/Persistent layers use Persistent rendering layers. They are GPU side bitmaps that are updated from CPU side. Changing chart size or axis range gets rid of the old image as it doesn't apply anymore to current resolution or axis ranges. Currently we can't provide solution which would retain and resize the bitmap data over axis range or chart resize. It's know and documented restriction of this technique.

ExamplePersistentFFT uses regular area series that keep the data in them.
LightningChart Support Team, PT

Post Reply