Display dataframe in a separate panel in Jupyter Lab - dataframe

I would like to display my dataframe in a seperate panel/window in Jupyter Lab. Currently, I can open .csv files in a separate window (which helps write code side-by-side to the data I'm working with), but I want to do this with active dataframes as well.
Is there a way to do this native to Jupyterlab, similar to how it is done in MATLAB? If not, what is the best way to do it otherwise?

Yes. There are several ways:
Display the data frame in a cell output, then right-click on the output and select Create New View for Output
Use jupyterlab-sidecar package:
from sidecar import Sidecar
sc = Sidecar(title='My dataframe')
with sc:
display(df)
(JupyterLab 3.3+) Activate the visual debugger, go to variables list, hover over the variable and click on loop icon.
You can combine approach (1) or (2) with IPython widgets to create an interactive explorer for larger data frames, such as this pandas_explorer snippet. There are other, more complete, interactive explorers which you can embed in a sidecar or move to the new output, for example ipydatagrid.

Related

How to save a figure with multiple overlapping plots?

I am plotting multiples signals overlapping in one figure using matplotlib and then saving it in pdf/eps using matplotlib.pyplot.savefig, the problem is that when I try to insert the figure in a pdf-latex file, it takes like 1.5 min to load because it starts rendering every plot. Is there any way to properly save or create these plots in one figure?
The final pdf works perfectly when I use preview on macOS, regularly when I use edge or chrome navigators and it is a disaster if I use adobe-reader. I am looking for a multiplatform solution.

IPython console: Display plots when using run

I'm using a IPython console (IPython 8.3.0) for running scripts and then use the interactive console to manually inspect variables, try something new, etc.
My problem is with plotting figures - I'm looking for a way to display figures when using e.g. %matplotlib auto and %run myscript.py in the IPython console. I expect the figures drawn in separate windows, not inline.
I'm able to get the behavior I want by using %load myscript.py and executing the code, but this is quickly cluttering the history in the console.
I want to avoid using matplotlib.pyplot.show() in my scripts - if possible.
I there a way to achieve what I want without using %load or show()?

Stitching thousands of .png files with Fiji

I wrote a Node.js app that creates images that I want to stitch. I want to create one image with over 10,000 charts. My original solution was to create images each with over 200 charts each and stitch those together. That results in 50 images being stitched.
I now wish to create one chart per image, resulting in over 10,000 images, and stitch those together. When I drag and drop the files into Fiji to create a montage, it opens each individual one. It takes way to long to open the entire collection.
Is there a way I can create a montage of thousands of images and stitch everything into a single file in Fiji that doesn't require every image being opened?
You say that you want to stitch your image, which implies your goal is to find where these images overlay from a specific channel, but when you say montage, it makes it seem like what you really want to do is concatenate the images into a stack or align them into a montage. To me it appears that you have a program which will output some form of stack which has 200 planes, and then concatenate them together or align them as a montage.
In principle, you will have to open every image, but opening them with batch mode on and running the operations by macro will reduce time by not rendering the viewable image. It would not be possible to run ImageJ/FIJI operations on an image without opening it, as this is beyond something like renaming or deleting a file.
If you really meant that you want to stitch them, use the stitching plugin function for Grid/Collection stitching, and set the overlap to zero. This requires having your images be in a single folder, and in your case splitting them into individual images instead of sets of 200, with each file labeled with an increasing number (i.e. file_name_1.tif, file_name_2.tif, where each file_name is the same and only the number changes). If you have stacks of 200 and are happy to keep them that way in the created montage, the file naming convention needs to be the same. You should select the Fuse and Display option to get the resulting image. The output will be a merged, larger image.
When you are trying to somehow stitch the images and overlay the stacks, scripting the commands to run it in batch mode would also work.
For stitching I highly recommend the MIST plugin. For batch opening files, try dragging and dropping the folder containing the images rather than the images themselves. Alternatively, go through File -> Import -> Image Sequence.

Is it possible to use the After Effects 'Create Shapes from Vector Layer' functionality from within a script (Adobe ExtendScript)?

I am attempting to create a script for Adobe After Effects. Part of what I am attempting to accomplish will require converting layers imported from Illustrator into After Effects shape layers.
I am having trouble finding any info on how this can be accomplished in ExtendScript. Is it possible?
Any menu commands in After effects are available to extendscript, even if they're not included in the API. To invoke a command as you would with a menu you use
app.executeCommand(1234);
Where 1234 is the number of the command you want. To find this magic number there is a function
app.findMenuCommandId("Full text of command as it appears in the menu");
It's kludgy, and there's no guarantee that adobe will stay consistent with the numbers between releases, but it's all we have. More details and a list of magic numbers here

Operate on data or simulate user input?

I'm trying to write my first blender script to import a BVH animation and copy the keyframes from the imported rig to an existing rig. It seems to me there are two ways to do this:
Operate on the data directly, by looping over bpy.data.objects[rig].animation_data.action.fcurves.keyframes and somehow copying them into the corresponding data structure on the existing rig
Simulate the way a user would do it by setting the context to a 3D view, importing the mesh, setting the context to the curves editor, selecting all, copying, switching back to 3D view, selecting the existing rig, switching back to curves again and pasting the data
Number 1 sounds like the right way to me, but looking at the API it seems that it's more geared towards number 2. Is that right? The Blender way of doing things would be to set the selection and use the copy/paste operators?
I'd like to know which is the idiomatic way of doing things in Blender.