{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Part Section to Layers\n", "Splits part section file into smaller layer files." ] }, { "cell_type": "code", "execution_count": 19, "metadata": {}, "outputs": [], "source": [ "import pickle" ] }, { "cell_type": "code", "execution_count": 25, "metadata": {}, "outputs": [], "source": [ "data_folder = \"part_section\"\n", "layers_folder = \"layer\"\n", "\n", "# config = \"BASE\"\n", "# config = \"BLOCK\"\n", "# config = \"OVERHANG_noSup\"\n", "config = \"OVERHANG_wSup\"\n", "\n", "# config_folder = \"base\"\n", "# config_folder = \"block\"\n", "# config_folder = \"overhang_no_supports\"\n", "config_folder = \"overhang_with_supports\"" ] }, { "cell_type": "code", "execution_count": 26, "metadata": {}, "outputs": [], "source": [ "with open(f\"{data_folder}/{config}.pkl\", \"rb\") as f:\n", " layers = pickle.load(f)" ] }, { "cell_type": "code", "execution_count": 27, "metadata": {}, "outputs": [], "source": [ "for layer in layers:\n", " layer_number = layer[\"layer_number\"]\n", " with open(f\"{layers_folder}/{config_folder}/{layer_number}.pkl\", \"wb\") as f:\n", " pickle.dump(layer, f)" ] }, { "cell_type": "code", "execution_count": 7, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "{'folder_layer_range': '001-005',\n", " 'part': 'OverhangPart',\n", " 'part_section': 'BASE',\n", " 'process': 'LPBFthermography',\n", " 'source': 'NIST',\n", " 'supports': 'N/A',\n", " 'layer_number': 1,\n", " 'build_time': array([[0. , 0. , 0. , ..., 0. , 0. , 0. ],\n", " [0. , 0. , 0. , ..., 0. , 0. , 0. ],\n", " [0. , 0.000556, 0.001112, ..., 0.208886, 0.209441, 0.209997]],\n", " dtype=float32),\n", " 'contact_email': 'jarred.heigel@nist.gov',\n", " 'file_name': '20180801_OverhangStudy_Layer01.mat',\n", " 'hatch_spacing': 100,\n", " 'laser_power': 195,\n", " 'layer_thickness': 20,\n", " 'material': 'IN625',\n", " 'radiant_temp': array([[[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", " \n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", " \n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", " \n", " ...,\n", " \n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", " \n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 545, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", " \n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]]], dtype=uint16),\n", " 'raw_frame_number': array([[5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034,\n", " 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045,\n", " 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056,\n", " 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065, 5066, 5067,\n", " 5068, 5069, 5070, 5071, 5072, 5073, 5074, 5075, 5076, 5077, 5078,\n", " 5079, 5080, 5081, 5082, 5083, 5084, 5085, 5086, 5087, 5088, 5089,\n", " 5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100,\n", " 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110, 5111,\n", " 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122,\n", " 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133,\n", " 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144,\n", " 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155,\n", " 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166,\n", " 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177,\n", " 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188,\n", " 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199,\n", " 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210,\n", " 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221,\n", " 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232,\n", " 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243,\n", " 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254,\n", " 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265,\n", " 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276,\n", " 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287,\n", " 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298,\n", " 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309,\n", " 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320,\n", " 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331,\n", " 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342,\n", " 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353,\n", " 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364,\n", " 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375,\n", " 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386,\n", " 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397,\n", " 5398, 5399, 5400]], dtype=uint32),\n", " 'resolution': array([[49.8],\n", " [33.5]], dtype=float32),\n", " 's_hvariable__a': 2.655,\n", " 's_hvariable__b': -800.7,\n", " 's_hvariable__c': 1940000.0,\n", " 'scan_speed': 800,\n", " 'website': 'nist.gov/el/lpbf-thermography/3D-part-builds/OverhangPart-IN625'}" ] }, "execution_count": 7, "metadata": {}, "output_type": "execute_result" } ], "source": [ "layers[0]" ] }, { "cell_type": "code", "execution_count": 14, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{'folder_layer_range': '001-005', 'part': 'OverhangPart', 'part_section': 'BASE', 'process': 'LPBFthermography', 'source': 'NIST', 'supports': 'N/A', 'layer_number': 1, 'build_time': array([[0. , 0. , 0. , ..., 0. , 0. , 0. ],\n", " [0. , 0. , 0. , ..., 0. , 0. , 0. ],\n", " [0. , 0.000556, 0.001112, ..., 0.208886, 0.209441, 0.209997]],\n", " dtype=float32), 'contact_email': 'jarred.heigel@nist.gov', 'file_name': '20180801_OverhangStudy_Layer01.mat', 'hatch_spacing': 100, 'laser_power': 195, 'layer_thickness': 20, 'material': 'IN625', 'radiant_temp': array([[[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", "\n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", "\n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", "\n", " ...,\n", "\n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", "\n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 545, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]],\n", "\n", " [[ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " ...,\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0],\n", " [ 0, 0, 0, ..., 0, 0, 0]]], dtype=uint16), 'raw_frame_number': array([[5024, 5025, 5026, 5027, 5028, 5029, 5030, 5031, 5032, 5033, 5034,\n", " 5035, 5036, 5037, 5038, 5039, 5040, 5041, 5042, 5043, 5044, 5045,\n", " 5046, 5047, 5048, 5049, 5050, 5051, 5052, 5053, 5054, 5055, 5056,\n", " 5057, 5058, 5059, 5060, 5061, 5062, 5063, 5064, 5065, 5066, 5067,\n", " 5068, 5069, 5070, 5071, 5072, 5073, 5074, 5075, 5076, 5077, 5078,\n", " 5079, 5080, 5081, 5082, 5083, 5084, 5085, 5086, 5087, 5088, 5089,\n", " 5090, 5091, 5092, 5093, 5094, 5095, 5096, 5097, 5098, 5099, 5100,\n", " 5101, 5102, 5103, 5104, 5105, 5106, 5107, 5108, 5109, 5110, 5111,\n", " 5112, 5113, 5114, 5115, 5116, 5117, 5118, 5119, 5120, 5121, 5122,\n", " 5123, 5124, 5125, 5126, 5127, 5128, 5129, 5130, 5131, 5132, 5133,\n", " 5134, 5135, 5136, 5137, 5138, 5139, 5140, 5141, 5142, 5143, 5144,\n", " 5145, 5146, 5147, 5148, 5149, 5150, 5151, 5152, 5153, 5154, 5155,\n", " 5156, 5157, 5158, 5159, 5160, 5161, 5162, 5163, 5164, 5165, 5166,\n", " 5167, 5168, 5169, 5170, 5171, 5172, 5173, 5174, 5175, 5176, 5177,\n", " 5178, 5179, 5180, 5181, 5182, 5183, 5184, 5185, 5186, 5187, 5188,\n", " 5189, 5190, 5191, 5192, 5193, 5194, 5195, 5196, 5197, 5198, 5199,\n", " 5200, 5201, 5202, 5203, 5204, 5205, 5206, 5207, 5208, 5209, 5210,\n", " 5211, 5212, 5213, 5214, 5215, 5216, 5217, 5218, 5219, 5220, 5221,\n", " 5222, 5223, 5224, 5225, 5226, 5227, 5228, 5229, 5230, 5231, 5232,\n", " 5233, 5234, 5235, 5236, 5237, 5238, 5239, 5240, 5241, 5242, 5243,\n", " 5244, 5245, 5246, 5247, 5248, 5249, 5250, 5251, 5252, 5253, 5254,\n", " 5255, 5256, 5257, 5258, 5259, 5260, 5261, 5262, 5263, 5264, 5265,\n", " 5266, 5267, 5268, 5269, 5270, 5271, 5272, 5273, 5274, 5275, 5276,\n", " 5277, 5278, 5279, 5280, 5281, 5282, 5283, 5284, 5285, 5286, 5287,\n", " 5288, 5289, 5290, 5291, 5292, 5293, 5294, 5295, 5296, 5297, 5298,\n", " 5299, 5300, 5301, 5302, 5303, 5304, 5305, 5306, 5307, 5308, 5309,\n", " 5310, 5311, 5312, 5313, 5314, 5315, 5316, 5317, 5318, 5319, 5320,\n", " 5321, 5322, 5323, 5324, 5325, 5326, 5327, 5328, 5329, 5330, 5331,\n", " 5332, 5333, 5334, 5335, 5336, 5337, 5338, 5339, 5340, 5341, 5342,\n", " 5343, 5344, 5345, 5346, 5347, 5348, 5349, 5350, 5351, 5352, 5353,\n", " 5354, 5355, 5356, 5357, 5358, 5359, 5360, 5361, 5362, 5363, 5364,\n", " 5365, 5366, 5367, 5368, 5369, 5370, 5371, 5372, 5373, 5374, 5375,\n", " 5376, 5377, 5378, 5379, 5380, 5381, 5382, 5383, 5384, 5385, 5386,\n", " 5387, 5388, 5389, 5390, 5391, 5392, 5393, 5394, 5395, 5396, 5397,\n", " 5398, 5399, 5400]], dtype=uint32), 'resolution': array([[49.8],\n", " [33.5]], dtype=float32), 's_hvariable__a': 2.655, 's_hvariable__b': -800.7, 's_hvariable__c': 1940000.0, 'scan_speed': 800, 'website': 'nist.gov/el/lpbf-thermography/3D-part-builds/OverhangPart-IN625'}\n" ] } ], "source": [ "layer_number = 1\n", "with open(f\"{layers_folder}/{config_folder}/{layer_number}.pkl\", \"rb\") as f:\n", " layer = pickle.load(f)\n", "\n", "print(layer)" ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "venv", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.12.3" } }, "nbformat": 4, "nbformat_minor": 2 }