Hydrogen atom что это

Обновлено: 06.07.2024

Отщепление атома водорода или перенос атома водорода ( HAT ) в химии - это любая химическая реакция, в которой свободный радикал водорода отрывается от субстрата в соответствии с общим уравнением:

Примерами реакций HAT являются окислительные реакции в целом, горение углеводородов и реакции с участием цитохрома P450, содержащего железо (V) -оксо- звено. Абстрактор обычно сам является радикальным видом. Примером отводящего средства с закрытой оболочкой является хлористый хром . HAT может происходить через перенос электронов, связанный с протонами . Синтетический пример находится в цеолитах железа , которые стабилизируют альфа-кислород .

Documentation

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

Troubleshooting

We have a troubleshooting guide! It's pretty sparse at the moment, so please share with us the resolution to any rough spots that you find.

How it works

Hydrogen implements the messaging protocol for Jupyter. Jupyter (formerly IPython) uses ZeroMQ to connect a client (like Hydrogen) to a running kernel (like IJulia or iTorch). The client sends code to be executed to the kernel, which runs it and sends back results.

Hydrogen

This package lets you run your code directly in Atom using any Jupyter kernels you have installed.

Hydrogen was inspired by Bret Victor's ideas about the power of instantaneous feedback and the design of Light Table. Running code inline and in real time is a more natural way to develop. By bringing the interactive style of Light Table to the rock-solid usability of Atom, Hydrogen makes it easy to write code the way you want to.

You also may be interested in our latest project – nteract – a desktop application that wraps up the best of the web based Jupyter notebook.

Checkout our Medium blog post to see what you can do with Hydrogen.

Plugins for Hydrogen

Hydrogen has support for plugins. Feel free to add your own to the list:

  • Hydrogen Launcher: launches terminals and Jupyter consoles connected to Hydrogen
  • hydrogen-python: provides various Python-specific features
  • Data Explorer: allows you to use nteract data-explorer within Hydrogen

If you are interested in building a plugin take a look at our plugin API documentation.

Custom kernel connection

Hydrogen also supports using a custom kernel connection file for each project. It could be used to connect to "remote" environments as Docker, a remote computer, etc. But the method described above using kernel gateways is less error prone and simpler to apply in more cases.

The recommended way of connecting to remote kernels is now using kernel gateways as described above. But if you still need to use a custom kernel connection file you can read the Custom kernel connection guide here.

Why "Hydrogen"?

Hydrogen atoms make up 90% of Jupiter by volume.

Plus, it was easy to make a logo.

Contributing

Thanks for taking the time to contribute. Take a look at our Contributing Guide to get started.

Then, take a look at any issue labeled good first issue or help wanted that has not been claimed. These are great starting points.

Hydrogen

Hydrogen is an interactive coding environment that supports Python, R, JavaScript and other Jupyter kernels.

Checkout our Documentation and Medium blog post to see what you can do with Hydrogen.

Background

Hydrogen was inspired by Bret Victor's ideas about the power of instantaneous feedback and the design of Light Table. Running code inline and in real time is a more natural way to develop. By bringing the interactive style of Light Table to the rock-solid usability of Atom, Hydrogen makes it easy to write code the way you want to.

You also may be interested in our latest project – nteract – a desktop application that wraps up the best of the web based Jupyter notebook.

Useful external packages

