Added "insert_d_into_nb.py" auto script for faster changing 'd' values.

Files have been edited with this script.
This commit is contained in:
Artyom Titov 2026-08-18 13:58:16 +03:00
commit e05b1b1b0f
64 changed files with 1481 additions and 580 deletions

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.88"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "2.875"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993801942128783*^9, 3.993801945433443*^9}, {
3.9938026615010633`*^9, 3.993802739368286*^9}, {3.993802810187974*^9,

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.88"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "2.875"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993801942128783*^9, 3.993801945433443*^9}, {
3.9938026615010633`*^9, 3.993802739368286*^9}, {3.993802810187974*^9,

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.88"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "2.875"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993801942128783*^9, 3.993801945433443*^9}, {
3.9938026615010633`*^9, 3.993802739368286*^9}, {3.993802810187974*^9,

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.88"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "2.875"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993801942128783*^9, 3.993801945433443*^9}, {
3.9938026615010633`*^9, 3.993802739368286*^9}, {3.993802810187974*^9,

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.88"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "2.875"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993801942128783*^9, 3.993801945433443*^9}, {
3.9938026615010633`*^9, 3.993802739368286*^9}, {3.993802810187974*^9,

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "4.2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "4.158"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993804130253289*^9, 3.9938041708483353`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"f9d1f11f-5673-4f0f-be9e-fc752864a0ba"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "4.2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "4.158"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993804130253289*^9, 3.9938041708483353`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"c970a514-c264-4110-a0ef-043e8aaa2b1d"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "4.2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "4.158"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993804130253289*^9, 3.9938041708483353`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"0a96495d-14dd-4f84-9979-9f8b41e9e1ad"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "4.2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "4.158"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993804130253289*^9, 3.9938041708483353`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"eb4f7d99-077a-4902-9ca7-72107ce875c7"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "4.2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "4.158"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993804130253289*^9, 3.9938041708483353`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"8e5d3540-6ffc-411c-96eb-dadf9a7438ec"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "6.05"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "6.444"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938046575111637`*^9, 3.993804701607058*^9},
3.993804733204545*^9, {3.993909737291142*^9, 3.993909742224861*^9}, {

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "6.05"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "6.444"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938046575111637`*^9, 3.993804701607058*^9},
3.993804733204545*^9, {3.993909737291142*^9, 3.993909742224861*^9}, {

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "6.05"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "6.444"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938046575111637`*^9, 3.993804701607058*^9},
3.993804733204545*^9, {3.993909737291142*^9, 3.993909742224861*^9}, {

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "6.05"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "6.444"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938046575111637`*^9, 3.993804701607058*^9},
3.993804733204545*^9, {3.993909737291142*^9, 3.993909742224861*^9}, {

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "6.05"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "6.444"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938046575111637`*^9, 3.993804701607058*^9},
3.993804733204545*^9, {3.993909737291142*^9, 3.993909742224861*^9}, {

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.1"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "2.0967"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938052191744213`*^9, 3.9938052504311247`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"b2772d41-6885-47dc-8786-c302f9fd9ce3"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.1"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "2.0967"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938052191744213`*^9, 3.9938052504311247`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"946a15a7-3818-4bcc-a92d-6192f942d70b"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.1"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "2.0967"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938052191744213`*^9, 3.9938052504311247`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"e3570169-fcd5-428a-920f-16f01b7d94c5"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.1"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "2.0967"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938052191744213`*^9, 3.9938052504311247`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"79fd54c7-8888-4cdc-8fb2-cd4edd72f49d"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.1"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "2.0967"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9938052191744213`*^9, 3.9938052504311247`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"3235bbf8-da8e-40de-a6fe-cb44aeded391"],

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
RowBox[{"d", "=", "1.971"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"f80fe90e-0725-49a1-8f07-ca5e6c08780a"],
Cell[BoxData["2"], "Output",

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
RowBox[{"d", "=", "1.971"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"460b0626-5ad0-4ea3-b2ce-b8446d7055b3"],
Cell[BoxData["2"], "Output",

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
RowBox[{"d", "=", "1.971"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"b6f2f39e-93b0-4ffa-923d-06f7ff3cce6d"],
Cell[BoxData["2"], "Output",

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
RowBox[{"d", "=", "1.971"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"b04642d5-ffb7-4865-9ffa-63fe8bc1cd00"],
Cell[BoxData["2"], "Output",

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
RowBox[{"d", "=", "1.971"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815385399456*^9, 3.9938153854750338`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"d60583fa-07c8-4897-a59a-86f3dc8d0276"],
Cell[BoxData["2"], "Output",

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.9"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.92"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815944576231*^9, 3.9938159912638187`*^9}},
CellLabel->"In[23]:=",ExpressionUUID->"dfdb021d-cc59-4fca-a142-943a8806c90f"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.9"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.92"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815944576231*^9, 3.9938159912638187`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"918838d2-a4a6-4ba1-9647-cf92de98e62e"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.9"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.92"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815944576231*^9, 3.9938159912638187`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"97fc619a-5617-4e24-bdf2-8876dca85277"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.9"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.92"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815944576231*^9, 3.9938159912638187`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"19a27e2e-f08e-47aa-9bcf-c5bcd39b4edb"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.9"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.92"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993815944576231*^9, 3.9938159912638187`*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"c2de7cc2-4c99-4f39-9ed3-3580a4aa10f5"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.78"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.745"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993816332414463*^9, 3.993816395113246*^9}, {
3.99408327105175*^9, 3.99408327225659*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.78"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.745"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993816332414463*^9, 3.993816395113246*^9}, {
3.99408327105175*^9, 3.99408327225659*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.78"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.745"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993816332414463*^9, 3.993816395113246*^9}, {
3.99408327105175*^9, 3.99408327225659*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.78"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.745"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993816332414463*^9, 3.993816395113246*^9}, {
3.99408327105175*^9, 3.99408327225659*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.78"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.745"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993816332414463*^9, 3.993816395113246*^9}, {
3.99408327105175*^9, 3.99408327225659*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.85"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.855"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940821364341908`*^9, 3.994082136546945*^9}, {
3.99408222505837*^9, 3.9940822566678658`*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.85"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.855"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940821364341908`*^9, 3.994082136546945*^9}, {
3.99408222505837*^9, 3.9940822566678658`*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.85"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.855"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940821364341908`*^9, 3.994082136546945*^9}, {
3.99408222505837*^9, 3.9940822566678658`*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.85"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.855"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940821364341908`*^9, 3.994082136546945*^9}, {
3.99408222505837*^9, 3.9940822566678658`*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.85"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.855"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940821364341908`*^9, 3.994082136546945*^9}, {
3.99408222505837*^9, 3.9940822566678658`*^9}},

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
RowBox[{"d", "=", "1.997"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
3.994074972569545*^9, 3.994074973088262*^9}, {3.9940750163921824`*^9,
3.9940750181750507`*^9}, {3.994075068546856*^9, 3.994075088637937*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"8fe1c173-48e4-40da-853e-c7660d0953ff"],

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
RowBox[{"d", "=", "1.997"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
3.994074972569545*^9, 3.994074973088262*^9}, {3.9940750163921824`*^9,
3.9940750181750507`*^9}, {3.994075068546856*^9, 3.994075088637937*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"1b0145b9-c263-4046-9bc6-03f20ecab3a7"],

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
RowBox[{"d", "=", "1.997"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
3.994074972569545*^9, 3.994074973088262*^9}, {3.9940750163921824`*^9,
3.9940750181750507`*^9}, {3.994075068546856*^9, 3.994075088637937*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"00b5f403-9f80-4701-a740-6acdb2556420"],

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
RowBox[{"d", "=", "1.997"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
3.994074972569545*^9, 3.994074973088262*^9}, {3.9940750163921824`*^9,
3.9940750181750507`*^9}, {3.994075068546856*^9, 3.994075088637937*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"faf503b8-bf82-4409-955e-15ee2a94c2df"],

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
RowBox[{"d", "=", "1.997"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074365586355*^9, 3.9940743682625427`*^9}, {
3.994074972569545*^9, 3.994074973088262*^9}, {3.9940750163921824`*^9,
3.9940750181750507`*^9}, {3.994075068546856*^9, 3.994075088637937*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"81b527e9-1a4a-4a72-b90f-3535b7c3d89c"],

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.95"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.973"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074211664226*^9, 3.994074212605893*^9}, {
3.994074246621201*^9, 3.994074265935053*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.95"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.973"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074211664226*^9, 3.994074212605893*^9}, {
3.994074246621201*^9, 3.994074265935053*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.95"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.973"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074211664226*^9, 3.994074212605893*^9}, {
3.994074246621201*^9, 3.994074265935053*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.95"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.973"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074211664226*^9, 3.994074212605893*^9}, {
3.994074246621201*^9, 3.994074265935053*^9}},

View file

@ -21,8 +21,8 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.95"}]], "Input",
CellChangeTimes->{
RowBox[{"d", "=", "1.973"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.994074211664226*^9, 3.994074212605893*^9}, {
3.994074246621201*^9, 3.994074265935053*^9}},

View file

@ -21,7 +21,7 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
3.9931205775772543`*^9, 3.9931205930074*^9}, {3.99312068244851*^9,
3.993120683031312*^9}, {3.993120763928855*^9, 3.993120796207575*^9}, {
3.993120826638487*^9, 3.99312091050727*^9}, {3.9938200779452133`*^9,

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
3.9931205775772543`*^9, 3.9931205930074*^9}, {3.99312068244851*^9,
3.993120683031312*^9}, {3.993120763928855*^9, 3.993120796207575*^9}, {
3.993120826638487*^9, 3.99312091050727*^9}, {3.9938200779452133`*^9,

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
3.9931205775772543`*^9, 3.9931205930074*^9}, {3.99312068244851*^9,
3.993120683031312*^9}, {3.993120763928855*^9, 3.993120796207575*^9}, {
3.993120826638487*^9, 3.99312091050727*^9}, {3.993820073004545*^9,

View file

@ -21,10 +21,10 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
3.9931205775772543`*^9, 3.9931205930074*^9}, {3.99312068244851*^9,
3.993120683031312*^9}, {3.993120763928855*^9, 3.993120796207575*^9}, {
3.993120826638487*^9, 3.99312091050727*^9}, {3.9938200779452133`*^9,

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.6"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "1.565"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940727514461927`*^9, 3.994072775295883*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"4e298ab4-090c-4da0-aea5-ba6d78ef8e18"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.6"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "1.565"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940727514461927`*^9, 3.994072775295883*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"c38f06bd-74d1-44ad-9faf-19b29d111ef0"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.6"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "1.565"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940727514461927`*^9, 3.994072775295883*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"fe8f6cf0-b6a8-40e3-a99b-ddc3b879c463"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.6"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "1.565"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940727514461927`*^9, 3.994072775295883*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"46ee9baf-ea38-4cdd-b8d2-6697866c6380"],

View file

@ -21,9 +21,9 @@ Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "1.6"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
RowBox[{"d", "=", "1.565"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.9940727514461927`*^9, 3.994072775295883*^9}},
CellLabel->"In[1]:=",ExpressionUUID->"32cdfcf5-6501-4fa3-a2ea-6f6c4c61aac9"],

View file

@ -1,8 +1,6 @@
Pu240
-----------------------------
174-66_2-3
J=13.2851
d = 2.027
d = 2.027
v1 = 1.7300
n1 = 0.7600
vv1 = 2.4000
@ -12,7 +10,7 @@ n2 = 0.5547
vv2 = 1.1338
nn2 = 0.8500
-----------------------------
176-64_4-5 *
176-64_4-5
J=14.2006
d = 1.565
v1 = 1.2500
@ -24,7 +22,7 @@ n2 = 0.5924
vv2 = 1.8880
nn2 = 0.6347
-----------------------------
152-88_6-7 *
152-88_6-7
J=7.82676
d = 2.875
v1 = 1.63
@ -122,7 +120,7 @@ nn2 = 0.635
-----------------------------
168-72_22-23
J=11.8913
d = 1.9
d = 1.9
v1 = 2.155
n1 = 0.755
vv1 = 2.62
@ -155,14 +153,3 @@ v2 = 1.375
n2 = 0.545
vv2 = 1.35
nn2 = 0.655
-----------------------------
d =
v1 =
n1 =
vv1 =
nn1 =
v2 =
n2 =
vv2 =
nn2 =

541
automation/insert_d_into_nb.py Executable file
View file

@ -0,0 +1,541 @@
#!/usr/bin/env python3
"""
insert_d_into_nb.py
Рекурсивно обходит Wolfram Notebook (*.nb), пропускает файлы с
"фитирование" в имени и меняет значение d в первой Input-ячейке
на значение из файла коэффициентов.
Ключевая мера безопасности:
- notebook читается и пишется как bytes, без перекодирования и нормализации EOL;
- Internal cache information не удаляется и не редактируется;
- размер изменяемой первой Input-ячейки и размер всего .nb сохраняются
побайтно неизменными: если новое число длиннее/короче старого,
разница компенсируется незначащими пробелами в этой же Input-ячейке;
- перед любой записью создаётся backup в уникальной папке /tmp;
- запись атомарная, после неё выполняется повторная проверка.
"""
from __future__ import annotations
import argparse
import os
import re
import shutil
import stat
import sys
import tempfile
from dataclasses import dataclass
from decimal import Decimal, InvalidOperation
from pathlib import Path
SECTION_RE = re.compile(r"^\s*(\d+-\d+_\d+-\d+)\s*$")
D_LINE_RE = re.compile(
r"^\s*d\s*=\s*([+-]?(?:\d+(?:\.\d*)?|\.\d+))\s*$"
)
# Примеры:
# h_154-86_Pu240_8-9_gid_Qw1.nb
# h_152-88_h_Pu240_6-7_pr_Qw1.nb
FILENAME_KEY_RE = re.compile(
r"(?P<ab>\d+-\d+)(?:_h)?_Pu240_(?P<ij>\d+-\d+)",
re.IGNORECASE,
)
BEGIN_MARKER = b"(* Beginning of Notebook Content *)"
END_MARKER = b"(* End of Notebook Content *)"
# Ищем именно Cell[BoxData[...], "Input"] и не разрешаем матчу
# перескочить через начало следующей Cell[...].
FIRST_INPUT_RE = re.compile(
rb'Cell\[\s*BoxData\[\s*'
rb'(?P<box>(?:(?!\bCell\[).)*?)'
rb'\]\s*,\s*"Input"',
re.DOTALL,
)
# Для первой переменной принимается консервативная и ожидаемая по ТЗ форма:
# RowBox[{"d", "=", "2.88"}]
DIRECT_ASSIGNMENT_RE = re.compile(
rb'^\s*RowBox\[\{\s*'
rb'"(?P<var>[A-Za-z$][A-Za-z0-9$]*)"\s*,\s*'
rb'"="\s*,\s*'
rb'"(?P<value>[+-]?(?:\d+(?:\.\d*)?|\.\d+))"\s*'
rb'\}\]\s*$',
re.DOTALL,
)
@dataclass(frozen=True)
class FirstAssignment:
variable: str
value_text: str
value_start: int
value_end: int
first_input_end: int
next_cell_start: int
class NotebookFormatError(RuntimeError):
pass
def parse_args() -> argparse.Namespace:
parser = argparse.ArgumentParser(
description=(
"Заменяет d в первой Input-ячейке Wolfram Notebook "
"по значениям из файла коэффициентов."
)
)
parser.add_argument(
"--coeff_file",
required=True,
type=Path,
help="Путь к txt-файлу коэффициентов.",
)
parser.add_argument(
"--wolfram_notebooks",
"--wolfram_noteooks", # алиас для опечатки, встречающейся в ТЗ
dest="wolfram_notebooks",
required=True,
type=Path,
help="Корневая директория, где рекурсивно искать *.nb.",
)
return parser.parse_args()
def parse_coefficients(path: Path) -> dict[str, str]:
try:
text = path.read_text(encoding="utf-8-sig")
except OSError as exc:
raise RuntimeError(f"Не удалось прочитать файл коэффициентов: {exc}") from exc
result: dict[str, str] = {}
current_section: str | None = None
seen_sections: set[str] = set()
for lineno, raw_line in enumerate(text.splitlines(), start=1):
section_match = SECTION_RE.match(raw_line)
if section_match:
current_section = section_match.group(1)
if current_section in seen_sections:
raise RuntimeError(
f"{path}:{lineno}: повторная секция {current_section!r}"
)
seen_sections.add(current_section)
continue
d_match = D_LINE_RE.match(raw_line)
if d_match and current_section is not None:
if current_section in result:
raise RuntimeError(
f"{path}:{lineno}: повторное d в секции {current_section!r}"
)
value = d_match.group(1)
# Дополнительная валидация числа.
try:
Decimal(value)
except InvalidOperation as exc:
raise RuntimeError(
f"{path}:{lineno}: некорректное значение d={value!r}"
) from exc
result[current_section] = value
if not result:
raise RuntimeError(
f"В {path} не найдено ни одной секции с корректной строкой d = ..."
)
missing_d = sorted(seen_sections - result.keys())
if missing_d:
raise RuntimeError(
"В следующих секциях отсутствует корректная строка d: "
+ ", ".join(missing_d)
)
return result
def coefficient_key_from_filename(name: str) -> str | None:
match = FILENAME_KEY_RE.search(name)
if not match:
return None
return f"{match.group('ab')}_{match.group('ij')}"
def find_first_assignment(data: bytes) -> FirstAssignment:
begin = data.find(BEGIN_MARKER)
end = data.find(END_MARKER)
if begin < 0 or end < 0 or end <= begin:
raise NotebookFormatError(
"не найдены корректные маркеры начала/конца Notebook Content"
)
content_start = begin + len(BEGIN_MARKER)
content = data[content_start:end]
input_match = FIRST_INPUT_RE.search(content)
if not input_match:
raise NotebookFormatError("не найдена первая Input-ячейка")
box = input_match.group("box")
assignment = DIRECT_ASSIGNMENT_RE.fullmatch(box)
if not assignment:
raise NotebookFormatError(
"первая Input-ячейка не является простым присваиванием вида "
'RowBox[{"d", "=", "число"}]'
)
var = assignment.group("var").decode("ascii")
value = assignment.group("value").decode("ascii")
box_abs_start = content_start + input_match.start("box")
value_start = box_abs_start + assignment.start("value")
value_end = box_abs_start + assignment.end("value")
first_input_end = content_start + input_match.end()
# Компенсацию длины делаем до следующей Cell[, то есть внутри
# опций первой Input-ячейки и до начала следующей ячейки.
next_cell_start = data.find(b"Cell[", first_input_end, end)
if next_cell_start < 0:
raise NotebookFormatError(
"после первой Input-ячейки не найдена следующая Cell"
)
return FirstAssignment(
variable=var,
value_text=value,
value_start=value_start,
value_end=value_end,
first_input_end=first_input_end,
next_cell_start=next_cell_start,
)
def decimal_equal(left: str, right: str) -> bool:
try:
return Decimal(left) == Decimal(right)
except InvalidOperation:
return left == right
def _remove_indentation_spaces(data: bytes, count: int) -> bytes:
"""
Удаляет ровно count пробелов/табов только из отступов в начале строк.
Переводы строк не меняются, содержимое строковых литералов не трогается.
Для типичного CellChangeTimes в первой ячейке таких пробелов значительно
больше, чем может понадобиться для компенсации длины d.
"""
if count <= 0:
return data
out = bytearray()
i = 0
remaining = count
at_line_start = False
while i < len(data):
b = data[i]
if at_line_start and b in (0x20, 0x09) and remaining > 0:
# Удаляем отступ по одному байту.
remaining -= 1
i += 1
continue
out.append(b)
if b == 0x0A: # \n; CR из CRLF уже был скопирован
at_line_start = True
elif b not in (0x20, 0x09, 0x0D):
at_line_start = False
i += 1
if remaining:
raise NotebookFormatError(
"не хватило безопасных отступов для сохранения размера notebook "
f"(нужно было убрать ещё {remaining} байт)"
)
return bytes(out)
def patch_d_preserving_size(
original: bytes,
assignment: FirstAssignment,
new_value: str,
) -> bytes:
new_value_bytes = new_value.encode("ascii")
old_value_bytes = original[assignment.value_start:assignment.value_end]
if old_value_bytes.decode("ascii") != assignment.value_text:
raise NotebookFormatError("внутренняя проверка позиции старого d не прошла")
before = original[:assignment.value_start]
after_value = original[assignment.value_end:assignment.next_cell_start]
tail = original[assignment.next_cell_start:]
delta = len(new_value_bytes) - len(old_value_bytes)
if delta > 0:
# Новое число длиннее. Убираем столько же незначащих пробелов
# из отступов ПОСЛЕ значения d, но до следующей Cell.
compensated_after = _remove_indentation_spaces(after_value, delta)
elif delta < 0:
# Новое число короче. Добавляем пробелы сразу ПОСЛЕ закрывающей
# кавычки числового RowBox-токена. Это Wolfram-синтаксически
# незначащий whitespace.
need = -delta
if not after_value.startswith(b'"'):
raise NotebookFormatError(
"неожиданная структура после числового токена d"
)
compensated_after = (
after_value[:1] + (b" " * need) + after_value[1:]
)
else:
compensated_after = after_value
patched = before + new_value_bytes + compensated_after + tail
if len(patched) != len(original):
raise NotebookFormatError(
"после компенсации изменился размер notebook — запись отменена"
)
# Всё после начала следующей Cell должно остаться байт-в-байт неизменным.
if patched[assignment.next_cell_start:] != original[assignment.next_cell_start:]:
raise NotebookFormatError(
"обнаружено изменение за пределами первой Input-ячейки"
)
# Cache-блок должен остаться полностью неизменным.
old_cache_pos = original.find(b"(* Internal cache information *)", end_marker_pos(original))
new_cache_pos = patched.find(b"(* Internal cache information *)", end_marker_pos(patched))
if old_cache_pos < 0 or new_cache_pos < 0:
raise NotebookFormatError("не найден завершающий Internal cache information")
if old_cache_pos != new_cache_pos:
raise NotebookFormatError("сместилась позиция завершающего cache-блока")
if patched[old_cache_pos:] != original[old_cache_pos:]:
raise NotebookFormatError("cache-блок был изменён — запись отменена")
# Повторно разбираем результат и убеждаемся, что d стал целевым.
check = find_first_assignment(patched)
if check.variable != "d" or check.value_text != new_value:
raise NotebookFormatError(
"контрольная проверка после замены d не прошла"
)
return patched
def end_marker_pos(data: bytes) -> int:
pos = data.find(END_MARKER)
return pos if pos >= 0 else 0
def backup_file(source: Path, root: Path, backup_root: Path) -> Path:
relative = source.relative_to(root)
destination = backup_root / relative
destination.parent.mkdir(parents=True, exist_ok=True)
shutil.copy2(source, destination)
return destination
def atomic_write(path: Path, data: bytes) -> None:
original_stat = path.stat()
temp_name: str | None = None
try:
with tempfile.NamedTemporaryFile(
mode="wb",
prefix=f".{path.name}.",
suffix=".tmp",
dir=path.parent,
delete=False,
) as tmp:
temp_name = tmp.name
tmp.write(data)
tmp.flush()
os.fsync(tmp.fileno())
os.chmod(temp_name, stat.S_IMODE(original_stat.st_mode))
os.replace(temp_name, path)
temp_name = None
# На Linux fsync директории закрепляет rename в файловой системе.
try:
dir_fd = os.open(path.parent, os.O_RDONLY | os.O_DIRECTORY)
except OSError:
dir_fd = None
if dir_fd is not None:
try:
os.fsync(dir_fd)
finally:
os.close(dir_fd)
finally:
if temp_name is not None:
try:
os.unlink(temp_name)
except FileNotFoundError:
pass
def process_notebook(
path: Path,
root: Path,
coefficients: dict[str, str],
backup_root: Path,
) -> str:
if "фитирование" in path.name.casefold():
print(f"[SKIP fitting] {path}")
return "skipped_fitting"
if path.is_symlink():
print(f"[SKIP symlink] {path}")
return "skipped_other"
key = coefficient_key_from_filename(path.name)
if key is None:
print(f"[SKIP no-key] {path}: не удалось определить секцию коэффициентов")
return "skipped_other"
target = coefficients.get(key)
if target is None:
print(f"[SKIP no-coeff] {path}: нет секции {key!r} в coeff_file")
return "skipped_other"
try:
original = path.read_bytes()
except OSError as exc:
print(f"[ERROR read] {path}: {exc}")
return "error"
try:
first = find_first_assignment(original)
except NotebookFormatError as exc:
print(f"[SKIP first-d] {path}: {exc}")
return "skipped_first_d"
if first.variable != "d":
print(
f"[SKIP first-d] {path}: d не первая переменная "
f"(первая переменная: {first.variable})"
)
return "skipped_first_d"
if decimal_equal(first.value_text, target):
print(f"[OK already] {path}: d = {first.value_text}")
return "already"
try:
patched = patch_d_preserving_size(original, first, target)
except NotebookFormatError as exc:
print(f"[ERROR patch] {path}: {exc}")
return "error"
try:
backup_path = backup_file(path, root, backup_root)
except OSError as exc:
print(f"[ERROR backup] {path}: {exc}")
return "error"
try:
atomic_write(path, patched)
# Проверяем фактически записанные байты, а не только буфер.
written = path.read_bytes()
if written != patched:
raise OSError("байты после записи не совпадают с проверенным буфером")
verified = find_first_assignment(written)
if verified.variable != "d" or verified.value_text != target:
raise OSError("d после записи не прошёл контрольную проверку")
except Exception as exc:
# Если что-то пошло не так после backup, откатываем исходник.
try:
shutil.copy2(backup_path, path)
restore_note = "исходный файл восстановлен из backup"
except OSError as restore_exc:
restore_note = f"ОШИБКА ВОССТАНОВЛЕНИЯ: {restore_exc}"
print(f"[ERROR write] {path}: {exc}; {restore_note}")
return "error"
print(
f"[CHANGED] {path}: d {first.value_text} -> {target} "
f"(размер файла сохранён: {len(original)} байт)"
)
return "changed"
def main() -> int:
args = parse_args()
coeff_file = args.coeff_file.expanduser().resolve()
root = args.wolfram_notebooks.expanduser().resolve()
if not coeff_file.is_file():
print(f"ERROR: coeff_file не является файлом: {coeff_file}", file=sys.stderr)
return 2
if not root.is_dir():
print(
f"ERROR: wolfram_notebooks не является директорией: {root}",
file=sys.stderr,
)
return 2
try:
coefficients = parse_coefficients(coeff_file)
except RuntimeError as exc:
print(f"ERROR: {exc}", file=sys.stderr)
return 2
# Папка специально НЕ удаляется после завершения.
backup_root = Path(
tempfile.mkdtemp(prefix="insert_d_into_nb_backup_", dir="/tmp")
)
counters = {
"changed": 0,
"already": 0,
"skipped_fitting": 0,
"skipped_first_d": 0,
"skipped_other": 0,
"error": 0,
}
notebooks = sorted(
(p for p in root.rglob("*.nb") if p.is_file() or p.is_symlink()),
key=lambda p: str(p),
)
print(f"Найдено notebook-файлов: {len(notebooks)}")
for path in notebooks:
result = process_notebook(path, root, coefficients, backup_root)
counters[result] += 1
print("\nИтог:")
print(f" изменено: {counters['changed']}")
print(f" уже имели правильное d: {counters['already']}")
print(f" пропущено (фитирование): {counters['skipped_fitting']}")
print(f" пропущено (d не первая): {counters['skipped_first_d']}")
print(f" пропущено (прочее): {counters['skipped_other']}")
print(f" ошибок: {counters['error']}")
print(f"Папка backup: {backup_root}")
return 1 if counters["error"] else 0
if __name__ == "__main__":
raise SystemExit(main())

373
automation/promt.txt Normal file
View file

@ -0,0 +1,373 @@
Ты senior python developer. К тебе обратился преподаватель из вуза с заданием написать скрипт на python. Проверяй себя. Не совершай ошибок, файлы *.nb не должны ломаться при открытии их при помощи wolframnb (возможно, не надо трогать кэш). Твое ТЗ:
Формат скрипта: python.
ОС: arch linux
Формат бэкапа: если файл будет редактироваться, сделай бэкап файла в папку находящуюся в /tmp. После работы файлы бэкапа не удалять. Вывести пользователю в конце работы путь к паке бэкапа.
Краткое описание работы: Скрипт заходит во все подпапки директории, указанной в ключе --wolfram_noteooks. Открывает файлы с расширением .nb, если в названии файла есть "фитирование", файл пропускается; если в этом файле "d" не стоит на первом месте (или "d" вовсе нет) скрипт скипает этот файл и говорит об этом пользователю.
Рабочие файлы, структура работы:
Есть файл с коэфицентами:
```txt
174-66_2-3
J=13.2851
d = 2.027
v1 = 1.7300
n1 = 0.7600
vv1 = 2.4000
nn1 = 1.1050
v2 = 1.4012
n2 = 0.5547
vv2 = 1.1338
nn2 = 0.8500
-----------------------------
176-64_4-5
J=14.2006
d = 1.565
v1 = 1.2500
n1 = 0.8500
vv1 = 2.3000
nn1 = 1.1000
v2 = 0.8664
n2 = 0.5924
vv2 = 1.8880
nn2 = 0.6347
-----------------------------
152-88_6-7
J=7.82676
d = 2.875
v1 = 1.63
n1 = 0.856
vv1 = 2.615
nn1 = 1.23
v2 = 2.22
n2 = 0.559
vv2 = 2.428
nn2 = 0.738
-----------------------------
154-86_8-9
J=8.75268
d = 4.158
v1 = 1.82
n1 = 0.845
vv1 = 2.34
nn1 = 1.235
v2 = 2.157
n2 = 0.647
vv2 = 1.76
nn2 = 1.075
-----------------------------
156-84_10-11
J=10.6271
d = 6.444
v1 = 1.635
n1 = 0.855
vv1 = 2.405
nn1 = 1.225
v2 = 1.63
n2 = 0.5571
vv2 = 1.82
nn2 = 0.675
-----------------------------
158-82_12-13
J=11.9856
d = 2.0967
v1 = 2.1
n1 = 0.825
vv1 = 2.555
nn1 = 1.245
v2 = 1.573
n2 = 0.559
vv2 = 1.35
nn2 = 0.735
-----------------------------
160-80_14-15
J= 11.8301
d = 1.971
v1 = 1.965
n1 = 0.805
vv1 = 2.575
nn1 = 1.195
v2 = 1.213
n2 = 0.575
vv2 = 1.35
nn2 = 0.715
-----------------------------
162-78_16-17
J=11.9413
d = 1.92
v1 = 1.925
n1 = 0.805
vv1 = 2.5
nn1 = 1.165
v2 = 1.213
n2 = 0.57
vv2 = 1.35
nn2 = 0.695
-----------------------------
164-76_18-19
J=12.1752
d = 1.745
v1 = 2
n1 = 0.805
vv1 = 2.65
nn1 = 1.175
v2 = 0.795
n2 = 0.595
vv2 = 1.47
nn2 = 0.655
-----------------------------
166-74_20-21
J=12.0995
d = 1.855
v1 = 2.185
n1 = 0.755
vv1 = 2.5
nn1 = 1.165
v2 = 1.055
n2 = 0.575
vv2 = 1.51
nn2 = 0.635
-----------------------------
168-72_22-23
J=11.8913
d = 1.9
v1 = 2.155
n1 = 0.755
vv1 = 2.62
nn1 = 1.135
v2 = 1.025
n2 = 0.575
vv2 = 1.44
nn2 = 0.645
-----------------------------
170-70_24-25
J=11.7863
d = 1.997
v1 = 1.895
n1 = 0.785
vv1 = 2.605
nn1 = 1.125
v2 = 1.145
n2 = 0.565
vv2 = 1.5
nn2 = 0.635
-----------------------------
172-68_26-27
J=12.0157
d = 1.973
v1 = 1.895
n1 = 0.765
vv1 = 2.605
nn1 = 1.115
v2 = 1.375
n2 = 0.545
vv2 = 1.35
nn2 = 0.655
```
Есть файл wolfram notebook. В нем в самом начале стоит выражение d=*какое-то число*.
Примерная структура файла, если "d" стоит на первом месте:
```wolfram notebook
(* Content-type: application/vnd.wolfram.mathematica *)
(*** Wolfram Notebook File ***)
(* http://www.wolfram.com/nb *)
(* CreatedBy='Wolfram 15.0' *)
(*CacheID: 234*)
(* Internal cache information:
NotebookFileLineBreakTest
NotebookFileLineBreakTest
NotebookDataPosition[ 154, 7]
NotebookDataLength[ 731705, 17288]
NotebookOptionsPosition[ 687975, 16585]
NotebookOutlinePosition[ 688773, 16613]
CellTagsIndexPosition[ 688693, 16608]
WindowFrame->Normal*)
(* Beginning of Notebook Content *)
Notebook[{
Cell[CellGroupData[{
Cell[BoxData[
RowBox[{"d", "=", "2.027"}]], "Input",
CellChangeTimes->{
3.991926627241884*^9, {3.9919752407542057`*^9, 3.9919752437472878`*^9},
3.9920650045886707`*^9, {3.993120093374651*^9, 3.993120098406262*^9}, {
3.9931205775772543`*^9, 3.9931205930074*^9}, {3.99312068244851*^9,
3.993120683031312*^9}, {3.993120763928855*^9, 3.993120796207575*^9}, {
3.993120826638487*^9, 3.99312091050727*^9}, {3.993134989219914*^9,
3.99313504530585*^9}, {3.99376504479251*^9, 3.9937650448755198`*^9}, {
3.993794858519045*^9, 3.993794859582933*^9}, {3.993794914198393*^9,
3.993794918313219*^9}, {3.99379500667054*^9, 3.993795007979557*^9}, {
3.99379568990552*^9, 3.993795691164195*^9}, {3.993795875385445*^9,
3.99379588501084*^9}, {3.993797995002406*^9, 3.993797995597159*^9}, {
3.993798072981077*^9, 3.993798075654434*^9}, {3.9937986726317673`*^9,
3.9937987633828897`*^9}, {3.996019683105693*^9, 3.9960196851234617`*^9}, {
3.9960197207254753`*^9, 3.996019835558236*^9}, {3.996020358638421*^9,
3.996020431902809*^9}},
CellLabel->
"In[407]:=",ExpressionUUID->"351bbc0d-9f60-fb44-a3dd-8326f7c1a9b1"],
Cell[BoxData["2.027`"], "Output",
CellChangeTimes->{{3.99312071481172*^9, 3.993120733996957*^9},
3.993120778405978*^9, {3.993120808982645*^9, 3.993120917972237*^9},
3.993134742771702*^9, 3.993134997755999*^9, {3.9931350356393623`*^9,
3.9931350524140167`*^9}, {3.993765041622612*^9, 3.993765045540139*^9}, {
3.993794839003294*^9, 3.99379487284307*^9}, 3.993794932563972*^9,
3.993795020572113*^9, 3.993795700216778*^9, {3.993798060729582*^9,
3.9937980859991283`*^9}, 3.993798620911396*^9, {3.993798685866233*^9,
3.993798702104156*^9}, {3.993798732179296*^9, 3.993798771847027*^9},
3.993798841155717*^9, 3.993826323633601*^9, 3.99601968768934*^9, {
3.9960197225490913`*^9, 3.9960198377988863`*^9}, {3.996020361799699*^9,
3.9960204378503847`*^9}},
CellLabel->
"Out[407]=",ExpressionUUID->"ef417a2c-223f-4508-899b-e106a590f873"]
}, Open ]],
Cell[CellGroupData[{
etc........
```
Структура папок:
```stdout
./
├── 152-88_h_Pu240_6-7
│   ├── h_152-88_h_Pu240_6-7_gid_Qw1.nb
│   ├── h_152-88_h_Pu240_6-7_gid_Qw2.nb
│   ├── h_152-88_h_Pu240_6-7_osc_Qw1.nb
│   ├── h_152-88_h_Pu240_6-7_osc_Qw2.nb
│   ├── h_152-88_h_Pu240_6-7_pr_Qw1.nb
│   ├── h_152-88_h_Pu240_6-7_pr_Qw2.nb
│   ├── h_152-88_h_Pu240_6-7_фитирование.nb
│   └── rename.zsh
├── 154-86_h_Pu240_8-9
│   ├── h_154-86_Pu240_8-9_gid_Qw1.nb
│   ├── h_154-86_Pu240_8-9_gid_Qw2.nb
│   ├── h_154-86_Pu240_8-9_osc_Qw1.nb
│   ├── h_154-86_Pu240_8-9_osc_Qw2.nb
│   ├── h_154-86_Pu240_8-9_pr_Qw1.nb
│   ├── h_154-86_Pu240_8-9_pr_Qw2.nb
│   ├── h_154-86_Pu240_8-9_фитирование.nb
│   └── rename.zsh
├── 156-84_h_Pu240_10-11
│   ├── h_156-84_h_Pu240_10-11_gid_Qw1.nb
│   ├── h_156-84_h_Pu240_10-11_gid_Qw2.nb
│   ├── h_156-84_h_Pu240_10-11_osc_Qw1.nb
│   ├── h_156-84_h_Pu240_10-11_osc_Qw2.nb
│   ├── h_156-84_h_Pu240_10-11_pr_Qw1.nb
│   ├── h_156-84_h_Pu240_10-11_pr_Qw2.nb
│   ├── h_156-84_h_Pu240_10-11_фитирование.nb
│   └── rename.zsh
├── 158-82_h_Pu240_12-13
│   ├── h_158-82_h_Pu240_12-13_gid_Qw1.nb
│   ├── h_158-82_h_Pu240_12-13_gid_Qw2.nb
│   ├── h_158-82_h_Pu240_12-13_osc_Qw1.nb
│   ├── h_158-82_h_Pu240_12-13_osc_Qw2.nb
│   ├── h_158-82_h_Pu240_12-13_pr_Qw1.nb
│   ├── h_158-82_h_Pu240_12-13_pr_Qw2.nb
│   ├── h_158-82_h_Pu240_12-13_фитирование.nb
│   └── rename.zsh
├── 160-80_h_Pu240_14-15
│   ├── h_160-80_Pu240_14-15_gid_Qw1.nb
│   ├── h_160-80_Pu240_14-15_gid_Qw2.nb
│   ├── h_160-80_Pu240_14-15_osc_Qw1.nb
│   ├── h_160-80_Pu240_14-15_osc_Qw2.nb
│   ├── h_160-80_Pu240_14-15_pr_Qw1.nb
│   ├── h_160-80_Pu240_14-15_pr_Qw2.nb
│   ├── h_160-80_Pu240_14-15_фитирование.nb
│   └── rename.zsh
├── 162-78_h_Pu240_16-17
│   ├── h_162-78_Pu240_16-17_gid_Qw1.nb
│   ├── h_162-78_Pu240_16-17_gid_Qw2.nb
│   ├── h_162-78_Pu240_16-17_osc_Qw1.nb
│   ├── h_162-78_Pu240_16-17_osc_Qw2.nb
│   ├── h_162-78_Pu240_16-17_pr_Qw1.nb
│   ├── h_162-78_Pu240_16-17_pr_Qw2.nb
│   ├── h_162-78_Pu240_16-17_фитирование.nb
│   └── rename.zsh
├── 164-76_h_Pu240_18-19
│   ├── h_164-76_Pu240_18-19_gid_Qw1.nb
│   ├── h_164-76_Pu240_18-19_gid_Qw2.nb
│   ├── h_164-76_Pu240_18-19_osc_Qw1.nb
│   ├── h_164-76_Pu240_18-19_osc_Qw2.nb
│   ├── h_164-76_Pu240_18-19_pr_Qw1.nb
│   ├── h_164-76_Pu240_18-19_pr_Qw2.nb
│   ├── h_164-76_Pu240_18-19_фитирование.nb
│   └── rename.zsh
├── 166-74_h_Pu240_20-21
│   ├── h_166-74_Pu240_20-21_gid_Qw1.nb
│   ├── h_166-74_Pu240_20-21_gid_Qw2.nb
│   ├── h_166-74_Pu240_20-21_osc_Qw1.nb
│   ├── h_166-74_Pu240_20-21_osc_Qw2.nb
│   ├── h_166-74_Pu240_20-21_pr_Qw1.nb
│   ├── h_166-74_Pu240_20-21_pr_Qw2.nb
│   ├── h_166-74_Pu240_20-21_фитирование.nb
│   └── rename.zsh
├── 168-72_h_Pu240_22-23
│   ├── h_168-72_Pu240_22-23_gid_Qw1.nb
│   ├── h_168-72_Pu240_22-23_gid_Qw2.nb
│   ├── h_168-72_Pu240_22-23_osc_Qw1.nb
│   ├── h_168-72_Pu240_22-23_osc_Qw2.nb
│   ├── h_168-72_Pu240_22-23_pr_Qw1.nb
│   ├── h_168-72_Pu240_22-23_pr_Qw2.nb
│   ├── h_168-72_Pu240_22-23_фитирование.nb
│   └── rename.zsh
├── 170-70_h_Pu240_24-25
│   ├── h_170-70_Pu240_24-25_gid_Qw1.nb
│   ├── h_170-70_Pu240_24-25_gid_Qw2.nb
│   ├── h_170-70_Pu240_24-25_osc_Qw1.nb
│   ├── h_170-70_Pu240_24-25_osc_Qw2.nb
│   ├── h_170-70_Pu240_24-25_pr_Qw1.nb
│   ├── h_170-70_Pu240_24-25_pr_Qw2.nb
│   ├── h_170-70_Pu240_24-25_фитирование.nb
│   └── rename.zsh
├── 172-68_h_Pu240_26-27
│   ├── h_172-68_Pu240_26-27_gid_Qw1.nb
│   ├── h_172-68_Pu240_26-27_gid_Qw2.nb
│   ├── h_172-68_Pu240_26-27_osc_Qw1.nb
│   ├── h_172-68_Pu240_26-27_osc_Qw2.nb
│   ├── h_172-68_Pu240_26-27_pr_Qw1.nb
│   ├── h_172-68_Pu240_26-27_pr_Qw2.nb
│   ├── h_172-68_Pu240_26-27_фитирование.nb
│   └── rename.zsh
├── 174-66_h_Pu240_2-3
│   ├── h_174-66_Pu240_2-3_gid_Qw1.nb
│   ├── h_174-66_Pu240_2-3_gid_Qw2.nb
│   ├── h_174-66_Pu240_2-3_osc_Qw1.nb
│   ├── h_174-66_Pu240_2-3_osc_Qw2.nb
│   ├── h_174-66_Pu240_2-3_pr_Qw1.nb
│   ├── h_174-66_Pu240_2-3_pr_Qw2.nb
│   └── h_174-66_Pu240_2-3_фитирование.nb
├── 176-64_h_Pu240_4-5
│   ├── h_176-64_Pu240_4-5_gid_Qw1.nb
│   ├── h_176-64_Pu240_4-5_gid_Qw2.nb
│   ├── h_176-64_Pu240_4-5_osc_Qw1.nb
│   ├── h_176-64_Pu240_4-5_osc_Qw2.nb
│   ├── h_176-64_Pu240_4-5_pr_Qw1.nb
│   ├── h_176-64_Pu240_4-5_pr_Qw2.nb
│   ├── h_176-64_Pu240_4-5_фитирование.nb
│   └── rename.bat
├── result_table.xlsx
└── коэффициенты_Pu240_2-24.txt
```
Соответствие файла и значения "d" получается по принципу:
Пример 1:
- Файл: "h_154-86_Pu240_8-9_gid_Qw1.nb"
- Значение "d" из секции файла с коэфициентами: 154-86_8-9; значение "d" = 4.158
Пример 2:
- Файл: "h_152-88_h_Pu240_6-7_pr_Qw1.nb"
- Значение "d" из секции файла с коэфициентами: 152-88_6-7; значение "d" = 2.875
Исключения:
- если файл содержит в названии "фитирование", файл пропускается.
- если файл НЕ содержит в названии "фитирование" и в нем d не является самой первой переменной, файл пропускается и пишется в консоль соощение о пропущенном файле и его название.
Способ работы со скриптом:
запуск в bash с ключами/параметрами:
```bash
./insert_d_into_nb.py --coeff_file "коэфициенты.txt" --wolfram_notebooks .
```
Задача:
Поменять значения 'd' в файлах *.nb на значение из файла коэффициентов.