<commit_before>/* Copyright 2000 Association for Universities for Research in Astronomy, Inc.,
 * Observatory Control System, Gemini Telescopes Project.
 * See the file LICENSE for complete details.
 *
 * $Id: InstGMOSCase.java 37930 2011-10-07 23:17:24Z lobrien $
 */
package edu.gemini.spModel.gemini.gmos.test;

import edu.gemini.spModel.gemini.gmos.*;
import static edu.gemini.spModel.test.TestFile.ser;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

/**
 * Class InstGMOSTest tests the InstGMOS class.
 */
public final class InstGMOSCase {
    private InstGmosNorth _t1;

    static final private double _ERROR = .00001;

    @Before
    public void setUp() throws Exception {
        _t1 = new InstGmosNorth();
    }

    @Test
    public void testInitial() {
        assertTrue(_t1.getDisperser() == GmosNorthType.DisperserNorth.DEFAULT);
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);
        assertEquals(GmosCommonType.FPUnitMode.DEFAULT, _t1.getFPUnitMode());
        assertEquals(GmosNorthType.FPUnitNorth.DEFAULT, _t1.getFPUnit());
        assertEquals(GmosNorthType.FilterNorth.DEFAULT, _t1.getFilter());
        assertEquals("", _t1.getFPUnitCustomMask());
        assertEquals(GmosCommonType.AmpReadMode.DEFAULT, _t1.getAmpReadMode());
        assertEquals(GmosCommonType.AmpCount.DEFAULT, _t1.getAmpCount());
        assertEquals(GmosCommonType.AmpGain.DEFAULT, _t1.getGainChoice());
        assertEquals(GmosCommonType.Binning.DEFAULT, _t1.getCcdXBinning());
        assertEquals(GmosCommonType.Binning.DEFAULT, _t1.getCcdYBinning());
        assertEquals(GmosNorthType.StageModeNorth.DEFAULT, _t1.getStageMode());
        assertEquals(GmosCommonType.BuiltinROI.DEFAULT, _t1.getBuiltinROI());
    }

    // Test disperser convenience methods
    @Test
    public void testDisperser() {
        assertTrue(_t1.getDisperser() == GmosNorthType.DisperserNorth.DEFAULT);
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);

        GmosNorthType.DisperserNorth dispValue = GmosNorthType.DisperserNorth.R831_G5302;
        //noinspection unchecked
        _t1.setDisperser(dispValue);

        assertEquals(dispValue, _t1.getDisperser());
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);
    }

    /**
     * Test cloneable
     */
    @Test
    public void testCloneable() {
        String title1 = "Initial GMOS";
        // Give the data object a title
        InstGmosNorth t1 = _t1;
        t1.setTitle(title1);

        // Create change
        GmosNorthType.DisperserNorth dispValue = GmosNorthType.DisperserNorth.B1200_G5301;
        t1.setDisperser(dispValue);
        GmosCommonType.Order orderValue = GmosCommonType.Order.TWO;
        t1.setDisperserOrder(orderValue);
        double lambdaValue = 6500.0;
        t1.setDisperserLambda(lambdaValue);

        GmosCommonType.ADC adcValue = GmosCommonType.ADC.BEST_STATIC;
        t1.setAdc(adcValue);

        GmosNorthType.FPUnitNorth fpuValue = GmosNorthType.FPUnitNorth.IFU_1;
        t1.setFPUnit(fpuValue);

        GmosNorthType.FilterNorth filterValue = GmosNorthType.FilterNorth.r_G0303;
        t1.setFilter(filterValue);

        GmosCommonType.AmpGain ampGainValue = GmosCommonType.AmpGain.HIGH;
        t1.setGainChoice(ampGainValue);

        GmosCommonType.AmpReadMode ampSpeedValue = GmosCommonType.AmpReadMode.FAST;
        t1.setAmpReadMode(ampSpeedValue);<commit_msg>REL-2432: Added tests for gain/read noise specifications for GN & GS<commit_after>/* Copyright 2000 Association for Universities for Research in Astronomy, Inc.,
 * Observatory Control System, Gemini Telescopes Project.
 * See the file LICENSE for complete details.
 *
 * $Id: InstGMOSCase.java 37930 2011-10-07 23:17:24Z lobrien $
 */
package edu.gemini.spModel.gemini.gmos.test;

import edu.gemini.spModel.gemini.gmos.*;
import static edu.gemini.spModel.test.TestFile.ser;

import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;

/**
 * Class InstGMOSTest tests the InstGMOS class.
 */
public final class InstGMOSCase {
    private InstGmosNorth _t1;
    private InstGmosSouth _t2;

    static final private double _ERROR = .00001;

    @Before
    public void setUp() throws Exception {
        _t1 = new InstGmosNorth();
        _t2 = new InstGmosSouth();
    }

    @Test
    public void testInitial() {
        assertTrue(_t1.getDisperser() == GmosNorthType.DisperserNorth.DEFAULT);
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);
        assertEquals(GmosCommonType.FPUnitMode.DEFAULT, _t1.getFPUnitMode());
        assertEquals(GmosNorthType.FPUnitNorth.DEFAULT, _t1.getFPUnit());
        assertEquals(GmosNorthType.FilterNorth.DEFAULT, _t1.getFilter());
        assertEquals("", _t1.getFPUnitCustomMask());
        assertEquals(GmosCommonType.AmpReadMode.DEFAULT, _t1.getAmpReadMode());
        assertEquals(GmosCommonType.AmpCount.DEFAULT, _t1.getAmpCount());
        assertEquals(GmosCommonType.AmpGain.DEFAULT, _t1.getGainChoice());
        assertEquals(GmosCommonType.Binning.DEFAULT, _t1.getCcdXBinning());
        assertEquals(GmosCommonType.Binning.DEFAULT, _t1.getCcdYBinning());
        assertEquals(GmosNorthType.StageModeNorth.DEFAULT, _t1.getStageMode());
        assertEquals(GmosCommonType.BuiltinROI.DEFAULT, _t1.getBuiltinROI());
    }

    // Test disperser convenience methods
    @Test
    public void testDisperser() {
        assertTrue(_t1.getDisperser() == GmosNorthType.DisperserNorth.DEFAULT);
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);

        GmosNorthType.DisperserNorth dispValue = GmosNorthType.DisperserNorth.R831_G5302;
        //noinspection unchecked
        _t1.setDisperser(dispValue);

        assertEquals(dispValue, _t1.getDisperser());
        assertTrue(_t1.getDisperserOrder() == GmosCommonType.Order.DEFAULT);
        assertEquals(InstGmosCommon.DEFAULT_DISPERSER_LAMBDA, _t1.getDisperserLambda(), _ERROR);
    }

    /**
     * Test Mean Gain values
     */
    @Test
    public void testMeanGainValues() {
        //Gemini North Specs
        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.SLOW);
        _t1.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(2.2, _t1.getMeanGain(), _ERROR);

        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t1.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(2.5, _t1.getMeanGain(), _ERROR);

        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t1.setGainChoice(GmosCommonType.AmpGain.HIGH);
        assertEquals(5.0, _t1.getMeanGain(), _ERROR);


        //Gemini South Specs
        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.SLOW);
        _t2.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(1.8, _t2.getMeanGain(), _ERROR);

        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t2.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(1.6, _t2.getMeanGain(), _ERROR);

        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t2.setGainChoice(GmosCommonType.AmpGain.HIGH);
        assertEquals(5.2, _t2.getMeanGain(), _ERROR);
    }


    /**
     * Test Read Noise values
     */
    @Test
    public void testMeanReadNoiseValues() {
        //Gemini North Specs
        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.SLOW);
        _t1.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(3.4, _t1.getMeanReadNoise(), _ERROR);

        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t1.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(4.9, _t1.getMeanReadNoise(), _ERROR);

        _t1.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t1.setGainChoice(GmosCommonType.AmpGain.HIGH);
        assertEquals(7.4, _t1.getMeanReadNoise(), _ERROR);

        //Gemini South Specs
        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.SLOW);
        _t2.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(4.0, _t2.getMeanReadNoise(), _ERROR);

        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t2.setGainChoice(GmosCommonType.AmpGain.LOW);
        assertEquals(6.6, _t2.getMeanReadNoise(), _ERROR);

        _t2.setAmpReadMode(GmosCommonType.AmpReadMode.FAST);
        _t2.setGainChoice(GmosCommonType.AmpGain.HIGH);
        assertEquals(7.9, _t2.getMeanReadNoise(), _ERROR);
    }



    /**
     * Test cloneable
     */
    @Test
    public void testCloneable() {
        String title1 = "Initial GMOS";
        // Give the data object a title
        InstGmosNorth t1 = _t1;
        t1.setTitle(title1);

        // Create change
        GmosNorthType.DisperserNorth dispValue = GmosNorthType.DisperserNorth.B1200_G5301;
        t1.setDisperser(dispValue);
        GmosCommonType.Order orderValue = GmosCommonType.Order.TWO;
        t1.setDisperserOrder(orderValue);
        double lambdaValue = 6500.0;
        t1.setDisperserLambda(lambdaValue);

        GmosCommonType.ADC adcValue = GmosCommonType.ADC.BEST_STATIC;
        t1.setAdc(adcValue);

        GmosNorthType.FPUnitNorth fpuValue = GmosNorthType.FPUnitNorth.IFU_1;
        t1.setFPUnit(fpuValue);

        GmosNorthType.FilterNorth filterValue = GmosNorthType.FilterNorth.r_G0303;
        t1.setFilter(filterValue);

        GmosCommonType.AmpGain ampGainValue = GmosCommonType.AmpGain.HIGH;
        t1.setGainChoice(ampGainValue);

        GmosCommonType.AmpReadMode ampSpeedValue = GmosCommonType.AmpReadMode.FAST;
        t1.setAmpReadMode(ampSpeedValue);
{'fraction_non_alphanumeric': 0.10356469069605799, 'fraction_numerical': 0.024227981332538975, 'mean_word_length': 3.4764444444444442, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '684176', 'n_tokens_mistral': 3571, 'n_tokens_neox': 3390, 'n_words': 476}