|
843 | 843 | "\n", |
844 | 844 | "plt.show()" |
845 | 845 | ] |
846 | | - }, |
847 | | - { |
848 | | - "cell_type": "markdown", |
849 | | - "metadata": {}, |
850 | | - "source": [ |
851 | | - "## Optional: Export Data\n", |
852 | | - "\n", |
853 | | - "Write the true model, data and topography\n", |
854 | | - "\n", |
855 | | - "\n" |
856 | | - ] |
857 | | - }, |
858 | | - { |
859 | | - "cell_type": "code", |
860 | | - "execution_count": 21, |
861 | | - "metadata": { |
862 | | - "execution": { |
863 | | - "iopub.execute_input": "2025-05-23T17:19:25.643898Z", |
864 | | - "iopub.status.busy": "2025-05-23T17:19:25.643584Z", |
865 | | - "iopub.status.idle": "2025-05-23T17:19:25.648762Z", |
866 | | - "shell.execute_reply": "2025-05-23T17:19:25.648248Z" |
867 | | - } |
868 | | - }, |
869 | | - "outputs": [], |
870 | | - "source": [ |
871 | | - "if save_file:\n", |
872 | | - " dir_path = os.path.dirname(fdem.__file__).split(os.path.sep)[:-3]\n", |
873 | | - " dir_path.extend([\"tutorials\", \"assets\", \"fdem\"])\n", |
874 | | - " dir_path = os.path.sep.join(dir_path) + os.path.sep\n", |
875 | | - "\n", |
876 | | - " # Write topography\n", |
877 | | - " fname = dir_path + \"fdem_topo.txt\"\n", |
878 | | - " np.savetxt(fname, np.c_[topo_xyz], fmt=\"%.4e\")\n", |
879 | | - "\n", |
880 | | - " # Write data with 2% noise added\n", |
881 | | - " fname = dir_path + \"fdem_data.obs\"\n", |
882 | | - " bz_real = bz_real + 1e-14 * np.random.rand(len(bz_real))\n", |
883 | | - " bz_imag = bz_imag + 1e-14 * np.random.rand(len(bz_imag))\n", |
884 | | - " f_vec = np.kron(frequencies, np.ones(ntx))\n", |
885 | | - " receiver_locations = np.kron(np.ones((len(frequencies), 1)), receiver_locations)\n", |
886 | | - "\n", |
887 | | - " np.savetxt(fname, np.c_[f_vec, receiver_locations, bz_real, bz_imag], fmt=\"%.4e\")\n", |
888 | | - "\n", |
889 | | - " # Plot true model\n", |
890 | | - " output_model = plotting_map * model\n", |
891 | | - " output_model[np.isnan(output_model)] = 1e-8\n", |
892 | | - "\n", |
893 | | - " fname = dir_path + \"true_model.txt\"\n", |
894 | | - " np.savetxt(fname, output_model, fmt=\"%.4e\")" |
895 | | - ] |
896 | 846 | } |
897 | 847 | ], |
898 | 848 | "metadata": { |
|
0 commit comments