.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/template.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_template.py: lsframe Template ================= This Template serves as an example layout for a script using lsframe. .. GENERATED FROM PYTHON SOURCE LINES 13-14 Import lsframe and any other packages that may be needed for your function, .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: default import lsframe as ls # import numpy as np # etc. .. GENERATED FROM PYTHON SOURCE LINES 21-22 Set the path to a parent directory, .. GENERATED FROM PYTHON SOURCE LINES 22-23 .. code-block:: default path = "../path/to/parent/directory" .. GENERATED FROM PYTHON SOURCE LINES 26-29 Define a function that accepts the parent directory and any additional arguments in the form of a dictionary and returns a list of outputs. The list must have a single value for each member of the list and have **len()** equal to the list of **'classifiers'** given during the creation of the **start** object below. .. GENERATED FROM PYTHON SOURCE LINES 29-39 .. code-block:: default def function_handle(directory, args_dict): # insert code that acts on each file or sub-directory and makes output(s) # output1 = # output2 = return [output1, output2] # make sure outputs are in a list # len() outputs list must = len() classifiers list .. GENERATED FROM PYTHON SOURCE LINES 42-43 Create the **start** object, .. GENERATED FROM PYTHON SOURCE LINES 43-55 .. code-block:: default lsobject = ls.start( path, patterns=[], # any patterns in the file or folder names to use as classifiers skip=[], # any sub-strings in the names of file folders that should be skipped classifiers=[ "output1", "output2", ], # the column names corresponding to the function outputs function=function_handle, # complete the function above function_args={}, # any arguments required by function_handle date_format="YYYYMMDD", # format of any date strings in the file or folder names ) .. GENERATED FROM PYTHON SOURCE LINES 58-60 Pass the **start** object to the user defined function to add classifiers to the **.frame**, then print the **.head()** of **.frame**, .. GENERATED FROM PYTHON SOURCE LINES 60-62 .. code-block:: default lsobject.drive() print(lsobject.frame.head()) .. GENERATED FROM PYTHON SOURCE LINES 65-66 Add a dictionary to the **start** object that is a map of the parent directory, .. GENERATED FROM PYTHON SOURCE LINES 66-67 .. code-block:: default lsobject.map_directory() .. GENERATED FROM PYTHON SOURCE LINES 70-74 Create a seaborn.relplot correlating the two outputs. Replace **'None'** for hue with date_delta if it exists in your **.frame**, or maybe with a third output if you have more than two. The **'seaborn_args'** dictionary should have keys that are the arguments that would be given to **seaborn.relplot** and any allowed values according to **seaborn.relplot** documentation, .. GENERATED FROM PYTHON SOURCE LINES 74-75 .. code-block:: default lsobject.sea(seaborn_args={"x": "output1", "y": "output2", "hue": None, "s": 100}) .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.000 seconds) .. _sphx_glr_download_auto_examples_template.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: template.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: template.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_