Skip to content

Commit

Permalink
Merge branch 'development' into 6.3.1
Browse files Browse the repository at this point in the history
  • Loading branch information
espinoj committed Jun 6, 2017
2 parents a802726 + b6761b7 commit 2bd4e77
Show file tree
Hide file tree
Showing 58 changed files with 2,124 additions and 1,106 deletions.
46 changes: 11 additions & 35 deletions README
Original file line number Diff line number Diff line change
Expand Up @@ -3,20 +3,13 @@ are a user of Tetrad, or even a novice, if you are
willing, would you please consider giving us feedback
on what you like about it or don't like about it? It
would be most appreciated. Just open up an issue (click
on the Issues tab, above). We'll get the message.
Thanks in advance! :)
on the Issues tab, above).

An introduction to Tetrad can be found here:

www.phil.cmu.edu/tetrad

The programmer's website is here:

www.phil.cmu.edu/tetrad/maven

Javadocs are here:

http://cmu-phil.github.io/tetrad/tetrad-lib-apidocs/
Javadocs can be found by running the javadocs command on the project once checked out.

Downloads directory is here:

Expand All @@ -30,11 +23,6 @@ The issue tracker is here:

https://github.com/cmu-phil/tetrad/issues

This is a Maven port of an existing Ant-based project
that's been under development for many years in the
Department of Philosophy at Carnegie Mellon University.
The port was made on 10/27/2015.

For instructions on how to set this project up in
IntelliJ IDEA, see the Wiki. Alternatively, you can
run the lifecycle package target and launch the ejar
Expand All @@ -49,27 +37,15 @@ tetrad
pitt
tetradapp

The tetrad package contains the "model" code; the
tetradapp package contains the "view" (GUI) code. The
model code is packaged as the lib-tetrad submodule; the
view code is packaged as the tetrad submodule; these
can be downloaded separately n the above downloads directory.
The tetrad-lib package contains the "model" code; the
tetrad-gui package contains the "view" (GUI) code.

Contributions are welcome; we will handle these via the
We have a (small) team working (part-time) on this code,
but if you have contributions to me, please feel free.
If you have suggestions or bug reports, please subit
those to the github issue tracker. If you have code
contributions, these will be handled via the
issue tracker and the GitHub pull-request procedure. As
usual, please fork the repository if you'd like to work on
it. Comments are also welcome.

We will try to straighten out our websites soon. Sorry.

Still in the process of cleaning up the code for general use,
sorry. Some files may be removed in the process.

IntelliJ IDEA files were removed from the repository; if
these got removed in your fork, just set up the IntelliJ
project again (without cloning it again, that is). See
Wiki.

Don't be too impressed with the high version number. Tetrad
has gone through many phases, in more than one programming
language. The Java versions are 4 and 5 (the current).
it; contributions will be handled through the usual
github review method by pull request.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>edu.cmu</groupId>
<artifactId>tetrad</artifactId>
<version>6.3.0</version>
<version>6.4.0-SNAPSHOT</version>
<packaging>pom</packaging>

<name>Tetrad Project</name>
Expand Down
2 changes: 1 addition & 1 deletion tetrad-gui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<parent>
<groupId>edu.cmu</groupId>
<artifactId>tetrad</artifactId>
<version>6.3.0</version>
<version>6.4.0-SNAPSHOT</version>
</parent>

