Skip to content

Commit

Permalink
Merge pull request #375 from palatej/develop
Browse files Browse the repository at this point in the history
Small corrections (UI) for release 3.2.3
  • Loading branch information
palatej authored Jul 10, 2024
2 parents 5ecbf27 + 8254730 commit ef1b520
Show file tree
Hide file tree
Showing 8 changed files with 161 additions and 38 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
### Added

- ![UI] Add link to online help documentation [#217](https://github.com/jdemetra/jdplus-main/issues/217)
- ![UI] Add additional output in TramoSeats/X13 [#217](https://github.com/jdemetra/jdplus-main/issues/217)
- ![UI] Add benchmarking results in TramoSeats/X13 output [#289](https://github.com/jdemetra/jdplus-main/issues/289)

### Fixed

Expand All @@ -26,10 +28,18 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
- ![UI] Fix "Copy spec. to workspace" button [#228](https://github.com/jdemetra/jdplus-main/issues/228)
- ![UI] Fix NPE in SaBatchUI renderer [#326](https://github.com/jdemetra/jdplus-main/issues/326)
- ![UI] Fix GUI Excel output [#303](https://github.com/jdemetra/jdplus-main/issues/303)
- ![UI] Fix some problems in saving regression effects [#295](https://github.com/jdemetra/jdplus-main/issues/295)
- ![UI] Fix typos in spec dialog boxes
- ![UI] Fix handling of regression variables with lags [#323](https://github.com/jdemetra/jdplus-main/issues/323)
- ![UI] Fix numerical issues in canonical decomposition [#301](https://github.com/jdemetra/jdplus-main/issues/301)
- ![UI] Fix a bug in protobuf translation of TramoSeats results

### Changed

- ![UI] Replace splash screen with AI-generated image by [@jadoull](https://github.com/jadoull)
- ![UI] Change the layout of SA summaries (TramoSeats/X13) [#262](https://github.com/jdemetra/jdplus-main/issues/262)
- ![UI] Change the handling of the decomposition mode in X11 spec box


## [3.2.2] - 2024-03-14

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@
*/
@Development(status = Development.Status.Release)
@lombok.Value
@lombok.EqualsAndHashCode(exclude = {"attributes"})
//@lombok.EqualsAndHashCode(exclude = {"attributes"})
/* Some attributes could change the behaviour of some algorithms. So, they can't be excluded */
@lombok.Builder(toBuilder = true)
public class Variable<V extends ITsVariable> {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,15 @@
import jdplus.toolkit.base.api.timeseries.TsPeriod;
import jdplus.toolkit.base.api.timeseries.regression.ModellingContext;
import jdplus.toolkit.base.api.timeseries.regression.ModellingUtility;
import jdplus.toolkit.base.api.timeseries.regression.TrendConstant;
import jdplus.toolkit.base.api.timeseries.regression.Variable;
import jdplus.x13.base.api.x11.X11Spec;
import jdplus.x13.base.api.x13.X13Spec;
import java.util.Arrays;
import java.util.Optional;
import jdplus.toolkit.base.core.regsarima.regular.RegSarimaModel;
import jdplus.sa.base.core.CholetteProcessor;
import jdplus.sa.base.core.PreliminaryChecks;
import jdplus.sa.base.core.SaBenchmarkingResults;
import jdplus.sa.base.core.modelling.RegArimaDecomposer;
import jdplus.sa.base.core.modelling.SaVariablesMapping;
import jdplus.toolkit.base.api.modelling.TransformationType;
import jdplus.toolkit.base.core.sarima.SarimaModel;
import jdplus.toolkit.base.core.ssf.arima.ExactArimaForecasts;
import jdplus.x13.base.core.x11.X11Kernel;
Expand Down Expand Up @@ -73,6 +70,10 @@ private static PreliminaryChecks.Tool of(X13Spec spec) {
public static X13Kernel of(X13Spec spec, ModellingContext context) {
PreliminaryChecks.Tool check = of(spec);
boolean blPreprop = spec.getRegArima().getBasic().isPreprocessing();
// boolean blPreprop =
// spec.getRegArima().getBasic().isPreprocessing() &&
// (spec.getRegArima().getTransform().getFunction() != TransformationType.None ||
// spec.getRegArima().getOutliers().isUsed() || spec.getRegArima().getRegression().isUsed());
RegArimaKernel regarima = RegArimaKernel.of(spec.getRegArima(), context);
SaVariablesMapping mapping = new SaVariablesMapping();
// TO DO: fill maping with existing information in TramoSpec (section Regression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ public void actionPerformed(ActionEvent e) {
detail.addPropertyChangeListener(DefaultProcessingViewer.SPEC_SAVED, evt -> save((TsDocument) detail.getDocument()));
detail.addPropertyChangeListener(DefaultProcessingViewer.SPEC_CHANGED, evt -> detail.onDocumentChanged());
visualRepresentation = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, NbComponents.newJScrollPane(master), detail);
visualRepresentation.setResizeWeight(.60d);
visualRepresentation.setResizeWeight(.40d);
visualRepresentation.setOneTouchExpandable(true);

setLayout(new BorderLayout());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,15 @@ public JTramoSeatsSummary() {
chart_.setTsUpdateMode(TsUpdateMode.None);
siPanel_ = new JSIView();

JSplitPane split1 = NbComponents.newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, chart_, siPanel_);
split1.setDividerLocation(0.6);
JSplitPane split1 = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chart_, siPanel_);
split1.setDividerLocation(0.5);
split1.setResizeWeight(.5);

document_ = Box.createHorizontalBox();

JSplitPane split2 = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, document_, split1);
JSplitPane split2 = NbComponents.newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, document_, split1);
split2.setDividerLocation(0.5);
split2.setResizeWeight(.5);
split2.setResizeWeight(.4);

add(split2, BorderLayout.CENTER);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,24 @@ public BasicSpecUI(RegArimaSpecRoot root) {
}

public DateSelectorUI getSpan() {
return new DateSelectorUI(core().getBasic().getSpan(), UserInterfaceContext.INSTANCE.getDomain(), isRo(), selector->updateSpan(selector));
return new DateSelectorUI(core().getBasic().getSpan(), UserInterfaceContext.INSTANCE.getDomain(), isRo(), selector -> updateSpan(selector));
}
public void updateSpan(TimeSelector span){

public void updateSpan(TimeSelector span) {
update(core().getBasic().toBuilder().span(span).build());
}

public boolean isPreprocessing() {
return core().getBasic().isPreprocessing();
}

public void setPreprocessing(boolean pc) {
if (pc != isPreprocessing()) {
update(core().getBasic().toBuilder()
.preprocessing(pc).build());
}
}

public boolean isPreliminaryCheck() {
return core().getBasic().isPreliminaryCheck();
}
Expand All @@ -58,10 +65,11 @@ public List<EnhancedPropertyDescriptor> getProperties() {
if (desc != null) {
descs.add(desc);
}
desc = automdlDesc();
if (desc != null) {
descs.add(desc);
}
// excluded for the moment. That could change in the future
// desc = preprocessingDesc();
// if (desc != null) {
// descs.add(desc);
// }
return descs;
}

Expand Down Expand Up @@ -92,12 +100,12 @@ private EnhancedPropertyDescriptor spanDesc() {
}

@Messages({
"basicSpecUI.automdlDesc.name=auto modelling",
"basicSpecUI.automdlDesc.desc=Allows automatic model identification"
"basicSpecUI.automdlDesc.name=Preprocessing",
"basicSpecUI.automdlDesc.desc=Preprocessing"
})
private EnhancedPropertyDescriptor automdlDesc() {
private EnhancedPropertyDescriptor preprocessingDesc() {
try {
PropertyDescriptor desc = new PropertyDescriptor("autoMdl", this.getClass());
PropertyDescriptor desc = new PropertyDescriptor("preprocessing", this.getClass());
EnhancedPropertyDescriptor edesc = new EnhancedPropertyDescriptor(desc, AUTOMDL_ID);
desc.setDisplayName(Bundle.basicSpecUI_automdlDesc_name());
desc.setShortDescription(Bundle.basicSpecUI_automdlDesc_desc());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,72 @@
import java.beans.PropertyDescriptor;
import java.util.ArrayList;
import java.util.List;
import jdplus.toolkit.base.api.modelling.TransformationType;

/**
*
* @author PALATEJ
*/
public class X11SpecUI extends BaseX13SpecUI {

public static enum X11Mode {
Additive,
Multiplicative,
LogAdditive,
PseudoAdditive;

static X11Mode of(DecompositionMode mode) {
return switch (mode) {
case Multiplicative ->
X11Mode.Multiplicative;
case LogAdditive ->
X11Mode.LogAdditive;
case PseudoAdditive ->
X11Mode.PseudoAdditive;
default ->
X11Mode.Additive;
};
}

static DecompositionMode of(X11Mode mode) {
return switch (mode) {
case Multiplicative ->
DecompositionMode.Multiplicative;
case LogAdditive ->
DecompositionMode.LogAdditive;
case PseudoAdditive ->
DecompositionMode.PseudoAdditive;
default ->
DecompositionMode.Additive;
};
}
}

public static enum MultiplicativeMode {
Multiplicative,
LogAdditive;

static MultiplicativeMode of(DecompositionMode mode) {
return switch (mode) {
case LogAdditive ->
LogAdditive;
default ->
Multiplicative;
};
}

static DecompositionMode of(MultiplicativeMode mode) {
return switch (mode) {
case Multiplicative ->
DecompositionMode.Multiplicative;
case LogAdditive ->
DecompositionMode.LogAdditive;
default ->
DecompositionMode.Multiplicative;
};
}
}

X11SpecUI(X13SpecRoot root) {
super(root);
}
Expand All @@ -42,6 +101,11 @@ public List<EnhancedPropertyDescriptor> getProperties() {
EnhancedPropertyDescriptor desc = modeDesc();
if (desc != null) {
descs.add(desc);
} else {
desc = multiplicativeModeDesc();
if (desc != null) {
descs.add(desc);
}
}
desc = seasDesc();
if (desc != null) {
Expand Down Expand Up @@ -105,12 +169,20 @@ public String getDisplayName() {
return Bundle.x11SpecUI_getDisplayName();
}

public DecompositionMode getMode() {
return x11().getMode();
public X11Mode getMode() {
return X11Mode.of(x11().getMode());
}

public void setMode(X11Mode value) {
update(x11().toBuilder().mode(X11Mode.of(value)).build());
}

public MultiplicativeMode getMultiplicativeMode() {
return MultiplicativeMode.of(x11().getMode());
}

public void setMode(DecompositionMode value) {
update(x11().toBuilder().mode(value).build());
public void setMultiplicativeMode(MultiplicativeMode value) {
update(x11().toBuilder().mode(MultiplicativeMode.of(value)).build());
}

// public boolean isUseForecast() {
Expand Down Expand Up @@ -254,17 +326,17 @@ public void setExcludefcst(boolean value) {
public boolean isExcludefcst() {
return x11().isExcludeForecast();
}
public BiasCorrection getBiasCorrection(){

public BiasCorrection getBiasCorrection() {
return x11().getBias();
}
public void setBiasCorrection(BiasCorrection bias){

public void setBiasCorrection(BiasCorrection bias) {
update(x11().toBuilder().bias(bias).build());
}

private static final int MODE_ID = 0, SEAS_ID = 1, FORECAST_ID = 2, BACKCAST_ID = 12, LSIGMA_ID = 3, USIGMA_ID = 4, AUTOTREND_ID = 5,
TREND_ID = 6, SEASONMA_ID = 7, FULLSEASONMA_ID = 8, CALENDARSIGMA_ID = 9, SIGMAVEC_ID = 10, EXCLUDEFCST_ID = 11, BIAS_ID=12;
TREND_ID = 6, SEASONMA_ID = 7, FULLSEASONMA_ID = 8, CALENDARSIGMA_ID = 9, SIGMAVEC_ID = 10, EXCLUDEFCST_ID = 11, BIAS_ID = 12;

@Messages({
"x11SpecUI.calendarsigmaDesc.name=Calendarsigma",
Expand Down Expand Up @@ -328,10 +400,18 @@ private EnhancedPropertyDescriptor sigmavecDesc() {

@Messages({
"x11SpecUI.modeDesc.name=Mode",
"x11SpecUI.modeDesc.desc=[mode] Decomposition mode. Could be changed by the program, if needed."
"x11SpecUI.modeDesc.desc=[mode] Decomposition mode."
})
private EnhancedPropertyDescriptor modeDesc() {
try {
// if (regarima().getTransform().getFunction() != TransformationType.None ||
// regarima().getOutliers().isUsed() ||
// regarima().getRegression().isUsed() ) {
// return null;
// }
if (isPreprocessing()) {
return null;
}
PropertyDescriptor desc = new PropertyDescriptor("Mode", this.getClass());
EnhancedPropertyDescriptor edesc = new EnhancedPropertyDescriptor(desc, MODE_ID);
edesc.setRefreshMode(EnhancedPropertyDescriptor.Refresh.All);
Expand All @@ -344,6 +424,28 @@ private EnhancedPropertyDescriptor modeDesc() {
}
}

@Messages({
"x11SpecUI.multiplicativeModeDesc.name=Mode",
"x11SpecUI.multiplicativeModeDesc.desc=[mode] Decomposition mode."
})
private EnhancedPropertyDescriptor multiplicativeModeDesc() {
try {
// only in the case of log transformation
if (regarima().getTransform().getFunction() != TransformationType.Log) {
return null;
}
PropertyDescriptor desc = new PropertyDescriptor("MultiplicativeMode", this.getClass());
EnhancedPropertyDescriptor edesc = new EnhancedPropertyDescriptor(desc, MODE_ID);
edesc.setRefreshMode(EnhancedPropertyDescriptor.Refresh.All);
desc.setDisplayName(Bundle.x11SpecUI_modeDesc_name());
desc.setShortDescription(Bundle.x11SpecUI_modeDesc_desc());
edesc.setReadOnly(isRo());
return edesc;
} catch (IntrospectionException ex) {
return null;
}
}

@Messages({
"x11SpecUI.seasDesc.name=Seasonal component",
"x11SpecUI.seasDesc.desc=Computes a seasonal component (true) or set it to 0 (additive decomposition) or 1 (multiplicative decomposition) (false)"
Expand Down Expand Up @@ -529,14 +631,15 @@ private EnhancedPropertyDescriptor trendmaDesc() {
return null;
}
}
@Messages({

@Messages({
"x11SpecUI.biasDesc.name=Bias correction",
"x11SpecUI.biasDesc.desc=Bias correction for log-additive decomposition"
})
private EnhancedPropertyDescriptor biasDesc() {
if (x11().getMode() != DecompositionMode.LogAdditive)
if (x11().getMode() != DecompositionMode.LogAdditive) {
return null;
}
try {
PropertyDescriptor desc = new PropertyDescriptor("biasCorrection", this.getClass());
EnhancedPropertyDescriptor edesc = new EnhancedPropertyDescriptor(desc, BIAS_ID);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,15 @@ public JX13Summary() {
chart.setTsUpdateMode(TsUpdateMode.None);
this.siPanel = new JSIView();

JSplitPane split1 = NbComponents.newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, chart, siPanel);
split1.setDividerLocation(0.6);
JSplitPane split1 = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, chart, siPanel);
split1.setDividerLocation(0.5);
split1.setResizeWeight(.5);

this.document = Box.createHorizontalBox();

JSplitPane split2 = NbComponents.newJSplitPane(JSplitPane.VERTICAL_SPLIT, document, split1);
JSplitPane split2 = NbComponents.newJSplitPane(JSplitPane.HORIZONTAL_SPLIT, document, split1);
split2.setDividerLocation(0.5);
split2.setResizeWeight(.5);
split2.setResizeWeight(.4);

add(split2, BorderLayout.CENTER);
}
Expand Down

0 comments on commit ef1b520

Please sign in to comment.