@@ 759-786 (lines=28) @@ | ||
756 | return output_sync_dynamic; |
|
757 | ||
758 | ||
759 | def _calculate_phases(self, solution, t, step, int_step): |
|
760 | """! |
|
761 | @brief Calculates new phases for oscillators in the network in line with current step. |
|
762 | ||
763 | @param[in] solution (solve_type): Type solver of the differential equation. |
|
764 | @param[in] t (double): Time of simulation. |
|
765 | @param[in] step (double): Step of solution at the end of which states of oscillators should be calculated. |
|
766 | @param[in] int_step (double): Step differentiation that is used for solving differential equation. |
|
767 | ||
768 | @return (list) New states (phases) for oscillators. |
|
769 | ||
770 | """ |
|
771 | ||
772 | next_phases = [0.0] * self._num_osc; # new oscillator _phases |
|
773 | ||
774 | for index in range (0, self._num_osc, 1): |
|
775 | if (solution == solve_type.FAST): |
|
776 | result = self._phases[index] + self._phase_kuramoto(self._phases[index], 0, index); |
|
777 | next_phases[index] = self._phase_normalization(result); |
|
778 | ||
779 | elif (solution == solve_type.RK4): |
|
780 | result = odeint(self._phase_kuramoto, self._phases[index], numpy.arange(t - step, t, int_step), (index , )); |
|
781 | next_phases[index] = self._phase_normalization(result[len(result) - 1][0]); |
|
782 | ||
783 | else: |
|
784 | raise NameError("Solver '" + solution + "' is not supported"); |
|
785 | ||
786 | return next_phases; |
|
787 | ||
788 | ||
789 | def _phase_normalization(self, teta): |
@@ 197-223 (lines=27) @@ | ||
194 | return output_sync_dynamic; |
|
195 | ||
196 | ||
197 | def __calculate(self, solution, t, step, int_step): |
|
198 | """! |
|
199 | @brief Calculates new amplitudes for oscillators in the network in line with current step. |
|
200 | ||
201 | @param[in] solution (solve_type): Type solver of the differential equation. |
|
202 | @param[in] t (double): Time of simulation. |
|
203 | @param[in] step (double): Step of solution at the end of which states of oscillators should be calculated. |
|
204 | @param[in] int_step (double): Step differentiation that is used for solving differential equation. |
|
205 | ||
206 | @return (list) New states (phases) for oscillators. |
|
207 | ||
208 | """ |
|
209 | ||
210 | next_amplitudes = [0.0] * self._num_osc; |
|
211 | ||
212 | for index in range (0, self._num_osc, 1): |
|
213 | if (solution == solve_type.FAST): |
|
214 | next_amplitudes[index] = self.__amplitude[index] + self.__calculate_amplitude(self.__amplitude[index], 0, index); |
|
215 | ||
216 | elif (solution == solve_type.RK4): |
|
217 | result = odeint(self.__calculate_amplitude, self.__amplitude[index], numpy.arange(t - step, t, int_step), (index , )); |
|
218 | next_amplitudes[index] = result[len(result) - 1][0]; |
|
219 | ||
220 | else: |
|
221 | raise NameError("Solver '" + solution + "' is not supported"); |
|
222 | ||
223 | return next_amplitudes; |
|
224 | ||
225 | ||
226 | def __landau_stuart(self, amplitude, index): |