def compose(self, t):
        """calculate state and derivatives for model at image number t"""

        # Extract orientation from the initial state
        U0 = self._initial_state

        # extract parameter sets from the internal list
        phi1_set, phi2_set, phi3_set = self._param

        # extract angles and other data at time t using the smoother
        phi1, phi1_weights, phi1_sumweights = self._smoother.value_weight(
            t, phi1_set)
        phi2, phi2_weights, phi2_sumweights = self._smoother.value_weight(
            t, phi2_set)
        phi3, phi3_weights, phi3_sumweights = self._smoother.value_weight(
            t, phi3_set)

        # calculate derivatives of angles wrt underlying parameters.
        # FIXME write up notes in orange notebook
        dphi1_dp = phi1_weights * (1. / phi1_sumweights)
        dphi2_dp = phi2_weights * (1. / phi2_sumweights)
        dphi3_dp = phi3_weights * (1. / phi3_sumweights)

        # calculate state and derivatives using the helper class
        coc = CrystalOrientationCompose(U0, phi1, phi1_set.axis, phi2,
                                        phi2_set.axis, phi3, phi3_set.axis)
        self._U_at_t = coc.U()
        dU_dphi1 = coc.dU_dphi1()
        dU_dphi2 = coc.dU_dphi2()
        dU_dphi3 = coc.dU_dphi3()

        # calculate derivatives of state wrt underlying parameters
        dU_dp1 = [None] * dphi1_dp.size
        for (i, v) in dphi1_dp:
            dU_dp1[i] = dU_dphi1 * v
        dU_dp2 = [None] * dphi2_dp.size
        for (i, v) in dphi2_dp:
            dU_dp2[i] = dU_dphi2 * v
        dU_dp3 = [None] * dphi3_dp.size
        for (i, v) in dphi3_dp:
            dU_dp3[i] = dU_dphi3 * v

        # store derivatives as list-of-lists
        self._dstate_dp = [dU_dp1, dU_dp2, dU_dp3]

        return
Exemplo n.º 2
0
    def compose(self):

        # Extract orientation from the initial state
        U0 = self._initial_state

        # extract parameters from the internal list
        phi1, phi2, phi3 = self._param

        # calculate using the helper class
        coc = CrystalOrientationCompose(U0, phi1.value, phi1.axis, phi2.value,
                                        phi2.axis, phi3.value, phi3.axis)

        # compose new state
        self._model.set_U(coc.U())

        # store derivatives
        self._dstate_dp = [coc.dU_dphi1(), coc.dU_dphi2(), coc.dU_dphi3()]

        return
    def compose(self, t):
        """calculate state and derivatives for model at image number t"""

        # Extract orientation from the initial state
        U0 = self._initial_state

        # extract parameter sets from the internal list
        phi1_set, phi2_set, phi3_set = self._param

        # extract angles and other data at time t using the smoother
        phi1, phi1_weights, phi1_sumweights = self._smoother.value_weight(t, phi1_set)
        phi2, phi2_weights, phi2_sumweights = self._smoother.value_weight(t, phi2_set)
        phi3, phi3_weights, phi3_sumweights = self._smoother.value_weight(t, phi3_set)

        # calculate derivatives of angles wrt underlying parameters.
        # FIXME write up notes in orange notebook
        dphi1_dp = phi1_weights * (1.0 / phi1_sumweights)
        dphi2_dp = phi2_weights * (1.0 / phi2_sumweights)
        dphi3_dp = phi3_weights * (1.0 / phi3_sumweights)

        # calculate state and derivatives using the helper class
        coc = CrystalOrientationCompose(U0, phi1, phi1_set.axis, phi2, phi2_set.axis, phi3, phi3_set.axis)
        self._U_at_t = coc.U()
        dU_dphi1 = coc.dU_dphi1()
        dU_dphi2 = coc.dU_dphi2()
        dU_dphi3 = coc.dU_dphi3()

        # calculate derivatives of state wrt underlying parameters
        dU_dp1 = [None] * dphi1_dp.size
        for (i, v) in dphi1_dp:
            dU_dp1[i] = dU_dphi1 * v
        dU_dp2 = [None] * dphi2_dp.size
        for (i, v) in dphi2_dp:
            dU_dp2[i] = dU_dphi2 * v
        dU_dp3 = [None] * dphi3_dp.size
        for (i, v) in dphi3_dp:
            dU_dp3[i] = dU_dphi3 * v

        # store derivatives as list-of-lists
        self._dstate_dp = [dU_dp1, dU_dp2, dU_dp3]

        return
Exemplo n.º 4
0
  def compose(self):
    """calculate state and derivatives"""

    # Extract orientation from the initial state
    U0 = self._initial_state

    # extract parameters from the internal list
    phi1, phi2, phi3 = self._param

    # calculate using the helper class
    coc = CrystalOrientationCompose(U0, phi1.value, phi1.axis,
                                    phi2.value, phi2.axis,
                                    phi3.value, phi3.axis)

    # compose new state
    self._model.set_U(coc.U())

    # store derivatives
    self._dstate_dp = [coc.dU_dphi1(), coc.dU_dphi2(), coc.dU_dphi3()]

    return