Ejemplo n.º 1
0
    def test_struct_like(self):

        hp = HydrationParameter()

        hp.field = 300
        hp.spin_C = 200
        hp.ksigma_bulk = 95
        hp.T10 = 1
        hp.T100 = 2
        hp.tcorr_bulk = 50
        hp.D_H2O = 3e-10
        hp.D_SL = 5e-10
        hp.klow_bulk = 350
        hp.smax_model = "free"
        hp.t1_interp_method = "second_order"

        self.assertEqual(hp["field"], hp.field)
        self.assertEqual(hp["spin_C"], hp.spin_C)
        self.assertEqual(hp["ksigma_bulk"], hp.ksigma_bulk)
        self.assertEqual(hp["T10"], hp.T10)
        self.assertEqual(hp["T100"], hp.T100)
        self.assertEqual(hp["tcorr_bulk"], hp.tcorr_bulk)
        self.assertEqual(hp["D_H2O"], hp.D_H2O)
        self.assertEqual(hp["D_SL"], hp.D_SL)
        self.assertEqual(hp["klow_bulk"], hp.klow_bulk)
        self.assertEqual(hp["smax_model"], hp.smax_model)
        self.assertEqual(hp["t1_interp_method"], hp.t1_interp_method)

        with self.assertRaises(ValueError):
            hp.smax_model = "notinlist"
        with self.assertRaises(ValueError):
            hp.t1_interp_method = "notinlist"
Ejemplo n.º 2
0
    def test_struct_like(self):

        hp = HydrationParameter()

        hp.field = 300
        hp.spin_C = 200
        hp.ksigma_bulk = 95
        hp.T10 = 1
        hp.T100 = 2
        hp.tcorr_bulk = 50
        hp.D_H2O = 3e-10
        hp.D_SL = 5e-10
        hp.klow_bulk = 350
        hp.smax_model = 'free'
        hp.t1_interp_method = 'second_order'

        self.assertEqual(hp['field'], hp.field)
        self.assertEqual(hp['spin_C'], hp.spin_C)
        self.assertEqual(hp['ksigma_bulk'], hp.ksigma_bulk)
        self.assertEqual(hp['T10'], hp.T10)
        self.assertEqual(hp['T100'], hp.T100)
        self.assertEqual(hp['tcorr_bulk'], hp.tcorr_bulk)
        self.assertEqual(hp['D_H2O'], hp.D_H2O)
        self.assertEqual(hp['D_SL'], hp.D_SL)
        self.assertEqual(hp['klow_bulk'], hp.klow_bulk)
        self.assertEqual(hp['smax_model'], hp.smax_model)
        self.assertEqual(hp['t1_interp_method'], hp.t1_interp_method)

        with self.assertRaises(ValueError):
            hp.smax_model = 'notinlist'
        with self.assertRaises(ValueError):
            hp.t1_interp_method = 'notinlist'
Ejemplo n.º 3
0
def set_par(ppar: ProcParameter, hpar: HydrationParameter):
    """Prompt for users to choose parameters

    Returns: tuple(ProcParameter, HydrationParameter)

    """
    # Defaults
    ppar.eiw = 20
    hpar.field = 348.5
    hpar.t1_interp_method = 'second_order'

    # st.sidebar.markdown('**Experiments**')
    hpar.spin_C = st.sidebar.number_input("Spin label concentration (uM)",
                                          min_value=0.01,
                                          value=500.0,
                                          step=1.0,
                                          key='spin_C')
    hpar.T100 = st.sidebar.number_input("T1,0(0) (s)",
                                        min_value=0.1,
                                        max_value=3.0,
                                        value=2.5,
                                        step=0.05,
                                        key='t100')
    hpar.smax_model = st.sidebar.radio('The spin is ',
                                       options=['tethered', 'free'],
                                       key='smax_model')

    if st.sidebar.checkbox("More"):
        ppar.eiw = st.sidebar.number_input("Integration Width",
                                           min_value=10,
                                           max_value=500,
                                           value=20,
                                           step=10,
                                           key='eiw')
        hpar.field = st.sidebar.number_input("Field (mT)",
                                             value=348.5,
                                             step=1.0,
                                             key='field')
        hpar.t1_interp_method = st.sidebar.radio(
            'T1 interpolation method',
            options=['linear', 'second_order'],
            index=1,
            key='t1_interp_method')

    return ppar, hpar