Bug fixes to group localiser

This commit is contained in:
Jamie Mac 2023-08-24 10:42:11 +01:00
parent 1d3d77e5aa
commit dfd556029a
12 changed files with 91 additions and 60 deletions

View File

@ -120,8 +120,9 @@ public class ArraySettingsPane extends SettingsPane<PamArray >{
@Override
public PamArray getParams(PamArray currParams) {
// TODO Auto-generated method stub
return null;
currParams = hydrophonePane.getParams(currParams);
currParams = streamerPane.getParams(currParams);
return currParams;
}
@Override

View File

@ -83,7 +83,8 @@ public class HydrophoneSettingsPane extends SettingsPane<Hydrophone> {
private Label recieverSensLabel;
private Label dBSensLabel;
private boolean ressetHydrophoneType = false;
/**
* The main holder pane.
@ -235,11 +236,15 @@ public class HydrophoneSettingsPane extends SettingsPane<Hydrophone> {
defaultHydro.getSelectionModel().select(0);
defaultHydro.setOnAction((action)->{
if (defaultHydro.getSelectionModel().getSelectedIndex() == 0) {
//don't want to trigger this if we are programtically setting it back
if (defaultHydro.getSelectionModel().getSelectedIndex() <= 0 || ressetHydrophoneType) {
//do nothing.
return;
}
ressetHydrophoneType=true;
hSens.getValueFactory().setValue(Double.valueOf(DefaultHydrophone.values()[defaultHydro.getSelectionModel().getSelectedIndex()-1].getSens()));
preampGain.getValueFactory().setValue(Double.valueOf(DefaultHydrophone.values()[defaultHydro.getSelectionModel().getSelectedIndex()-1].getGain()));
ressetHydrophoneType=false;
});
mainControls.add(defaultHydro, 1, gridy);
@ -247,10 +252,14 @@ public class HydrophoneSettingsPane extends SettingsPane<Hydrophone> {
gridy++;
mainControls.add(recieverSensLabel = new Label(""), 0, gridy);
recieverSensLabel.setAlignment(Pos.CENTER_RIGHT);
hSens = new PamSpinner<Double>();
hSens = new PamSpinner<Double>(-Double.MAX_VALUE, Double.MAX_VALUE, -200., 1.);
hSens.setEditable(true);
hSens.valueProperty().addListener((obs, oldval, newVal)->{
if (ressetHydrophoneType) return;
ressetHydrophoneType = true; //make sure we don't trigger anything when resetting the combo box
defaultHydro.getSelectionModel().select(0);
ressetHydrophoneType= false;
});
mainControls.add(hSens, 1, gridy);
@ -261,10 +270,15 @@ public class HydrophoneSettingsPane extends SettingsPane<Hydrophone> {
Label preAmpLabel = new Label("Preamplifier gain");
mainControls.add(preAmpLabel, 0, gridy);
preAmpLabel.setAlignment(Pos.CENTER_RIGHT);
preampGain =new PamSpinner<Double>();
preampGain =new PamSpinner<Double>(-Double.MAX_VALUE, Double.MAX_VALUE, 0., 1.);
preampGain.valueProperty().addListener((obs, oldval, newVal)->{
if (ressetHydrophoneType) return;
ressetHydrophoneType = true;//make sure we don't trigger anything when resetting the combo box
defaultHydro.getSelectionModel().select(0);
ressetHydrophoneType= false;
});
preampGain.setEditable(true);
mainControls.add(preampGain, 1, gridy);
mainControls.add(new Label("dB"), 2, gridy);
@ -439,10 +453,8 @@ public class HydrophoneSettingsPane extends SettingsPane<Hydrophone> {
double zCoeff = PamController.getInstance().getGlobalMediumManager().getZCoeff();
try {
//hydrophone.setID(Integer.valueOf(iD.getText()));
//hydrophone.setType(type.getText());
hydrophone.setStreamerId(streamers.getSelectionModel().getSelectedIndex());
hydrophone.setSensitivity(hSens.getValue()+PamController.getInstance().getGlobalMediumManager().getdBSensOffset());
hydrophone.setPreampGain(preampGain.getValue());

View File

@ -36,11 +36,17 @@ public class HydrophonesPane extends PamBorderPane {
*/
protected PamArray currentArray;
/**
* The current hydrophone data.
*/
private HydrophoneProperty currentHydrophoneData;
/**
* A list of all the current hydrophones.
*/
ObservableList<HydrophoneProperty> hydrophoneList = FXCollections.observableArrayList();
/**
* The hydrophone array table.
*/
@ -67,12 +73,19 @@ public class HydrophonesPane extends PamBorderPane {
pamFlipePane.setAdvPaneContent(hydrophonePane.getContentNode());
pamFlipePane.setFrontContent(tableArrayPane);
pamFlipePane.getFront().setPadding(new Insets(5,5,5,5));
pamFlipePane.getFront().setPadding(new Insets(5,5,5,10));
// tableArrayPane.setPadding(new Insets(5,5,5,5));
//this.setStyle("-fx-background-color: grey;");
pamFlipePane.flipFrontProperty().addListener((obsval, oldVal, newVal)->{
//the flip pane
if (newVal) {
Hydrophone hydro = hydrophonePane.getParams(currentHydrophoneData.getHydrophone());
currentHydrophoneData.setHydrophone(hydro);
//need to refresh table to show symbol.
tableArrayPane.getTableView().refresh();
}
});
this.setCenter(pamFlipePane);
}
@ -83,7 +96,6 @@ public class HydrophonesPane extends PamBorderPane {
*/
class HydrophoneTable extends TableSettingsPane<HydrophoneProperty> {
public HydrophoneTable(ObservableList<HydrophoneProperty> hydrophoneData) {
super(hydrophoneData);
//need to set up all the rows.
@ -145,32 +157,12 @@ public class HydrophonesPane extends PamBorderPane {
hydrophonePane.setCurrentArray(currentArray);
hydrophonePane.setParams(data.getHydrophone());
currentHydrophoneData = data;
pamFlipePane.flipToBack();
}
/**
* Set hydrophone pane within hiding pane.
* @param clickTypeProperty
*/
public void setHydrophonePane(HydrophoneProperty data){
hydrophonePane.setCurrentArray(getCurrentArray());
hydrophonePane.setCurrentArray(currentArray);
hydrophonePane.setParams(data.getHydrophone());
//now need to make sure on closing the pane that settings are saved. Need to
//remove the old click type from the list and add new one in the same position.
getFlipPaneCloseButton().setOnAction((action)->{
pamFlipePane.flipToFront();
Hydrophone hydro = hydrophonePane.getParams(data.getHydrophone());
data.setHydrophone(hydro);
//need to refresh table to show symbol.
this.getTableView().refresh();
});
}
private PamArray getCurrentArray() {
return currentArray;
@ -202,5 +194,23 @@ public class HydrophonesPane extends PamBorderPane {
this.currentArray=currentArray;
}
public PamArray getParams(PamArray currParams) {
return currParams;
}
/**
* Get the current hydrophone list.
* @return the current hydrophone list.
*/
public ObservableList<HydrophoneProperty> getHydrophoneList() {
return hydrophoneList;
}
public void setHydrophoneList(ObservableList<HydrophoneProperty> hydrophoneList) {
this.hydrophoneList = hydrophoneList;
}
}

View File

@ -114,5 +114,10 @@ public class StreamerPane extends PamBorderPane {
this.currentArray=currentArray;
}
public PamArray getParams(PamArray currParams) {
// TODO Auto-generated method stub
return null;
}
}

View File

@ -28,8 +28,7 @@ public class StreamerSettingsPane extends SettingsPane<Streamer> {
@Override
public Streamer getParams(Streamer currParams) {
// TODO Auto-generated method stub
return null;
return currParams;
}
@Override

View File

@ -63,7 +63,8 @@ public class HyperbolicSettingsPane extends LocaliserPane<HyperbolicParams> {
@Override
public void setParams(HyperbolicParams input) {
System.out.println("Hyperbolic set Params: " + input.bootStrapN);
if (input==null) input = new HyperbolicParams();
//System.out.println("Hyperbolic set Params: " + input.bootStrapN);
numIterations.getValueFactory().setValue(input.bootStrapN);
hyperbolicToggleSwitch.setSelected(input.calcErrors);
}

View File

@ -15,6 +15,12 @@ import pamViewFX.fxNodes.PamLabel;
import pamViewFX.fxNodes.pamDialogFX.PamDialogFX;
import pamViewFX.validator.PamValidator;
/**
* The TOAD options pane.
*
* @author Jamie Macaulay
*
*/
public class TOADOptionsPane extends SettingsPane<TOADBaseParams>{
private BorderPane mainPane;
@ -34,7 +40,7 @@ public class TOADOptionsPane extends SettingsPane<TOADBaseParams>{
GridPane gridPane = new PamGridPane();
int x = 0, y = 0;
gridPane.add(new PamLabel("Min correlation ", Pos.CENTER_RIGHT), x++, y);
gridPane.add(minCorrelation = new TextField("1234"), x, y);
gridPane.add(minCorrelation = new TextField("0"), x, y);
//create check to show at least some check boxes need to be selected.
@ -63,7 +69,7 @@ public class TOADOptionsPane extends SettingsPane<TOADBaseParams>{
x = 0;
y++;
gridPane.add(new PamLabel("Min TOAD measurements ", Pos.CENTER_RIGHT), x++, y);
gridPane.add(minTimeDelays = new TextField("1234"), x, y);
gridPane.add(minTimeDelays = new TextField("3"), x, y);
validator.createCheck()
.dependsOn(("min_delays"), minTimeDelays.textProperty())
@ -79,13 +85,13 @@ public class TOADOptionsPane extends SettingsPane<TOADBaseParams>{
c.error("Min TOAD measurements cannot be read as a number");
}
})
.decorates(minCorrelation)
.decorates(minTimeDelays)
.immediate();
x = 0;
y++;
gridPane.add(new PamLabel("Min groups ", Pos.CENTER_RIGHT), x++, y);
gridPane.add(minGroups = new TextField("1234"), x, y);
gridPane.add(minGroups = new TextField("0"), x, y);
validator.createCheck()
@ -102,12 +108,9 @@ public class TOADOptionsPane extends SettingsPane<TOADBaseParams>{
c.error("Minb groups input cannot be read as a number");
}
})
.decorates(minCorrelation)
.decorates(minGroups)
.immediate();
minCorrelation.setTooltip(new Tooltip("Minimum cross correlation coefficient for each hydrophone pair"));
minTimeDelays.setTooltip(new Tooltip("Minimum number of time delays with acceptable cross correlation"));
minGroups.setTooltip(new Tooltip("Minimum number of channel groups included with acceptable cross correlations"));

View File

@ -26,6 +26,7 @@ public class MCMCLoclaiserPane extends LocaliserPane<MCMCParams2> {
@Override
public void setParams(MCMCParams2 input) {
if (input==null) input= new MCMCParams2();
mainPane.setParams(input);
}

View File

@ -59,7 +59,6 @@ public class ToadMCMCLocaliser extends TOADBaseAlgorithm {
@Override
public String getName() {
// TODO Auto-generated method stub
return "MCMC";
}

View File

@ -462,7 +462,9 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
System.out.println("Set params for: " + algoProvider.getName() + " " + params);
if (params!=null && algoProvider.getAlgorithmSettingsPane()!=null) {
if (algoProvider.getAlgorithmSettingsPane()!=null) {
//note that if params are null but a pane exists the algorithm needs to make a new set of params.
algoProvider.getAlgorithmSettingsPane().setParams(params.getAlgorithmParameters());
}
@ -483,11 +485,7 @@ public class GroupLocSettingPaneFX extends SettingsPane<Group3DParams>{
if (currAlgo == null) {
return;
}
// algorithmSourcePane.setDetectionSource(sourcePanel.getSource());
// LocaliserAlgorithmParams locParams = currentParams.getAlgorithmParams(currAlgo);
// if (locParams != null) {

View File

@ -48,7 +48,7 @@ public class FlipPane extends StackPane {
private double flipTime;
private Orientation flipDirection;
private BooleanProperty flippedFrontProperty = new SimpleBooleanProperty();
protected BooleanProperty flippedFrontProperty = new SimpleBooleanProperty();
// ******************** Constructors **************************************
public FlipPane() {

View File

@ -1,6 +1,5 @@
package pamViewFX.fxNodes.flipPane;
import javafx.geometry.Insets;
import javafx.geometry.Orientation;
import javafx.geometry.Pos;
import javafx.scene.Node;
@ -8,9 +7,6 @@ import javafx.scene.control.Label;
import javafx.scene.layout.HBox;
import javafx.scene.layout.Priority;
import javafx.scene.paint.Color;
import javafx.scene.text.Font;
import javafx.scene.text.FontPosture;
import javafx.scene.text.FontWeight;
import pamViewFX.PamGuiManagerFX;
import pamViewFX.fxGlyphs.PamGlyphDude;
import pamViewFX.fxNodes.PamBorderPane;
@ -39,7 +35,7 @@ public class PamFlipPane extends FlipPane {
private Label advLabel;
private PamButton backButton;
public PamFlipPane() {
super();
@ -156,4 +152,10 @@ public class PamFlipPane extends FlipPane {
return backButton;
}
/**
* True if the flip pane is showing the front.
*/
public boolean isShowingFront() {
return super.flipFrontProperty().get();
}
}