<artifactId>tetrad-gui</artifactId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void setup() {
manually.setSelected(true);
randomEveryTime.setEnabled(false);
randomEveryTime.setSelected(false);
} else if (getParams().getString("initializationMode", "manualRetain").equals("randomRatain")) {
} else if (getParams().getString("initializationMode", "manualRetain").equals("randomRetain")) {
randomly.setSelected(true);
randomEveryTime.setEnabled(true);
randomEveryTime.setSelected(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
import edu.cmu.tetrad.algcomparison.algorithm.cluster.Ftfc;
import edu.cmu.tetrad.algcomparison.algorithm.continuous.dag.Lingam;
import edu.cmu.tetrad.algcomparison.algorithm.mixed.Mgm;
import edu.cmu.tetrad.algcomparison.algorithm.multi.FangConcatenated;
import edu.cmu.tetrad.algcomparison.algorithm.multi.ImagesBDeu;
import edu.cmu.tetrad.algcomparison.algorithm.multi.ImagesCcd;
import edu.cmu.tetrad.algcomparison.algorithm.multi.ImagesSemBic;
import edu.cmu.tetrad.algcomparison.algorithm.multi.*;
import edu.cmu.tetrad.algcomparison.algorithm.oracle.pag.*;
import edu.cmu.tetrad.algcomparison.algorithm.oracle.pattern.*;
import edu.cmu.tetrad.algcomparison.algorithm.other.Glasso;
Expand Down Expand Up @@ -99,7 +96,6 @@
*
* @author Joseph Ramsey
* @author Chirayu Kong Wongchokprasitti, PhD ([email protected])
*
*/
public class GeneralAlgorithmEditor extends JPanel implements FinalizingEditor {

Expand Down Expand Up @@ -195,16 +191,17 @@ public GeneralAlgorithmEditor(final GeneralAlgorithmRunner runner) {
descriptions.add(new AlgorithmDescription(AlgName.CPCStable, AlgType.forbid_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.PcMax, AlgType.forbid_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.FGES, AlgType.forbid_latent_common_causes, OracleType.Score));
descriptions.add(new AlgorithmDescription(AlgName.IMaGES_BDeu, AlgType.forbid_latent_common_causes, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.IMaGES_SEM_BIC, AlgType.forbid_latent_common_causes, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.IMaGES_CCD, AlgType.forbid_latent_common_causes, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.CCD, AlgType.forbid_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.CCD_MAX, AlgType.forbid_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.IMaGES_Discrete, AlgType.forbid_latent_common_causes, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.IMaGES_Continuous, AlgType.forbid_latent_common_causes, OracleType.None));
// descriptions.add(new AlgorithmDescription(AlgName.IMaGES_CCD, AlgType.forbid_latent_common_causes, OracleType.None));
// descriptions.add(new AlgorithmDescription(AlgName.CCD, AlgType.forbid_latent_common_causes, OracleType.Test));
// descriptions.add(new AlgorithmDescription(AlgName.CCD_MAX, AlgType.forbid_latent_common_causes, OracleType.Test));
// descriptions.add(new AlgorithmDescription(AlgName.FANG, AlgType.forbid_latent_common_causes, OracleType.None));
// descriptions.add(new AlgorithmDescription(AlgName.EFANG , AlgType.forbid_latent_common_causes, OracleType.None));

descriptions.add(new AlgorithmDescription(AlgName.FCI, AlgType.allow_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.RFCI, AlgType.allow_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.CFCI, AlgType.allow_latent_common_causes, OracleType.Test));
// descriptions.add(new AlgorithmDescription(AlgName.CFCI, AlgType.allow_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.GFCI, AlgType.allow_latent_common_causes, OracleType.Both));
descriptions.add(new AlgorithmDescription(AlgName.TsFCI, AlgType.allow_latent_common_causes, OracleType.Test));
descriptions.add(new AlgorithmDescription(AlgName.TsGFCI, AlgType.allow_latent_common_causes, OracleType.Both));
Expand All @@ -231,7 +228,7 @@ public GeneralAlgorithmEditor(final GeneralAlgorithmRunner runner) {
descriptions.add(new AlgorithmDescription(AlgName.RSkewE, AlgType.orient_pairwise, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.Skew, AlgType.orient_pairwise, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.SkewE, AlgType.orient_pairwise, OracleType.None));
descriptions.add(new AlgorithmDescription(AlgName.Tahn, AlgType.orient_pairwise, OracleType.None));
// descriptions.add(new AlgorithmDescription(AlgName.Tahn, AlgType.orient_pairwise, OracleType.None));

mappedDescriptions = new HashMap<>();

Expand Down Expand Up @@ -516,6 +513,7 @@ public void watch() {
}

if (hpcAccount == null) {
graphEditor.saveLayout();
runner.execute();
graphEditor.replace(runner.getGraphs());
graphEditor.validate();
Expand Down Expand Up @@ -984,6 +982,9 @@ private Algorithm getAlgorithm(AlgName name, IndependenceWrapper independenceWra
case FANG:
algorithm = new FangConcatenated();
break;
case EFANG:
algorithm = new EFangConcatenated();
break;
case FAS:
algorithm = new FAS(independenceWrapper);
break;
Expand All @@ -1010,10 +1011,10 @@ private Algorithm getAlgorithm(AlgName name, IndependenceWrapper independenceWra
case MGM:
algorithm = new Mgm();
break;
case IMaGES_BDeu:
case IMaGES_Discrete:
algorithm = new ImagesBDeu();
break;
case IMaGES_SEM_BIC:
case IMaGES_Continuous:
algorithm = new ImagesSemBic();
break;
case IMaGES_CCD:
Expand Down Expand Up @@ -1406,10 +1407,10 @@ private enum AlgName {
FgesMb, MBFS, Wfges, JCPC, /*FgesMeasurement,*/
FCI, RFCI, CFCI, GFCI, TsFCI, TsGFCI, TsImages, CCD, CCD_MAX,
LiNGAM, MGM,
IMaGES_BDeu, IMaGES_SEM_BIC, IMaGES_CCD,
IMaGES_Discrete, IMaGES_Continuous, IMaGES_CCD,
Bpc, Fofc, Ftfc,
GLASSO,
EB, R1, R2, R3, R4, RSkew, RSkewE, Skew, SkewE, FANG, Tahn
EB, R1, R2, R3, R4, RSkew, RSkewE, Skew, SkewE, FANG, EFANG, Tahn
}

private enum OracleType {None, Test, Score, Both}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import edu.cmu.tetradapp.util.IntTextField;
import edu.cmu.tetradapp.util.WatchedProcess;
import edu.cmu.tetradapp.workbench.*;

import java.awt.*;
import java.awt.datatransfer.*;
import java.awt.dnd.*;
Expand Down Expand Up @@ -71,6 +72,8 @@ public class GraphSelectionEditor extends JPanel implements GraphEditable, Tripl
private List<GraphWorkbench> workbenches;
private GraphPropertiesAction graphAction;
private TriplesAction triplesAction;
private Map<String, List<Integer>> layoutGraph;
private int prevSelected = 0;

/**
* Constructs a graph selection editor.
Expand All @@ -82,6 +85,10 @@ public GraphSelectionEditor(final GraphSelectionWrapper wrapper) {
throw new NullPointerException("The regression wrapper is required.");
}

if (layoutGraph == null) {
layoutGraph = new HashMap<>();
}

// Initialize helpSet - Zhou
String helpHS = "/resources/javahelp/TetradHelp.hs";

Expand Down Expand Up @@ -391,8 +398,19 @@ private void resetGraphs(GraphSelectionWrapper wrapper) {
+ "Try a smaller selection.");
}

GraphUtils.circleLayout(selection, 200, 200, 150);
// GraphUtils.fruchtermanReingoldLayout(selection);
if (!layoutGraph.isEmpty()) {
for (Node node : selection.getNodes()) {
List<Integer> center = layoutGraph.get(node.getName());

if (center != null) {
node.setCenter(center.get(0), center.get(1));
}
}
} else {
GraphUtils.circleLayout(selection, 200, 200, 150);
// GraphUtils.fruchtermanReingoldLayout(selection);
}

GraphWorkbench workbench = getWorkbench(i);
workbench.setGraph(selection);
List<Node> selected = wrapper.getSelectedVariables();
Expand Down Expand Up @@ -497,13 +515,55 @@ public GraphWorkbench getWorkbench() {
if (selectedIndex == -1) {
selectedIndex = 0;
}
return workbenches.get(selectedIndex);

return getWorkbench(selectedIndex);

// Graph graph = workbenches.get(selectedIndex).getGraph();
//
// for (Node node : graph.getNodes()) {
// List<Integer> center = layoutGraph.get(node.getName());
//
// if (center != null) {
// node.setCenter(center.get(0), center.get(1));
// }
// }
//
// return workbenches.get(selectedIndex);
}

public GraphWorkbench getWorkbench(int selectionIndex) {
Graph layout = workbenches.get(prevSelected).getGraph();
setLayoutGraph(layout);

int selectedIndex = tabbedPane.getSelectedIndex();
if (selectedIndex == -1) {
selectedIndex = 0;
}

Graph graph = workbenches.get(selectedIndex).getGraph();

for (Node node : graph.getNodes()) {
List<Integer> center = layoutGraph.get(node.getName());

if (center != null) {
node.setCenter(center.get(0), center.get(1));
}
}

prevSelected = selectedIndex;

return workbenches.get(selectionIndex);
}

public void saveLayout() {
int selectedIndex = tabbedPane.getSelectedIndex();
if (selectedIndex == -1) {
selectedIndex = 0;
}
Graph layout = wrapper.getSelectionGraph(selectedIndex);
setLayoutGraph(layout);
}

@Override
public Graph getGraph() {
int selectedIndex = tabbedPane.getSelectedIndex();
Expand All @@ -521,12 +581,33 @@ public void setGraph(Graph graph) {
}

public void replace(List<Graph> graphs) {
for (Graph graph : graphs) {
for (Node node : graph.getNodes()) {
List<Integer> center = layoutGraph.get(node.getName());

if (center != null) {
node.setCenter(center.get(0), center.get(1));
}
}
}

wrapper.setGraphs(graphs);
resetWorkbenchScrolls(wrapper);
resetGraphs(wrapper);
editorPanel.reset();
}

private void setLayoutGraph(Graph graph) {
layoutGraph.clear();

for (Node node : graph.getNodes()) {
List<Integer> center = new ArrayList<>();
center.add(node.getCenterX());
center.add(node.getCenterY());
this.layoutGraph.put(node.getName(), center);
}
}

/**
* Allows one to drop/drap variables from a source list to a response area
* and a selected list. Also lets one specify an alpha level.
Expand Down
Loading

0 comments on commit 2bd4e77

Please sign in to comment.