Here is a list of external packages that could be useful when using Hydrogen (without using Hydrogen plugin API, as such they're mostly only related to the UIs):

  • markdown-cell-highlight: highlights code cells in markdown files
  • Cell Navigation: enables easy jumps between Hydrogen code cells
  • Hydrogen Cell Separator: gives simple horizontal line decorations for Hydrogen code cells

If you find/create a package that you think can be useful when used in combination with Hydrogen, feel free to make a PR and add it.

I think this package is bad news.

Good catch. Let us know what about this package looks wrong to you, and we'll investigate right away.

Use Atom + Hydrogen!

Less than a year ago I wrote a long post praising Sublime. However, times are a changin’, and during this time I’ve reconsidered my choice of text editor. So without further ado, let me bring forth to you what I believe is the ultimate one:

I will give a detailed explanation on how to set up Atom for use with (my) furious five:

In this post I’ll concentrate on the first three, because they can all be set up to interact with Hydrogen, one of the coolest inventions since avocado on toast.

Features

  • execute a line, selection, or block at a time
  • rich media support for plots, images, and video
  • watch expressions let you keep track of variables and re-run snippets after every change
  • completions from the running kernel, just like autocomplete in the Chrome dev tools
  • code can be inspected to show useful information provided by the running kernel
  • one kernel per language (so you can run snippets from several files, all in the same namespace)
  • interrupt or restart the kernel if anything goes wrong
  • use a custom kernel connection (for example to run code inside Docker), read more in the "Custom kernel connection (inside Docker)" section

How it works

Hydrogen implements the messaging protocol for Jupyter. Jupyter (formerly IPython) uses ZeroMQ to connect a client (like Hydrogen) to a running kernel (like IJulia or iTorch). The client sends code to be executed to the kernel, which runs it and sends back results.

Development

Quick and dirty setup

apm develop hydrogen

This will clone the hydrogen repository to

/github unless you set the ATOM_REPOS_HOME environment variable.

I already cloned it!

If you cloned it somewhere else, you'll want to use apm link --dev within the package directory, followed by apm install to get dependencies.

Workflow

After pulling upstream changes, make sure to run apm update .

To start hacking, make sure to run atom --dev from the package directory. Cut a branch while you're working then either submit a Pull Request when done or when you want some feedback!

Running specs

You can run specs by triggering the window:run-package-specs command in Atom. To run tests on the command line use apm test within the package directory.

You can learn more about how to write specs here.

Atom installation and basic setup


Now we’re ready to go!

I suggest you open the Tree View ( View > Toggle Tree View , or hit Ctrl+\ ), which gives you an overview of the files contained in a folder. You can now right-click anywhere in that pane and select Add Project Folder (or hit Ctrl+Shift+A ) to open any project folder that contains some scripts (eg. *.py files). After doing so you should see something like the following screenshot:


You’ll notice that the file icons in my Tree View probably look much nicer than yours. It’s not only that they’re nice — it’s helpful to be able to tell file types apart at a glance. We’ll fix that now, installing two packages (that I consider) essential:

To install any package in Atom just go to File > Settings (or hit Ctrl+Comma ) and select Install on the left pane (you can also go directly from the welcome screen, if you have it open). Search for file-icons and install it. If you had a project folder open in the Tree Viewer, you should immediately see icons being updated.

Repeat the process above, this time looking up project-manager .

Why "Hydrogen"?

Hydrogen atoms make up 90% of Jupiter by volume.

Plus, it was easy to make a logo.

Usage

Hydrogen provides a selection of commands for running code. Press ⌘-⇧-P to open the command palette and type "hydrogen" and they will come up.

"Hydrogen: Run"

There are two ways to tell Hydrogen which code in your file to run.

Selected code: If you have code selected when you hit Run, Hydrogen will run exactly that code.

Current block: With no code selected, Hydrogen will try to find the complete block that's on or before the current line.

If the line you're on is already a complete expression (like s = "abracadabra" ), Hydrogen will run just that line.

If the line you're on is the start of a block like a for loop, Hydrogen will run the whole block.

If the line you're on is blank, Hydrogen will run the first block above that line.

It's easiest to see these interactions visually:

"Hydrogen: Run And Move Down" will run the the code as described above and move the cursor to the next executable line.

If your code starts getting cluttered up with results, run "Hydrogen: Clear Results" to remove them all at once.

"Hydrogen: Run Cell"

When you place the cursor inside a cell and hit "Run Cell", Hydrogen will execute this cell. The command "Hydrogen: Run Cell And Move Down" will move the cursor to the next cell after execution.

"Hydrogen: Run All" and "Hydrogen: Run All Above"

These commands will run all code inside the editor or all code above the cursor.

Watch Expressions

After you've run some code with Hydrogen, you can use the "Hydrogen: Toggle Watches" command from the Command Palette to open the watch expression sidebar. Whatever code you write in watch expressions will be re-run after each time you send that kernel any other code.

IMPORTANT: Be careful what you put in your watch expressions. If you write code that mutates state in a watch expression, that code will get run after every execute command and likely result in some extremely confusing bugs.

You can re-run the watch expressions by using the normal run shortcut (⌘-↩ by default) inside a watch expression's edit field.

If you have multiple kernels running, you can switch between their watch expressions with the "Hydrogen: Select Watch Kernel" command (or just click on the "Kernel: " text).

Completion

Receive completions from the running kernel.

Code Introspection

You can use the "Hydrogen: Toggle Inspector" command from the Command Palette to get metadata from the kernel about the object under the cursor.

Managing kernels

Sometimes things go wrong. Maybe you've written an infinite loop, maybe the kernel has crashed, or maybe you just want to clear the kernel's namespace. Use the command palette to interrupt (think Ctrl-C in a REPL) or restart the kernel.

You can also access these commands by clicking on the kernel status in the status bar or via the command palette. It looks like this:

Additionally, if you have two or more kernels for a particular language (grammar), you can select which kernel to use with the "Switch to " option in the Kernel Commands menu.

Docker execution via kernel gateways

You can use the same technique to create a kernel gateway in a Docker container. That would allow you to develop from Atom but with all the dependencies, autocompletion, environment, etc. of a Docker container.

Note: due to the way that the kernel gateway creates sub-processes for each kernel, you have to use it in a special way, you can't run the jupyter kernelgateway directly in your Dockerfile CMD section. You need to call it with an init manager such as tini or run it from an interactive console.

If all you need is a Docker Python environment to execute your code, you can read the section Example Jupyter Docker Stack kernel gateway (this method uses tini under the hood).

If you want to add a temporal Kernel Gateway (for development) to your current Docker images or need to modify an existing image to add the Kernel Gateway functionality, read the section Example Docker kernel gateway (this method runs the kernel gateway from an interactive console).

Example Jupyter Docker Stack kernel gateway

Follow this if you only need to have a simple environment to run commands inside a Docker container and nothing more.

If you need to customize a Docker image (e.g. for web development) follow the section below: Example Docker kernel gateway.

Dockerfile
  • Create a Dockerfile based on one of the Jupyter Docker Stacks.
  • Install jupyter_kernel_gateway in your Dockerfile
  • Expose the gateway port, in this example it will be 8888
  • Make the command to run be the Kernel Gateway:
Run Docker Container with Docker commands

Note: alternatively, see below for docker-compose instructions.

  • Build your container:
  • Run your container mapping the port of the gateway
  • Give your container a name

Note: you will only be able to run one container using that port mapping. So, if you had another container using that port, you will have to stop that one first. Or alternatively, you can create a mapping to a new port and add that configuration in the Hydrogen settings (see below).

Run Docker Container with Docker Compose
  • Create a docker-compose.yml file with something like:
  • The docker-compose.yml file has a port mapping using the port exposed in the Dockerfile and used in the jupyter kernelgateway command

Note: you will only be able to run one container using that port mapping. So, if you had another container using that port, you will have to stop that one first. Or alternatively, you can create a mapping to a new port and add that configuration in the Hydrogen settings (see below).

  • Now start (and build) your container with docker-compose :
  • Check the name of your running container with:
Connect Atom

Now you need to connect Atom to your setup. Follow the section Connect Atom below.

Example Docker kernel gateway

Follow this if you need to customize a Docker image you already have. For example, for a web project.

If you only need a simple environment in where to run Python commands with Hydrogen inside a Docker container, follow the section above: Example Jupyter Docker Stack kernel gateway.

Dockerfile
  • Create a Dockerfile
  • Install jupyter_kernel_gateway in your Dockerfile
  • Expose the gateway port, in this example it will be 8888 :
Run Docker Container with Docker commands

Note: alternatively, see below for docker-compose instructions.

  • Build your container:
  • Run your container mapping the port of the gateway
  • Give your container a name
  • Make it run an infinite loop that just keeps the container alive:

Note: you will only be able to run one container using that port mapping. So, if you had another container using that port, you will have to stop that one first. Or alternatively, you can create a mapping to a new port and add that configuration in the Hydrogen settings (see below).

  • Execute an interactive bash session in your running container:
  • From that interactive session, start the gateway
  • Specify the IP 0.0.0.0 to make your container listen to public connections
  • Specify the port that you exposed in your Dockerfile :
Run Docker Container with Docker Compose
  • Create a docker-compose.yml file with something like:
  • The docker-compose.yml file has a port mapping using the port exposed in the Dockerfile and used in the jupyter kernelgateway command
  • The command overrides the default CMD in the Dockerfile (if there was one) and executes an infinite loop that would just keep the container alive

Note: you will only be able to run one container using that port mapping. So, if you had another container using that port, you will have to stop that one first. Or alternatively, you can create a mapping to a new port and add that configuration in the Hydrogen settings (see below).

  • Now start (and build) your container with docker-compose :
  • Check the name of your running container with:
  • Execute an interactive bash session in your running container (use the name from above), e.g.:
  • From that interactive session, start the gateway
  • Specify the IP 0.0.0.0 to make your container listen to public connections
  • Specify the port that you exposed in your Dockerfile :

Connect Atom

  • Go to the settings in Atom with: ctrl-shift-p and type Settings View: Open
  • Go to the "Packages" section
  • Type Hydrogen and go to package settings
  • In the section "List of kernel gateways to use" add settings for the container your created
  • Use a name that you can remind when running Hydrogen
  • In the baseUrl section use the host or IP that you use to access your Docker containers:
    • If you are using Docker Toolbox in Windows or Mac (or Docker for Windows, Docker for Mac), as it will be running in a virtual machine, the IP (host) would probably be like: 192.168.99.100 , you can read about it and check the docker-machine ip default command in the official Docker docs
    • If you are using Docker in a Linux machine and you are running Atom in that same machine you can just use localhost as the host of your baseUrl
    • In Atom, open a Python file, e.g. main.py
    • Connect to the kernel you just configured: ctrl-shift-p and type: Hydrogen: Connect To Remote Kernel
    • Select the kernel gateway you configured, e.g. Docker Toolbox
    • Select the "type of kernel" to run, there will just be the option Python 2 or Python 3
    • Then select the line or block of code that you want to execute inside of your container
    • Run the code with: ctrl-shift-p and type: Hydrogen: Run

    Testing it

    You can test that it is actually working by installing a package in your container that you don't have locally and using it inside your container (from your Atom editor).

    • For example, install the Python package markdown in your Dockerfile :

    Note: If you followed the Example Jupyter Docker Stack kernel gateway section, your Dockerfile will look different. Just make sure you add a line with:

    • Follow all the instructions above, and use a Python file that has:
    • Select the code and run it with: ctrl-shift-p and type Hydrogen: Run , you will see the code executed inline like:

    Terminate the connection and container

    To terminate a running kernel gateway you can "kill" it as any Linux process with ctrl-c

    But, if you are using the general instructions (for a custom Docker image), because of the way Jupyter Kernel Gateway creates sub-processes and due to the fact that you are running in a Docker container, the actual kernel process will still be running.

    • Before exiting the terminal, find the still running (Python) kernel process with:
    • You will get something like:
    • Kill the ipykernel process by killing all the python processes:
    • Now you can exit the interactive terminal with:

    Python, Julia and R with Atom + Hydrogen

    One of the main reasons to use Atom is the Hydrogen package, which is an interactive coding environment that supports Python, R and Julia kernels. Put simply, Hydrogen lets you run code inline and in real time, which is the ideal workflow for rapid developing. A gif is worth a thousand words:

    We’ll set up Atom+Hydrogen to work with Python, R and Julia. You can choose a subset of those packages, of course — the steps involved are pretty much the same for all three of them.

    First you should install the software. Bear in mind that Python is pretty much a prerequisite for using Hydrogen with R and Julia (and other languages), because Jupyter itself depends on Python. R and Julia are optional.

    Install Anaconda Python

    If you have Python in your system (most versions of mac OS and Linux do), I still suggest you install Anaconda, as probably your system comes with Python 2.x, and Anaconda includes conda and IPython. If you already have Python and IPython installed and you know what you’re doing, then this section is not for you.

    R is a venerable programming language for statistical computing. You can download and install R by choosing a CRAN mirror here (for Windows you have to choose the base distribution).

    You’ll now need IRkernel, which is a native R kernel for Jupyter. Assuming you have already installed Anaconda Python (see above), you’ll just need to follow the steps outlined here in order to finish.

    Julia

    Finally, after installing Julia itself you need to add the IJulia package. To do so, just start a Julia interpreter (you should see a line starting with julia> ) and type

    Plugins for Hydrogen

    Hydrogen has support for plugins. Feel free to add your own to the list:

    If you are interested in building a plugin take a look at our plugin API documentation.

    Remote kernels via kernel gateways

    In addition to managing local kernels and connecting to them over ZeroMQ, Hydrogen is also able to connect to Jupyter Notebook (or Jupyter Kernel Gateway) servers. This is most useful for running code remotely (e.g. in the cloud).

    To connect to a server, you must first add the connection information to the Hydrogen gateways setting. An example settings entry might be:

    Each entry in the gateways list needs at minimum a name (for displaying in the UI), and a value for options.baseUrl . The options.token should only be present if your server requires token authentication, in which case it should contain the specific token issued by your server. (Token authentication is enabled by default for Jupyter Notebook 4.3 or later). The options are passed directly to the @jupyterlab/services npm package, which includes documentation for additional fields.

    After gateways have been configured, you can use the "Hydrogen: Connect to Remote Kernel" command. You will be prompted to select a gateway, and then given the choice to either create a new session or connect to an existing one.

    Unlike with local kernels, Hydrogen does not kill remote kernels when it disconnects from them. This allows sharing remote kernels between Hydrogen and the Notebook UI, as well as using them for long-running processes. To clean up unused kernels, you must explicitly call the "Hydrogen: Shutdown Kernel" command while connected to a kernel.

    Example with notebook server

    To set up a server on the remote machine, you could

    To run a server that listens on localhost, use the command:

    • To run a public server, consult the official instructions for setting up certificates. Skip the steps for setting up a password: hydrogen only supports token-based authentication. Also note that hydrogen does not support self-signed certificates -- we recommend that you use Let's Encrypt or consider alternatives such as listening on localhost followed by SSH port forwarding.

    Example with kernel gateway server

    As of December 2016, we recommend that you use a notebook server (version 4.3 or greater) instead of the Jupyter Kernel Gateway. We expect this to change in the future, and will update this README when that occurs.

    Changelog

    Every release is documented on the GitHub Releases page.

    Contents

    Atom + Hydrogen

    Once we have Anaconda Python installed (or any Python distribution + Jupyter), we can now install Hydrogen itself. In Atom, go to Settings ( Ctrl+Comma ) and in the Install pane look for hydrogen and install it.

    Now we’re ready for interactive coding! Create a new file with a .py (or .R or .jl ) extension and write some code. For instance, you could create a new file called test.py with the following lines:

    If you hit Ctrl+Enter in any line, Hydrogen should evaluate it in the appropriate kernel (Python, in this case) and output the result inline. You can also evaluate multiple lines by selecting them, or the full script with Ctrl+Shift+Alt+Enter . I suggest you read Hydrogen’s documentation to see what you can do with it. Below I demonstrate how to evaluate the code above.

    Features

    • execute a line, selection, or block at a time
    • rich media support for plots, images, and video
    • watch expressions let you keep track of variables and re-run snippets after every change
    • completions from the running kernel, just like autocomplete in the Chrome dev tools
    • code can be inspected to show useful information provided by the running kernel
    • one kernel per language (so you can run snippets from several files, all in the same namespace)
    • interrupt or restart the kernel if anything goes wrong
    • use a custom kernel connection (for example to run code inside Docker), read more in the "Custom kernel connection (inside Docker)" section

    License

    This project is licensed under the MIT License - see the LICENSE.md file for details

    Нерадикальное отведение водорода

    Сообщается , что в литературе во время синтеза Коэлентеразин производного, наблюдалось нерадикальными абстракции водорода на замещенного aminoimidazole в типичном Sandmayer состоянии hyroxilation.

    Installation

    For all systems, you'll need

    • Atom 1.6.0+
    • Jupyter: If you have Python and conda or pip setup, install the notebook directly with conda install jupyter or pip install jupyter .

    You can now run apm install hydrogen or search for Hydrogen in the Install pane of the Atom settings.

    If you are using Linux 32-bit follow the installation instructions here.

    Kernels

    Tested and works with:

    But it should work with any kernel. If you are using Hydrogen with another kernel please add it to this list or post an issue if anything is broken!

    Note that if you install a new kernel, you'll need to run Hydrogen: Update Kernels for Hydrogen to find it. For performance reasons, Hydrogen only looks for available kernels when it first starts.

    Debian 8 and Ubuntu 16.04 LTS

    Unfortunately, the versions of IPython provided in Debian's and Ubuntu's repositories are rather old and Hydrogen is unable to detect the kernel specs installed in your machine. To workaround this issue, Hydrogen provides the setting KernelSpec , where the user can declare the kernel specs manually. Find the KernelSpec setting in the Atom GUI by going to the Settings pane, click Packages, search for Hydrogen, and click the Hydrogen Settings button.

    Below is an example KernelSpec for IPython 2 and 3:

    Читайте также: