Added function to calculate the Nmin requires
"cell_type": "code",
"execution_count": 2,
"metadata": {},
+ "outputs": [],
+ "source": [
+ "# the function to get the minimal number of indepedent samples\n",
+ "def get_Nmin(ns=0, np=0, nd=0):\n",
+ " res1 = (ns * (ns + 1) * (ns + 2) * ((ns + 3) + 4 * (np + nd))) / 24\n",
+ " res2 = (\n",
+ " ns * (ns + 1) * np * (np + 1)\n",
+ " + ns * (ns + 1) * nd * (nd + 1)\n",
+ " + np * (np + 1) * nd * (nd + 1)\n",
+ " ) / 4\n",
+ " res3 = ns * np * nd * (ns + np + nd + 3) / 2\n",
+ " return res1 + res2 + res3"
+ ]
+ },
+ {
+ "cell_type": "code",
+ "execution_count": 3,
+ "metadata": {},
"outputs": [
{
"name": "stdout",
" [2 0]\n",
" [2 1]\n",
" [2 2]]\n",
+ "Minimum number of basis points input:\n",
+ " 5.0\n",
"Input Components:\n",
" [[4 0]\n",
" [3 1]\n",
"components = morpher_1.find_components()\n",
"print(\"Generated Components: \\n\", components)\n",
"\n",
+ "# We can use get_Nmin function to get the minimum number of independent samples requires\n",
+ "N_min = get_Nmin(ns=2)\n",
+ "print(\"Minimum number of basis points needed:\\n\", N_min)\n",
+ "\n",
"# if we have power of components in hand, we can use morpher.set_components() to set components\n",
"this_components = np.array([[4, 0], [3, 1], [2, 2], [1, 3], [0, 4]])\n",
"morpher_1.set_components(this_components)\n",
},
{
"cell_type": "code",
- "execution_count": 3,
+ "execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
},
{
"cell_type": "code",
- "execution_count": 4,
+ "execution_count": 5,
"metadata": {},
"outputs": [
{
},
{
"cell_type": "code",
- "execution_count": 5,
+ "execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
},
{
"cell_type": "code",
- "execution_count": 6,
+ "execution_count": 7,
"metadata": {},
"outputs": [
{
},
{
"cell_type": "code",
- "execution_count": 7,
+ "execution_count": 8,
"metadata": {},
"outputs": [
{
},
{
"cell_type": "code",
- "execution_count": 8,
+ "execution_count": 9,
"metadata": {},
"outputs": [
{
],
"metadata": {
"kernelspec": {
- "display_name": "Python 3.9.13 64-bit (windows store)",
+ "display_name": "Python 3.9.13 64-bit (microsoft store)",
"language": "python",
"name": "python3"
},
