Gigaseconds[Gs] vs Gauss[Gs]
Hi everybody. A funny question.
Using the "Convert Unit" function I try to convert a time string with units (i.e. "1Gs") into a double number represented in the correspondent base unit.
For example:
String In: "10ms".
A simple code separates the "numeric string" from the "text string". This is <10> and <ms> respectively.
Using the "text string" as the selector input of a case structure I use the "Convert Unit" function to convert the unitless "numeric string" into a double with time units.
I have done this for all SI prefixes (m or mili, M or Mega, etc.).
The point of my question is the following. When construction the units for Gigaseconds, or Gs, LabVIEW detects it as a Gauss. This causes a broken wire error because LabVIEW believes I want to connect magnetic flux density units (tesla or gauss) with time units (seconds).
Is there a way to especifity that the "G" in "Gs" is actually a prefix and not part of the unit itself?
Thanks!
Solved!
Go to Solution.
Let me state first that I don't use units, so this may be wrong, but as far as I know, there's no way to change the order in which units are interpreted, so I think the only thing you can do in this case is to do a double unit conversion. You'd have to take the unitless numeric value and multiply it by 1E9 to change it to the equivalent number of seconds, and then set the unit to seconds. Then you could follow that with another Convert Unit that changes it to Gs.
Similar Messages
-
Is it possible to create a Gauss graph in SAP Lumira ?
Hi Gurus,
Is it possible to create a Gauss graph in SAP Lumira ?
ThanksHi Rogerio,
You cant create Gauss graph in Lumira rather you can go for predictive analytics as Tammy said.
For more information you can refer following link:
SAP Lumira Chart Extensions with a Predictive Flavor
Regards
Megha -
Cisco equip. and Gauss proximity
Is there any documentation on the proximity of cisco equipment in relation to the Gauss value created by an MRI magnet?
I am guessing that there is a concern that the big huge magnet from an MRI does not materially interfere with the operation of any network devices, including Cisco routers.
The best studies available on this are generally performed by the military under the TEMPEST specifications. Suffice it to say the following:
1. an MRI is a significant source of EMI.
2. STP or fiber optic is preferred over UTP for ethernet operation.
3. EMI hardening is generally not going to be cost effective for you, so the best bet is to keep the router and other network devices as far away as possible from significant sources of EMI.
HTH,
pw -
Lev-Mar fit: linear baseline + 4 gauss
Hi,
I've been working on a fit with LV. I have a set of data presenting a baseline and 4 superposed gaussian.
Using general functions:
a1 * exp (-0.5*(( x- b1 )/ c1 )^2)+
a2 * exp (-0.5*(( x- b2 )/ c2 )^2)+
a3 * exp (-0.5*(( x- b3 )/ c3 )^2)+
a4 * exp (-0.5*(( x- b4 )/ c4 )^2)+
d*x+e
where a,b,c are the parameters of the gaussian curves; d, e those of my baseline and x my variable.
If you try the VI, you'll find a solution but I'd like to improve it.
We want the parameter c1, c2, c3, c4 to be the same, lets call it "c". That way my gaussians all have the same "width" (that's what we want).
When I try to simplify those parameters to only one, the VI returs an error -20041: The system of equations cannot be solved because the input matrix is singular
I don't know how to obtain that. I guess it is quite simple but I am not use to LV.
Can you please give me a hand on this problem.
attached: VI and data (changed the extension as it seems I can't send .lvm files)
Cheers
Félix
Solved!
Go to Solution.
Attachments:
Fit_felix.vi 73 KB
data.txt 31 KBfelixd wrote:
I found a connection errors and some partial derivative errors, all corrected it workd just fine.
One of the main reasons for errors is an overly complicated diagram.
I would arrange the parameters in a better order (you need to change the calling VI too!)
You don't need the partial derivatives. To fit experimental data, numeric derivatives are sufficient and the fitting routines will calculate them automatically. Just don't connect the partial derivatives output.
There is way too much duplicate code, one gaussian should be enough, simply loop over all components. (Imagine you want 2 or 20 gaussians at a later point? Imagine you want a slightly different formula: you would need to make the same change in n places.)
Here's a quick draft that should get the job done with significantly less code. Try it.
(For further speedup, you can parallelize the FOR loop above if you have multiple CPU cores)
LabVIEW Champion . Do more with less code and in less time .
Attachments:
quad gauss 1MOD.vi 15 KB
QuadGauss.png 9 KB -
Re: Lev-Mar fit: linear baseline + 4 gauss
Hi,
I've been working around my set-up and the solution you gave me is working fine.
My problem is about the fit parameters. I've seen that the fit is strongly dependant of it. Here is what I have.
A set of spectrum, taken every hour. I'd like to fit them and see the variation of the amplitude and FWHM for a selected gaussian peak. I used a feedback node and the replace array subset to "reset" my initial parameters with the best fit parameters.
But then the fit doesn't match the new spectrum. The error is even bigger and grows up.
Do you have any idea for this?
Thanks
Félix
P.S. Attached a series of spectrumduplicate post
-
Swing: when trying to get the values from a JTable inside an event handler
Hi,
I am trying to write a graphical interface to compute the Gauss Elimination procedure for solving linear systems. The class for computing the output of a linear system already works fine on console mode, but I am fighting a little bit to make it work with Swing.
I put two buttons (plus labels) and a JTextField . The buttons have the following role:
One of them gets the value from the JTextField and it will be used to the system dimension. The other should compute the solution. I also added a JTable so that the user can type the values in the screen.
So whenever the user hits the button Dimensiona the program should retrieve the values from the table cells and pass them to a 2D Array. However, the program throws a NullPointerException when I try to
do it. I have put the code for copying this Matrix inside a method and I call it from the inner class event handler.
I would thank you very much for the help.
Daniel V. Gomes
here goes the code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import AdvanceMath.*;
public class MathF2 extends JFrame {
private JTextField ArrayOfFields[];
private JTextField DimOfSis;
private JButton Calcular;
private JButton Ativar;
private JLabel label1;
private JLabel label2;
private Container container;
private int value;
private JTable DataTable;
private double[][] A;
private double[] B;
private boolean dimensionado = false;
private boolean podecalc = false;
public MathF2 (){
super("Math Calcs");
Container container = getContentPane();
container.setLayout( new FlowLayout(FlowLayout.CENTER) );
Calcular = new JButton("Resolver");
Calcular.setEnabled(false);
Ativar = new JButton("Dimensionar");
label1 = new JLabel("Clique no bot�o para resolver o sistema.");
label2 = new JLabel("Qual a ordem do sistema?");
DimOfSis = new JTextField(4);
DimOfSis.setText("0");
JTable DataTable = new JTable(10,10);
container.add(label2);
container.add(DimOfSis);
container.add(Ativar);
container.add(label1);
container.add(Calcular);
container.add(DataTable);
for ( int i = 0; i < 10 ; i ++ ){
for ( int j = 0 ; j < 10 ; j++) {
DataTable.setValueAt("0",i,j);
myHandler handler = new myHandler();
Calcular.addActionListener(handler);
Ativar.addActionListener(handler);
setSize( 500 , 500 );
setVisible( true );
public static void main ( String args[] ){
MathF2 application = new MathF2();
application.addWindowListener(
new WindowAdapter(){
public void windowClosing (WindowEvent event)
System.exit( 0 );
private class myHandler implements ActionListener {
public void actionPerformed ( ActionEvent event ){
if ( event.getSource()== Calcular ) {
if ( event.getSource()== Ativar ) {
//dimensiona a Matriz A
if (dimensionado == false) {
if (DimOfSis.getText()=="0") {
value = 2;
} else {
value = Integer.parseInt(DimOfSis.getText());
dimensionado = true;
Ativar.setEnabled(false);
System.out.println(value);
} else {
Ativar.setEnabled(false);
Calcular.setEnabled(true);
podecalc = true;
try {
InitValores( DataTable, value );
} catch (Exception e) {
System.out.println("Erro ao criar matriz" + e );
private class myHandler2 implements ItemListener {
public void itemStateChanged( ItemEvent event ){
private void InitValores( JTable table, int n ) {
A = new double[n][n];
B = new double[n];
javax.swing.table.TableModel model = table.getModel();
for ( int i = 0 ; i < n ; i++ ){
for (int j = 0 ; j < n ; j++ ){
Object temp1 = model.getValueAt(i,j);
String temp2 = String.valueOf(temp1);
A[i][j] = Double.parseDouble(temp2);What I did is set up a :
// This code will setup a listener for the table to handle a selection
players.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
ListSelectionModel rowSM = players.getSelectionModel();
rowSM.addListSelectionListener(new Delete_Player_row_Selection(this));
//Class will take the event and call a method inside the Delete_Player object.
class Delete_Player_row_Selection
implements javax.swing.event.ListSelectionListener
Delete_Player adaptee;
Delete_Player_row_Selection (Delete_Player temp)
adaptee = temp;
public void valueChanged (ListSelectionEvent listSelectionEvent)
adaptee.row_Selection(listSelectionEvent);
in the row_Selection function
if(ex.getValueIsAdjusting()) //To remove double selection
return;
ListSelectionModel lsm = (ListSelectionModel) ex.getSource();
if(lsm.isSelectionEmpty())
System.out.println("EMtpy");
else
int selected_row = lsm.getMinSelectionIndex();
ResultSetTableModel model = (ResultSetTableModel) players.getModel();
String name = (String) model.getValueAt(selected_row, 1);
Integer id = (Integer) model.getValueAt(selected_row, 3);
This is how I got info out of a table when the user selected it -
Hi everyone,
I'm experiencing a rather annoying (and increasingly frequent) problem....
I have a program using several different modules for instrument communication (Spectrometer, filter wheel, monochromator etc) which has been running fine for a year or so.
Recently, I have problems with LV bombing out in the middle of a measurement. No error messages from LV, a system-level crash. I'm not used to this kind of thing.
Following pictures are details of ONE type of crash (it has two or three different "forms").
The dialogs appear in this order:
Details on my system:
I'm using a dell (I've seen reports of problems regarding this before....), but the crashes happened on an old no-name beige box before also.
The VIs are saved with diagram on a network drive (Both PCs using WinXP Pro with up-to-date patches).
I am calling a DLL for a spectrometer interface, but testing this code on its own for several hours cannot generate a crash.
All other functions are built-in G.
It seems kind of fond of crashing in the middle os a gauss-fitting routine I've written (Heavily modified Levenberg routine). This code has also worked without any problems since over a year.
I am using 3 RS-232 ports (Filter wheel, Spectrometer, Linear stage) and 2 USB ports (Spectrometer via DLL, Relay via Command-line parameters).
The crashes seem random with no single module causing the problems (except for the affinity mentioned above). Sometimes I can even finish a complete measurement series (oooh) whereas sometimes I only get through 10 or 30 or 50%.
I'm at a loss currently. I've looked at as much of the code as I can, and I can't see anything wrong. I've even tried copying the code to new VIs, but this hasn't stopped the crashes.
Please help....
Shane.
Message Edited by shoneill on 10-10-2006 11:11 AM Added pictures
Message Edited by shoneill on 10-10-2006 11:11 AM Linked to pictures
Message Edited by shoneill on 10-10-2006 11:12 AM
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2)
Attachments:
crash.png 13 KB
crash 2.png 6 KB
crash 3.png 2 KBI know 6.1 isn't supported any more, but It's been rock solid until now.....
Either way, it looks like we'll be upgrading to 8.2 soon, so I suppose I'll just hope that the errors will go away then.......
I was hoping that the error message could give SOME insight as to whether the LV core, Windows or a device driver was the problem.
I suppose I'll never know......
Shane.
PS: Can someone at least tell me what "Runtime Error 217" is?
Message Edited by shoneill on 10-11-2006 04:35 PM
Using LV 6.1 and 8.2.1 on W2k (SP4) and WXP (SP2) -
I'm attempting to write a Combat Converter for a popular online game called Ogame. I'm attempting to read a text file that contians something similiar to the sample of the text file I have provided below. What I want to take out from the file is the first and last time a line that begins with Type and Num that shows up for the attacker and defender. However I'm having trouble figuring out how write it so that it does not take it out for the rest of the lines that start with Type and Num. Do you have any suggestions on how I should go about do so?
Attacker 1
Weapons:+10% Shields:+10% Armour:+10%
Type S.Cargo L.Cargo L.Fighter H.Fighter Cruiser B.Ship Col. Ship Recy. Esp. Probe Bomber Dest. Rip Battlecr
Num 1 1 1 1 1 1 1 1 1 1 1 1 1
Weapon 5 5 55 165 440 1.100 55 1 0 1.100 2.200 220.000 770
Shields 11 27 11 27 55 220 110 11 0 550 550 55.000 440
Armour 440 1.320 440 1.100 2.970 6.600 3.300 1.760 110 8.250 12.100 990.000 7.700
Defender 1
Weapons:+10% Shields:+10% Armour:+10%
Type S.Cargo L.Cargo L.Fighter H.Fighter Cruiser B.Ship Col. Ship Recy. Esp. Probe Bomber Sol. Sat Dest. Rip Battlecr Miss. L.Laser H.Laser Gauss Ion.C Plasma S.Dome LS.Dome
Num 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
Weapon 5 5 55 165 440 1.100 55 1 0 1.100 1 2.200 220.000 770 88 110 275 1.210 165 3.300 1 1
Shields 11 27 11 27 55 220 110 11 0 550 1 550 55.000 440 22 27 110 220 550 330 2.200 11.000
Armour 440 1.320 440 1.100 2.970 6.600 3.300 1.760 110 8.250 220 12.100 990.000 7.700 220 220 880 3.850 880 11.000 2.200 11.000
The attacking fleet fires a total of 18 times with the total power of 1.059.543 upon the defender.
The defender's shields absorb 18.910 damage points.
The defending fleet fires a total of 33 times with the total power of 1.922.677 upon the attacker.
The attacker's shields absorb 38.730 damage points.
Attacker 1
Type B.Ship Col. Ship Rip
Num 0 0 1
Weapon 1.100 55 220.000
Shields 220 110 55.000
Armour 6.600 3.300 990.000
Defender 1
Type S.Cargo L.Cargo L.Fighter H.Fighter Cruiser B.Ship Col. Ship Esp. Probe Bomber Dest. Rip Battlecr Miss. L.Laser Ion.C S.Dome LS.Dome
Num 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0
Weapon 5 5 55 165 440 1.100 55 0 1.100 2.200 220.000 770 88 110 165 1 1
Shields 11 27 11 27 55 220 110 0 550 550 55.000 440 22 27 550 2.200 11.000
Armour 440 1.320 440 1.100 2.970 6.600 3.300 110 8.250 12.100 990.000 7.700 220 220 880 2.200 11.000
The attacking fleet fires a total of 11 times with the total power of 2.276.933 upon the defender.
The defender's shields absorb 17.510 damage points.
The defending fleet fires a total of 47 times with the total power of 9.540.458 upon the attacker.
The attacker's shields absorb 15.761 damage points.
Attacker 1
Type Rip
Num 0
Weapon 220.000
Shields 55.000
Armour 990.000
Defender 1
Type S.Cargo B.Ship Esp. Probe Bomber Dest. Rip Battlecr S.Dome LS.Dome
Num 0 0 0 0 0 0 0 0 0
Weapon 5 1.100 0 1.100 2.200 220.000 770 1 1
Shields 11 220 0 550 550 55.000 440 2.200 11.000
Armour 440 6.600 110 8.250 12.100 990.000 7.700 2.200 11.000
The battle ends draw.
The attacker has lost a total of 10.178.000 units.
The defender has lost a total of 1.836.800 units.
At these space coordinates now float 1.776.210 Metal and 1.413.954 Crystal.I'm attempting to write a Combat Converter for a
popular online game called Ogame. I'm attempting to
read a text file that contians something similiar to
the sample of the text file I have provided below.
What I want to take out from the file is the first
and last time a line that begins with Type and Num
that shows up for the attacker and defender....Please define "take out from the file". Do you want to read and store just these lines?
Or do you want to remove these lines from the file and rewrite the file without these lines?
/Pete -
Pythagorean triples complex squares
While working on a math problem recently that involved Pythagorean Triples I spotted a connection with the complex numbers that I had never noticed previously. It is a trivial observation and I was surprised that in my many years as a mathematician I had never heard anyone mention this little fact. I am curious if this little fact is well known to others and I just happened to miss it or if it really is unknown to most folks.
A Pythagorean triple is a set of three integers like 3,4,5 that make a right triangle with integer sides. Being a right triangle the numbers fit the Pythagorean theorem, a^2 + b^2 = c^2 and sho nuff 9 + 16 = 25
Euclid has a proof that is presented in the Elements that all Pythagorean triples can be generated from two integers s, and t by means of these formulae
a = 2st
b = s^2 - t^2
c = s^2 + t^2
It is fairly easy to use algebra to square a and b using those formulae and see that these numbers do in fact form a Pythagorean triple. It is only slightly more difficult to go the other way and show that all triples are of this form.
So all of this is ancient history - known to Euclid.
Now let us take a complex number, c = a + bi. Let it be a complex integer, meaning that a and b are actually integers. Viewed from the complex plane, the complex number c represents a little right triangle, one leg is the real part, one leg is the imaginary part and the hypotenuse is the norm of the complex number c i.e.
|c| = sqrt(a^2 + b^2)
Clearly because of the square root sign the norm of c is not necessarily an integer and thus the triangle a,b,c is not necessarily a Pythagorean triple. However just square the complex number c
(a + bi)*(a + bi) = (a^2 - b^2) + (2ab)i
Notice anything about the form of a perfect square in the complex plane and Euclid's characterization of a Pythagorean triple? One leg is a difference of squares the other is twice the product of the two numbers.
They are one and the same. The Pythagorean triples are just exactly the perfect squares in the complex plane.
So for example (2 + i) is not a square and is not a Pythagorean triple. Its norm is sqrt(5). but if you square it, you get (3 + 4i) whose norm is 5.
That is the observation. Nothing difficult. Perfectly obvious. Every mathematician from Euclid on knows about right triangles and everyone since Gauss has been able to multiply two complex integers. It is about as easy as math gets. I was astonished that in years as a working mathematician I had never noticed this nor heard anyone mention this simple fact.
Yes, I know - you're thinking that the reason this never came up in conversation is because this observation is totally irrelevant and practically useless, but that has never stopped mathematics. Just ask any mathematician to tell you about paracompact Hausdorff spaces and listen to an amazing tirade of irrelevant and practically useless information.
The Pythagorean triples are just the perfect squares in the complex plane.
Just for grins Google 'Pythagorean triples "complex squares"' to see a Google search that returns but a single result. Hole in one. except that it is not about the result that I just mentioned.
I make no claim that any of this is original, I am only flabbergasted at my ignorance and am casting out to see if I was just asleep the day they covered this in high school or if this really is a rather obscure and little known even if trivial observation.
There is nothing left to say but to ask the survey questions
1) Did you know this before you read it here?
2) If you did know it, was it shown to you or did you discover it yourself?
Enjoy!You are so correct Jos, you can have a common prime root in the legs. Euclid's formula was for the primitive triples.
I had run into a triple in a problem that I was playing with, remembered that there was a characterization in Euclid and while skimming it noticed that it looked exactly like a squared complex number. This would explain the lack of finding this fact noted on the various math sites - the mere fact that it isn't really true.
The connection to the complex plane is real but as you say the complex squares are the pirmitive triples not all of them.
Of course, if I were a good mathematician I would pretend that I knew that all along and in a disgusted tone utter, "Do you take me for some kind of fool? Obviously I meant 'primitive' because it isn't true otherwise."
These days I am closer to fool than to a good mathematician.
I am very glad that you pointed this out. The problem I was working on required triples and I was about to limit my considerations to just the primitive ones when in fact a non-primitive one could do.
Domo arigato gozaimashita! -
VBA to save an Excelfile as pdfdocument with a pdf document open password
I use VBA and Adobe Acrobat PDFMaker to save Excel-files as pdfs.
The code I use works perfectly (see below). Which VBA-command is
necessary to add a Document Open Password to the pdf to open the pdf-file?
thank you in advance and
best regards
gauss
Sub xls_to_pdf()
Dim member As Variant
pdfZähler = 0
dieseDatei = ThisWorkbook.Path & "\" & Left(ThisWorkbook.Name, Len(ThisWorkbook.Name) - 4)
drucker = "Adobe PDF"
Sheets("Frontpage").Select: drucken_mergen
Sheets("Final").Select
For Each member In Range("regionen")
Range("A1").Value = member
Application.Calculate
drucken_mergen
Next member
End Sub
Sub drucken_mergen()
'drucken
Dim AdobeDistiller As ACRODISTXLib.PdfDistiller
Set AdobeDistiller = New ACRODISTXLib.PdfDistiller
If pdfZähler = 0 Then
file(0) = dieseDatei
Else
file(pdfZähler) = dieseDatei & Format(pdfZähler, "0000")
End If
ActiveSheet.PrintOut copies:=1, preview:=False, _
ActivePrinter:=drucker, printtofile:=True, printtofile:=True, _
prtofilename:=file(pdfZähler) & ".ps"
AdobeDistiller.FileToPDF file(pdfZähler) & ".ps", file(pdfZähler) & ".pdf", ""
Kill file(pdfZähler) & ".log"
Kill file(pdfZähler) & ".ps"
'mergen
Dim pdfZiel As AcroPDDoc
Dim pdfQuelle As AcroPDDoc
Set pdfZiel = CreateObject("AcroExch.PDDoc")
Set pdfQuelle = CreateObject("AcroExch.PDDoc")
If pdfZähler = 0 Then
pdfZiel.Open (file(pdfZähler) & ".pdf")
Else
pdfZiel.Open (file(0) & ".pdf")
pdfQuelle.Open (file(pdfZähler) & ".pdf")
pdfZiel.InsertPages pdfZiel.GetNumPages - 1, _
pdfQuelle, 0, pdfQuelle.GetNumPages, True
pdfQuelle.Close
pdfZiel.Save 1, file(0) & ".pdf"
Kill file(pdfZähler) & ".pdf"
End If
pdfZähler = pdfZähler + 1
End SubDear Irosenth
thank you for your answer! -
Filter plugin. Problem after change image depth.
Hi All !
I already wrote filter plugin it work fine but only for image depth 8bit, after i change image depth on 16 or 32 bits I getting error msg box from photoshop.
I try change on 'destination.colBits = 8' or 'destination.colBits = pChannel->depth' or ' (pChannel->bounds.bottom - pChannel->bounds.top) * pChannel->depth;' but all the same.
PixelMemoryDesc destination;
destination.data = data; //*pixel
destination.depth = pChannel->depth;
destination.rowBits = (pChannel->bounds.right - pChannel->bounds.left) * pChannel->depth;
destination.colBits = 8;
destination.bitOffset = 0 ;
Please help someone !
Very Thanks in Advance !
All code below:
// Gauss.cpp
// gauss
// Created by Dmitry Volkov on 30.12.14.
// Copyright (c) 2014 Automatic System Metering. All rights reserved.
#include "Gauss.h"
#include "GaussUI.h"
#include "FilterBigDocument.h"
#include <fstream>
using namespace std;
SPBasicSuite* sSPBasic = NULL;
FilterRecord* gFilterRecord = NULL;
PSChannelPortsSuite1* sPSChannelPortsSuite = NULL;
PSBufferSuite2* sPSBufferSuite64 = NULL;
int16* gResult = NULL;
void DoParameters ();
void DoPrepare ();
void DoStart ();
void DoFinish ();
void DoEffect();
void GaussianBlurEffect(ReadChannelDesc* pChannel, char* data);
void ReadLayerData(ReadChannelDesc* pChannel, char* pLayerData);
void WriteLayerData(ReadChannelDesc* pChannel, char* pLayerData);
DLLExport MACPASCAL void PluginMain(const int16 selector,
FilterRecordPtr filterRecord,
intptr_t * data,
int16 * result)
sSPBasic = filterRecord->sSPBasic;
gFilterRecord = filterRecord;
gResult = result;
try {
if (sSPBasic->AcquireSuite(kPSChannelPortsSuite,
kPSChannelPortsSuiteVersion3,
(const void **)&sPSChannelPortsSuite))
*gResult = errPlugInHostInsufficient;
if (sSPBasic->AcquireSuite( kPSBufferSuite,
kPSBufferSuiteVersion2,
(const void **)&sPSBufferSuite64))
*gResult = errPlugInHostInsufficient;
if (sPSChannelPortsSuite == NULL || sPSBufferSuite64 == NULL)
*result = errPlugInHostInsufficient;
return;
switch (selector)
case filterSelectorParameters:
DoParameters();
break;
case filterSelectorPrepare:
DoPrepare();
break;
case filterSelectorStart:
DoStart();
break;
case filterSelectorFinish:
DoFinish();
break;
catch (...)
if (NULL != result)
*result = -1;
void DoParameters ()
void DoPrepare ()
void DoStart ()
if (*gResult == noErr)
if (doUi())
DoEffect();
void DoFinish ()
#define defColBits 8
void DoEffect()
// Start with the first target composite channel
ReadChannelDesc *pChannel = gFilterRecord->documentInfo->targetCompositeChannels;
// Calculation width and height our filter window
int32 width = pChannel->bounds.right - pChannel->bounds.left;
int32 height = pChannel->bounds.bottom - pChannel->bounds.top;
fstream logFile ("/Volumes/Macintosh Media/GaussLogFile.txt", ios::out);
logFile << endl << "top " << pChannel->bounds.top;
logFile << endl << "bottom " << pChannel->bounds.bottom;
logFile << endl << "left " << pChannel->bounds.left;
logFile << endl << "right " << pChannel->bounds.right;
logFile << endl << "depth " << pChannel->depth;
logFile << endl << "vRes " << gFilterRecord->documentInfo->vResolution;
logFile << endl << "hRes " << gFilterRecord->documentInfo->hResolution;
// Get a buffer to hold each channel as we process. Note we can using standart malloc(size_t) or operator new(size_t)
// functions, but Adobe recommend sPSBufferSuite64->New() for memory allocation
char *pLayerData = sPSBufferSuite64->New(NULL, width*height*pChannel->depth/8);
if (pLayerData == NULL)
return;
// we may have a multichannel document
if (pChannel == NULL)
pChannel = gFilterRecord->documentInfo->alphaChannels;
// Loop through each of the channels
while (pChannel != NULL && *gResult == noErr)
ReadLayerData(pChannel, pLayerData);
GaussianBlurEffect(pChannel, pLayerData);
WriteLayerData(pChannel, pLayerData);
// off to the next channel
pChannel = pChannel->next;
pChannel = gFilterRecord->documentInfo->targetTransparency;
// Delete pLayerData
sPSBufferSuite64->Dispose((char**)&pLayerData);
void GaussianBlurEffect(ReadChannelDesc* pChannel, char *data)
// Make sure Photoshop supports the Gaussian Blur operation
Boolean supported;
if (sPSChannelPortsSuite->SupportsOperation(PSChannelPortGaussianBlurFilter,
&supported))
return;
if (!supported)
return;
// Set up a local rect for the size of our port
VRect writeRect = pChannel->bounds;
PIChannelPort inPort, outPort;
// Photoshop will make us a new port and manage the memory for us
if (sPSChannelPortsSuite->New(&inPort,
&writeRect,
pChannel->depth,
true))
return;
if (sPSChannelPortsSuite->New(&outPort,
&writeRect,
pChannel->depth,
true))
return;
// Set up a PixelMemoryDesc to tell how our channel data is layed out
PixelMemoryDesc destination;
destination.data = data; //*pixel
destination.depth = pChannel->depth;
destination.rowBits = (pChannel->bounds.right - pChannel->bounds.left) * pChannel->depth;
destination.colBits = defColBits;
destination.bitOffset = 0 ;
// Write the current effect we have into this port
if (sPSChannelPortsSuite->WritePixelsToBaseLevel(inPort,
&writeRect,
&destination))
return;
// Set up the paramaters for the Gaussian Blur
PSGaussianBlurParameters gbp;
int inRadius = 1;
Fixed what = inRadius << 16;
gbp.radius = what;
gbp.padding = -1;
sPSChannelPortsSuite->ApplyOperation(PSChannelPortGaussianBlurFilter,
inPort,
outPort,
NULL,
(void*)&gbp,
&writeRect);
if (sPSChannelPortsSuite->ReadPixelsFromLevel(outPort,
0,
&writeRect,
&destination))
return;
// Delete the temp port in use
sPSChannelPortsSuite->Dispose(&inPort);
sPSChannelPortsSuite->Dispose(&outPort);
void ReadLayerData(ReadChannelDesc *pChannel, char *pLayerData)
// Make sure there is something for me to read from
Boolean canRead;
if (pChannel == NULL)
canRead = false;
else if (pChannel->port == NULL)
canRead = false;
else if (sPSChannelPortsSuite->CanRead(pChannel->port, &canRead))
// this function should not error, tell the host accordingly
*gResult = errPlugInHostInsufficient;
return;
// if everything is still ok we will continue
if (!canRead || pLayerData == NULL)
return;
// some local variables to play with
VRect readRect = pChannel->bounds;
PixelMemoryDesc destination;
// set up the PixelMemoryDesc
destination.data = pLayerData;
destination.depth = pChannel->depth;
destination.rowBits = pChannel->depth * (readRect.right - readRect.left);
destination.colBits = defColBits;
destination.bitOffset = 0 ;
// Read this data into our buffer, you could check the read_rect to see if
// you got everything you desired
if (sPSChannelPortsSuite->ReadPixelsFromLevel(
pChannel->port,
0,
&readRect,
&destination))
*gResult = errPlugInHostInsufficient;
return;
void WriteLayerData(ReadChannelDesc *pChannel, char *pLayerData)
Boolean canWrite = true;
if (pChannel == NULL || pLayerData == NULL)
canWrite = false;
else if (pChannel->writePort == NULL)
canWrite = false;
else if (sPSChannelPortsSuite->CanWrite(pChannel->writePort, &canWrite))
*gResult = errPlugInHostInsufficient;
return;
if (!canWrite)
return;
VRect writeRect = pChannel->bounds;
PixelMemoryDesc destination;
destination.data = pLayerData;
destination.depth = pChannel->depth;
destination.rowBits = pChannel->depth * (writeRect.right - writeRect.left); //HSIZE * pChannel->depth * gXFactor*2;
destination.colBits = defColBits;
destination.bitOffset = 0 ;
if (sPSChannelPortsSuite->WritePixelsToBaseLevel(
pChannel->writePort,
&writeRect,
&destination))
*gResult = errPlugInHostInsufficient;
return;Have you reviewed your code vs the Dissolve example? It is enabled for other bit depths as well.
-
[splus-users:19674] [S] Number crunching testreport 4th edition
Dear users of mathematical or statistical software,
I would like to announce the foruth edition of my testreport "Comparison
of mathematical programs for data analysis" which has just been
finished. The testreport which is written in English is available as PDF
file (Acrobat Reader) at the following website :
http://www.scientificweb.com/ncrunch/index.html
This testreport contains information about the actual versions of the
programs
- GAUSS (Version 5.0)
- Maple (Version 8.0)
- Mathematica (Version 4.2)
- Matlab (Version 6.5)
- MuPAD (Version 2.5)
- O-Matrix (Version 5.2)
- Ox (Version 3.1)
- Scilab (Version 2.6.1)
- S-Plus (Version 6.1)
grouped by th
e following sections
- Comparison of the mathematical functionality
- Comparison of the graphical functionality
- Functionality of the programming environment
- Data import/export and data preprocessing functions
- Available operating systems
- Speed comparison
- Summary
The weighting for the above listed sections are all explained in the
testreport so that an individual weighting could also be done.
Sincerely,
Stefan Steinhaus
===================================================================
Stefan Steinhaus
Plievierpark 16
D-81737 München
Germany
Tel.: ++49-(0)89-62837653
Fax.: ++49-(0)89-62837654
Cell phone: ++49-(0)172-2976924
E-Mail: [email protected]
===================================================================
Homepage : http://www.steinhaus-net.de
Scientific Web : http://www.scientificweb.de
http://www.scientificweb.com
===================================================================
This message was distributed by [email protected] To
unsubscribe send e-mail to [email protected] with
the BODY of the message: unsubscribe s-newsHave you tred this:
Error 1602: Try the following steps to resolve this error:
Ensure proper USB isolation troubleshooting has been performed, and test with a known-good cable.
Follow the steps listed for Error 1604.
This error may be resolved by disabling, deactivating, or uninstalling third-party security, antivirus, and firewall software. See steps in this article for details on troubleshooting security software.
From:
http://support.apple.com/kb/TS3694 -
JAI: GaussianBlur problem
I have made a GaussianBlur class to control image Gauss blur .
but the larger radius I give the kernel, the thicker edge the image gets.
what's the problem?
// to generate gauss kernel
private static float[] makeKernel(double radius) {
radius += 1;
int s = (int)radius;
int size = s*s;
float[] kernel = new float[size];
double v;
for (int i=0; i<s; i++) {
for ( int j= 0; j < s; j++) {
kernel[i*s + j] = (float)(Math.exp(-0.5*(sqr(i)+sqr(j))/sqr(radius))/(2*Math.PI*sqr(radius)));
return kernel;
public void applyFilter(float radius) {
float[] elements = makeKernel(radius);
normalize(elements);
KernelJAI kernel = new KernelJAI((int)radius+1, (int)radius+1, elements);
// start convolve image on the kernel
ParameterBlock pb = new ParameterBlock();
pb.addSource(source);
pb.add(kernel);
RenderedImage target = JAI.create("convolve", pb, null);the problem is how you want to treat to border of your image. The blur works by calculating the average value of the neighbouring pixels for a given center pixel. So you have to tell your algorithm what to do if your "center" pixel sits on the outside border and lacks its neighbours...
take a look at the docu on java.awt.image.ConvolveOp which specifies two types of "edge_conditions", i.e. solutions to the problem: EDGE_NO_OP, EDGE_ZERO_FILL -
Macbook Air case with magnets. Will it affect hardware or performance of product?
Macbook Air case with magnets. Will it affect hardware or performance of product?
No, the low power N30 or N35 gauss neodymium magnets in the magnetic flap cases will not affect it.
There is no HD, and the SSD are hard (relatively) to corrupt by magnetic field unless high gauss and at close proximity. -
I get a "shimmer" on some photos after applying & rendering Ken Burns
In a slideshow I'm attempting to make in iMovie, I'm getting a "shimmering" effect after applying the Ken Burns effect to photos I've imported from iPhoto. The shimmer appears most noticeable in shots of scenary, where there is a lot of detail like tree leaves or grass. (In addition, as many others also have noted and complained about, the resolution, and even the color, in iMovie is really a disappointment. This is especially distressing because the original digital photos I took are incredibly crisp and clear, with beautiful color, and the slideshows I made in iPhoto and played on my iMac are gorgeous!). The Ken Burns' "shimmer" & poor resolution in iMovie and burning slideshows onto a DVD seem hardly worth all the time & effort. This is a real shortcoming in the Apple software it seems to me. Apple needs to fix it in future updates to the Tiger operating system or in the forthcoming Leopard.
MagneticMike,
what you see is usually referred to as a 'Moire' pattern that is caused by high-contrast in your source material. This means that exactly the 'incredibly crisp and clear' advantage of your photo is ruining your clip. In photographs, moire problems are usually overcome by slightly softening (e.g gauss blurring) the offending areas before the final render pass. This you can apply to your source image as well, and then import it into iMovie.
Interestingly, a different approach is possible with moving media. Since moire patterns are artificial noise introduced into your clip, people have found that our 'noise filter (combine)' plug-in can get rid of this. Perhaps you can download the plug-in and try if it helps with your problem.
(please try this link: http://imovieplugins.com/plugs/noisefiltercombi.html )
Hope this helps
-ch
Please Note:
I work for cf/x, and may profit from posting here.
Maybe you are looking for
-
ITunes keeps reverting ID3 tags
I have quite a few MP3s which, no matter how many times I edit/correct their ID3 tags, revert to what they were originally. This happens any time I restart iTunes. Any idea what causes this? Is it just the nature of some MP3s, or is there something I
-
My ipod nano, 4th generation, is not being recognized by my computer or itunes
my ipod nano, 4th generation, is not being recognized by my computer or itunes, what do i do? I've tried using different cords, but nothing will pick it up.
-
I have a new windows 7 computer. I have downloaded my old itunes library from my carbonite backup to this computer. I cannot seem to move the old library folder to the new itunes program I have just downloaded.
-
Problem in presenter with hebrew
hi i am trying to publish a presentation that has hebrew characters in it. after i publish, the characters presented backwards (left to right instead of right to left) does anyone know how to fix this? thank you tizkiko
-
Could you please stop this spammer?
Begin forwarded message: From: Christine M <***> Date: 17. November 2012 16:50:00 MEZ To: efrain18@*** Subject: Re: Reply-To: ewurajee@*** <Emails Edited By Host>